#include "i2c_eeprom.h"
#include "backlight.h"
#include "rencoder.h"
+#include "euart.h"
+#include "uart_termio.h"
+#include "shell_strutl.h"
+#include "term_shell.h"
/*
* Config words.
XINST=OFF
#endif
-#define USE_RENCODER
/*
* Statuses
SIGHANDLER(TMR1_Handler)
#endif
{
-#ifdef USE_RENCODER
- rencoder_count();
-#endif
- rencoder_restart();
+// rencoder_count();
+ rencoder_tmrhook();
}
#ifdef __XC
SIGHANDLER(RBIF_handler)
#endif
{
- power_on_inthook();
-// if(chk_powerbutton(0, 0) != 0) { // If pressed on
-// power_off(1); //
-// }
+ if(IOCBbits.IOCB4 != 0) {
+ power_on_inthook();
+ } else {
+ rencoder_inthook();
+ }
}
#ifdef __XC
void EEPROM_handler(void)
PIR2bits.BCLIF = 0;
}
+#ifdef __XC
+void UART_R_Handler(void)
+#else
+SIGHANDLER(UART_R_Handler)
+#endif
+{
+ uart_inthdr_rx();
+}
#ifdef __SDCC
DEF_INTHIGH(inthigh_handler)
DEF_HANDLER(SIG_RBIF, RBIF_handler)
-// DEF_HANDLER(SIG_EEIF, EEPROM_handler)
+ DEF_HANDLER(SIG_RCIF, UART_R_handler)
// DEF_HANDLER(SIG_TMR1, TMR1_Handler)
// DEF_HANDLER(SIG_INT1, EXINT_Handler)
DEF_HANDLER(SIG_INT2, EXINT_Handler)
void interrupt high_priority inthigh_handler(void)
{
if(INTCONbits.RBIF) RBIF_handler();
-// if(PIR2bits.EEIF) EEPROM_handler();
if(PIR1bits.TMR1IF) TMR1_Handler();
+ if(PIR1bits.RC1IF) UART_R_Handler();
// if(PIR2bits.TMR3IF) TMR3_Handler();
// if(INTCON3bits.INT1IF) EXINT_Handler();
// if(INTCON3bits.INT2IF) EXINT_Handler();
shutdown(1);
}
+
int main(void)
{
unsigned char c;
WDTCONbits.SWDTEN = 1; // WDT ON.
power_on(1);
//intadc_init();
- set_powerlamp(1);
valinit();
acm1602_init(LCD_I2CADDR, 1); //Init LCD
lcd_setbacklight(0xff, 255);
/* Push default parameters to AKC6955*/
setup_akc6955();
_CLS();
+ uart_init();
//_LOCATE(0,0);
_PUTCHAR(' ');
update_status();
update_display();
ClrWdt();
- ui_idlekey = setup.ui_idlecount / 92;
- ui_idlepad = setup.ui_idlecount % 23;
-#ifdef USE_RENCODER
- rencoder_init();
+ ui_idlekey = setup.ui_idlecount / 92;
+ ui_idlepad = setup.ui_idlecount % 23;
+ rencoder_init();
rencoder_start();
-#endif
do {
-#if 1
if(battlevel < 340) { // 3.4V
lvcount++;
if(lvcount > 4) {
} else {
lvcount = 0;
}
-#endif
/* Main routine*/
-
+ term_shell(0); // Steel Shell
for(i = 0; i < 4; i++) {
c = pollkey_single_timeout(ui_idlekey, 1); // 23*41 = 943ms
p = 0;
setfreq_updown(c);
update_status();
update_display();
-#ifdef USE_RENCODER
rencoder_start();
-#endif
}
ClrWdt();
}