with lu_argc & lu_argv
This commit is contained in:
parent
fde95b88a8
commit
51f96b3a01
@ -11,8 +11,12 @@
|
||||
*
|
||||
*/
|
||||
|
||||
int main()
|
||||
int main(int argc,char *argv[])
|
||||
{
|
||||
//by Small Lu(mo10), Sky Arrow's first son.
|
||||
lu_argc=argc;
|
||||
lu_argv=argv;
|
||||
|
||||
mikuPiSetup();
|
||||
setup();
|
||||
while(1)
|
||||
|
||||
@ -2,6 +2,7 @@
|
||||
#define _MIKUDUINO_H_
|
||||
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include "MikuPi.h"
|
||||
|
||||
#define D3 bPinTowPin[3]
|
||||
@ -36,4 +37,7 @@
|
||||
void setup();
|
||||
void loop();
|
||||
|
||||
int lu_argc;
|
||||
char **lu_argv;
|
||||
|
||||
#endif
|
||||
|
||||
11
MikuOled.cpp
11
MikuOled.cpp
@ -1,9 +1,18 @@
|
||||
#include <string.h>
|
||||
|
||||
#include "MikuDuino.h"
|
||||
#include "Wire.h"
|
||||
#include "MikuOled.h"
|
||||
|
||||
/*
|
||||
* MikuPi.cpp:
|
||||
*
|
||||
* Welcome to MikuQ.com! MikuDuino for BananaPi
|
||||
*
|
||||
* by MikuQ(i@mikuq.com)
|
||||
*
|
||||
* https://github.com/bpiq/MikuPi
|
||||
*
|
||||
*/
|
||||
|
||||
uint8 Miku_Oled::buf[OLED_BUFFER_LENGTH+1];
|
||||
|
||||
|
||||
66
MikuPi.cpp
66
MikuPi.cpp
@ -33,14 +33,25 @@ const char *i2cDevices[3] =
|
||||
const char *piModelNames [7] =
|
||||
{
|
||||
"Unknown",
|
||||
"BPI-M1 ",
|
||||
"BPI-R1 ",
|
||||
"BPI-M2 ",
|
||||
"BPI-M1",
|
||||
"BPI-R1",
|
||||
"BPI-M2",
|
||||
"BPI-M1+",
|
||||
"BPI-M3 ",
|
||||
"BPI-M3",
|
||||
"BPI-M2+",
|
||||
} ;
|
||||
|
||||
const char *piModelFullNames [7] =
|
||||
{
|
||||
"Unknown",
|
||||
"BananaPi-M1",
|
||||
"BananaPi-R1",
|
||||
"BananaPi-M2",
|
||||
"BananaPi-M1+",
|
||||
"BananaPi-M3",
|
||||
"BananaPi-M2+",
|
||||
} ;
|
||||
|
||||
int MikuPiDebug = FALSE;
|
||||
|
||||
static int *wPinToGpio ;
|
||||
@ -126,6 +137,53 @@ static void piBoardRevOops (const char *why)
|
||||
exit (EXIT_FAILURE) ;
|
||||
}
|
||||
|
||||
int piCpuTemp(char* temp)
|
||||
{
|
||||
int model, mem;
|
||||
int iTemp=-300000;
|
||||
strcpy(temp,"none");
|
||||
piBoardId (&model, &mem);
|
||||
FILE *tempFd;
|
||||
switch(model)
|
||||
{
|
||||
case PI_MODEL_UNKNOWN:
|
||||
case PI_MODEL_M2:
|
||||
break;
|
||||
case PI_MODEL_M1:
|
||||
case PI_MODEL_M1p:
|
||||
case PI_MODEL_R1:
|
||||
if ((tempFd = fopen ("/sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input", "r")) == NULL)
|
||||
{
|
||||
printf("Unable to open /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input\n");
|
||||
break;
|
||||
}
|
||||
while (fgets (temp, 20, tempFd) != NULL)
|
||||
{
|
||||
iTemp=atoi(temp);
|
||||
float f=iTemp/1000.0f;
|
||||
sprintf(temp,"%.1f",f);
|
||||
break;
|
||||
}
|
||||
fclose(tempFd);
|
||||
break;
|
||||
default:
|
||||
if ((tempFd = fopen ("/sys/class/thermal/thermal_zone0/temp", "r")) == NULL)
|
||||
{
|
||||
printf("Unable to open /sys/devices/platform/sunxi-i2c.0/i2c-0/0-0034/temp1_input\n");
|
||||
break;
|
||||
}
|
||||
while (fgets (temp, 20, tempFd) != NULL)
|
||||
{
|
||||
iTemp=atoi(temp)*1000;
|
||||
float f=iTemp/1000.0f;
|
||||
sprintf(temp,"%.0f",f);
|
||||
break;
|
||||
}
|
||||
fclose(tempFd);
|
||||
}
|
||||
return iTemp;
|
||||
}
|
||||
|
||||
void piBoardId(int *model, int *mem)
|
||||
{
|
||||
FILE *cpuFd ;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user