2011-05-21 10:05:48 +00:00
|
|
|
#include <sysinit.h>
|
|
|
|
|
|
|
|
#include "basic/basic.h"
|
|
|
|
|
|
|
|
#include "lcd/render.h"
|
2011-05-21 17:12:51 +00:00
|
|
|
#include "lcd/allfonts.h"
|
2011-05-21 10:05:48 +00:00
|
|
|
|
2011-06-13 21:59:02 +00:00
|
|
|
void backlightInit(void);
|
2011-05-21 10:05:48 +00:00
|
|
|
|
|
|
|
/**************************************************************************/
|
|
|
|
|
|
|
|
void module_sec(void) {
|
|
|
|
|
2011-06-12 20:54:41 +00:00
|
|
|
backlightInit();
|
|
|
|
|
2011-05-21 10:05:48 +00:00
|
|
|
//disable the JTAG on PIO3_3
|
|
|
|
IOCON_PIO3_3 = 0x10;
|
|
|
|
|
|
|
|
int yctr=8;
|
|
|
|
int dx=0;
|
|
|
|
|
|
|
|
font_direction = FONT_DIR_LTR; // LeftToRight is the default
|
|
|
|
|
|
|
|
yctr=18;
|
|
|
|
|
|
|
|
uint8_t trigger;
|
|
|
|
|
2011-06-13 21:59:02 +00:00
|
|
|
trigger=20;
|
2011-05-21 10:05:48 +00:00
|
|
|
|
|
|
|
uint32_t ctr=0;
|
2011-06-13 21:59:02 +00:00
|
|
|
char key;
|
2011-05-21 10:05:48 +00:00
|
|
|
while (1) {
|
2011-06-13 21:59:02 +00:00
|
|
|
ctr++;
|
|
|
|
|
|
|
|
lcdDisplay(0);
|
|
|
|
delayms(10);
|
|
|
|
|
|
|
|
key= getInput();
|
|
|
|
if(key==BTN_UP){
|
|
|
|
trigger +=1;
|
|
|
|
}else if (key ==BTN_DOWN){
|
|
|
|
trigger -=1;
|
|
|
|
};
|
|
|
|
|
|
|
|
font=&Font_7x8;
|
|
|
|
dx=DoString(0,0,"Trig:");
|
|
|
|
dx=DoInt(dx,0,trigger);
|
|
|
|
DoString(dx,0," ");
|
|
|
|
|
|
|
|
// Easy flashing
|
|
|
|
if(key==BTN_LEFT){
|
|
|
|
DoString(0,8,"Enter ISP!");
|
|
|
|
lcdDisplay(0);
|
|
|
|
ISPandReset(5);
|
|
|
|
};
|
|
|
|
|
|
|
|
// Display nickname
|
|
|
|
font = &Font_Ubuntu36pt;
|
|
|
|
dx=DoString(0,0,"Sec");
|
|
|
|
|
|
|
|
// Blink LED
|
|
|
|
if(ctr++>trigger){
|
|
|
|
ctr=0;
|
|
|
|
if (gpioGetValue(RB_LED2) == CFG_LED_OFF){
|
|
|
|
gpioSetValue (RB_LED2, CFG_LED_ON);
|
|
|
|
} else {
|
|
|
|
gpioSetValue (RB_LED2, CFG_LED_OFF);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
// Print Voltage
|
|
|
|
font = &Font_7x8;
|
|
|
|
dx=DoString(0,yctr+28,"Voltage:");
|
|
|
|
DoInt(dx,yctr+28,GetVoltage());
|
2011-05-21 10:05:48 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return;
|
|
|
|
}
|
2011-06-13 21:59:02 +00:00
|
|
|
|
|
|
|
void tick_sec(void){
|
|
|
|
static int foo=0;
|
|
|
|
static int toggle=0;
|
|
|
|
if(foo++>50){
|
|
|
|
toggle=1-toggle;
|
|
|
|
foo=0;
|
|
|
|
gpioSetValue (RB_LED0, toggle);
|
|
|
|
};
|
|
|
|
return;
|
|
|
|
};
|