Add charge led function
This commit is contained in:
parent
608885ea06
commit
e68960f0c7
|
@ -86,6 +86,15 @@ void tick_default(void) {
|
|||
|
||||
|
||||
EVERY(50,0){
|
||||
if(GLOBAL(chargeled)){
|
||||
IOCON_PIO1_11 = 0x0;
|
||||
gpioSetDir(RB_LED3, gpioDirection_Output);
|
||||
if(GetChrgStat())
|
||||
gpioSetValue (RB_LED3, 1);
|
||||
else
|
||||
gpioSetValue (RB_LED3, 0);
|
||||
};
|
||||
|
||||
if(GetVoltage()<3600){
|
||||
IOCON_PIO1_11 = 0x0;
|
||||
gpioSetDir(RB_LED3, gpioDirection_Output);
|
||||
|
|
|
@ -136,6 +136,7 @@ void delayms(uint32_t ms);
|
|||
// voltage.c
|
||||
void VoltageCheck(void);
|
||||
uint32_t GetVoltage(void);
|
||||
uint8_t GetChrgStat(void);
|
||||
|
||||
// night.c
|
||||
void LightCheck(void);
|
||||
|
|
|
@ -28,6 +28,7 @@ struct CDESC the_config[]= {
|
|||
{"flamemaxw", 255, 1, 255, 1, CFG_TYPE_FLAME},
|
||||
{"flameminw", 0x8f, 1, 255, 1, CFG_TYPE_FLAME},
|
||||
{"l0nick", 0, 0, 1 , 0, 0},
|
||||
{"chargeled", 1, 0, 1 , 0, 0},
|
||||
{ NULL, 0, 0, 0 , 0, 0},
|
||||
};
|
||||
|
||||
|
|
|
@ -42,9 +42,10 @@ extern char nickl0[];
|
|||
#define GLOBALflamemaxw (the_config[14].value)
|
||||
#define GLOBALflameminw (the_config[15].value)
|
||||
#define GLOBALl0nick (the_config[16].value)
|
||||
#define GLOBALchargeled (the_config[17].value)
|
||||
#define GLOBALnickname (nickname)
|
||||
#define GLOBALnickfont (nickfont)
|
||||
#define GLOBALnickl0 (nickl0)
|
||||
#define GLOBALnickl0 (nickl0)
|
||||
|
||||
#define GLOBAL(x) GLOBAL ## x
|
||||
|
||||
|
|
|
@ -3,10 +3,13 @@
|
|||
#include "basic/basic.h"
|
||||
#include "funk/nrf24l01p.h"
|
||||
|
||||
uint32_t results=5000;
|
||||
static uint32_t results=5000;
|
||||
static uint8_t chrg=1;
|
||||
|
||||
void VoltageCheck(void){
|
||||
|
||||
chrg=gpioGetValue(RB_PWR_CHRG);
|
||||
|
||||
results = adcRead(1);
|
||||
results *= 10560;
|
||||
results /= 1024;
|
||||
|
@ -24,3 +27,7 @@ void VoltageCheck(void){
|
|||
uint32_t GetVoltage(void){
|
||||
return results;
|
||||
};
|
||||
|
||||
uint8_t GetChrgStat(void){
|
||||
return !chrg;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue