2011-08-02 00:10:15 +00:00
|
|
|
#include <sysinit.h>
|
2011-08-02 00:45:25 +00:00
|
|
|
#include <string.h>
|
2011-08-02 00:10:15 +00:00
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
#include "basic/config.h"
|
|
|
|
|
2011-08-02 08:55:01 +00:00
|
|
|
#include "lcd/render.h"
|
2011-08-02 00:10:15 +00:00
|
|
|
#include "lcd/print.h"
|
|
|
|
|
|
|
|
#include "usb/usbmsc.h"
|
|
|
|
|
2011-08-02 00:45:25 +00:00
|
|
|
#include "core/iap/iap.h"
|
2011-08-02 00:10:15 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU debug ChkLight
|
2011-08-02 00:45:25 +00:00
|
|
|
void ChkLight(void) {
|
2011-08-02 00:10:15 +00:00
|
|
|
int dx=0;
|
|
|
|
int dy=8;
|
|
|
|
dx=DoString(0,dy,"Light:");
|
|
|
|
DoString(0,dy+16,"Night:");
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
DoInt(dx,dy,GetLight());
|
|
|
|
DoInt(dx,dy+16,isNight());
|
|
|
|
DoInt(dx,dy+8,GLOBAL(daytrig));
|
|
|
|
lcdDisplay();
|
2011-08-02 00:45:25 +00:00
|
|
|
delayms_queue(100);
|
2011-08-02 00:10:15 +00:00
|
|
|
};
|
2011-08-02 00:45:25 +00:00
|
|
|
dx=DoString(0,dy+24,"Done.");
|
|
|
|
}
|
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU debug ChkBattery
|
2011-08-02 00:45:25 +00:00
|
|
|
void ChkBattery(void) {
|
|
|
|
do{
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("Voltage:");
|
|
|
|
lcdPrintln(IntToStr(GetVoltage(),5,0));
|
|
|
|
lcdNl();
|
|
|
|
lcdPrintln("Chrg_stat:");
|
|
|
|
if(gpioGetValue(RB_PWR_CHRG)){
|
|
|
|
lcdPrintln("1");
|
|
|
|
}else{
|
|
|
|
lcdPrintln("0");
|
|
|
|
};
|
|
|
|
lcdRefresh();
|
2011-08-02 18:53:43 +00:00
|
|
|
delayms_queue(100);
|
2011-08-02 00:45:25 +00:00
|
|
|
} while ((getInputRaw())==BTN_NONE);
|
|
|
|
}
|
2011-08-02 00:10:15 +00:00
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU debug Uptime
|
2011-08-02 00:10:15 +00:00
|
|
|
void uptime(void) {
|
|
|
|
int t;
|
|
|
|
int h;
|
|
|
|
char flag;
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("Uptime:");
|
|
|
|
t=getTimer()/(1000/SYSTICKSPEED);
|
|
|
|
h=t/60/60;
|
|
|
|
flag=F_ZEROS;
|
|
|
|
if(h>0){
|
|
|
|
lcdPrint(IntToStr(h,2,flag));
|
|
|
|
lcdPrint("h");
|
|
|
|
flag|=F_LONG;
|
|
|
|
};
|
|
|
|
h=t/60%60;
|
|
|
|
if(h>0){
|
|
|
|
lcdPrint(IntToStr(h,2,flag));
|
|
|
|
lcdPrint("m");
|
|
|
|
flag|=F_LONG;
|
|
|
|
};
|
|
|
|
h=t%60;
|
|
|
|
if(h>0){
|
|
|
|
lcdPrint(IntToStr(h,2,flag));
|
|
|
|
lcdPrint("s");
|
|
|
|
};
|
|
|
|
lcdNl();
|
2011-08-02 00:45:25 +00:00
|
|
|
lcdNl();
|
|
|
|
lcdPrintln("Ticks:");
|
|
|
|
lcdPrint(IntToStr(_timectr,10,0));
|
2011-08-02 00:10:15 +00:00
|
|
|
lcdRefresh();
|
|
|
|
delayms_queue(200);
|
|
|
|
};
|
|
|
|
lcdPrintln("done.");
|
|
|
|
}
|
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU debug Uuid
|
2011-08-02 00:45:25 +00:00
|
|
|
void uuid(void) {
|
|
|
|
IAP_return_t iap_return;
|
|
|
|
iap_return = iapReadSerialNumber();
|
|
|
|
lcdClear();
|
|
|
|
lcdPrintln("UUID:");
|
|
|
|
lcdPrintIntHex(iap_return.Result[0]); lcdNl();
|
|
|
|
lcdPrintIntHex(iap_return.Result[1]); lcdNl();
|
|
|
|
lcdPrintIntHex(iap_return.Result[2]); lcdNl();
|
|
|
|
lcdPrintIntHex(iap_return.Result[3]); lcdNl();
|
|
|
|
lcdNl();
|
|
|
|
lcdPrintln("Beacon ID:");
|
|
|
|
lcdPrintln(IntToStrX(GetUUID32(),4));
|
|
|
|
lcdRefresh();
|
|
|
|
}
|
2011-08-02 08:55:01 +00:00
|
|
|
|
2011-08-02 11:31:57 +00:00
|
|
|
//# MENU debug Qstatus
|
2011-08-02 08:55:01 +00:00
|
|
|
void Qstatus(void) {
|
|
|
|
int dx=0;
|
|
|
|
int dy=8;
|
|
|
|
lcdClear();
|
|
|
|
dx=DoString(0,dy+16,"Qdepth:");
|
|
|
|
while ((getInputRaw())!=BTN_ENTER){
|
|
|
|
DoInt(dx,dy+16,(the_queue.qend-the_queue.qstart+MAXQENTRIES)%MAXQENTRIES);
|
|
|
|
lcdDisplay();
|
|
|
|
if(getInputRaw()!=BTN_NONE)
|
|
|
|
work_queue();
|
|
|
|
else
|
|
|
|
delayms(10);
|
|
|
|
};
|
|
|
|
dy+=16;
|
|
|
|
dx=DoString(0,dy,"Done.");
|
|
|
|
};
|
|
|
|
|
|
|
|
void blink_led0(void){
|
|
|
|
gpioSetValue (RB_LED0, 1-gpioGetValue(RB_LED0));
|
|
|
|
};
|
|
|
|
|
|
|
|
void tick_alive(void){
|
|
|
|
static int foo=0;
|
|
|
|
|
|
|
|
if(GLOBAL(alivechk)==0)
|
|
|
|
return;
|
|
|
|
|
|
|
|
if(foo++>500/SYSTICKSPEED){
|
|
|
|
foo=0;
|
|
|
|
if(GLOBAL(alivechk)==2)
|
|
|
|
push_queue(blink_led0);
|
|
|
|
else
|
|
|
|
blink_led0();
|
|
|
|
};
|
|
|
|
return;
|
|
|
|
};
|
2011-08-02 18:53:43 +00:00
|
|
|
|
|
|
|
//# MENU debug ShowSP
|
|
|
|
void getsp(void) {
|
|
|
|
int dx=0;
|
|
|
|
int dy=8;
|
|
|
|
int x;
|
|
|
|
lcdClear();
|
|
|
|
dx=DoString(0,dy,"SP:");
|
|
|
|
while ((getInputRaw())==BTN_NONE){
|
|
|
|
__asm( "mov %0, sp\n" : "=r" (x) :);
|
|
|
|
DoIntX(0,dy+8,x);
|
|
|
|
lcdDisplay();
|
|
|
|
delayms_queue(50);
|
|
|
|
};
|
|
|
|
dy+=16;
|
|
|
|
dx=DoString(0,dy,"Done.");
|
|
|
|
};
|