42 #define CONFIG_LED1() CONFIG_RB14_AS_DIG_OUTPUT()
43 #define LED1 _LATB14 //led1 state
47 CONFIG_RB13_AS_DIG_INPUT();
52 #define SW1 _RB13 //switch value
53 #define SW1_PRESSED() (SW1==0) //switch test
54 #define SW1_RELEASED() (SW1==1) //switch test
57 volatile uint8_t u8_pressAndRelease = 0;
62 STATE_WAIT_FOR_RELEASE
65 volatile STATE e_mystate = STATE_RESET;
68 void _ISRFAST _T3Interrupt (
void) {
69 if (!u8_pressAndRelease) {
72 case STATE_WAIT_FOR_PRESS:
74 e_mystate = STATE_WAIT_FOR_RELEASE;
77 case STATE_WAIT_FOR_RELEASE:
81 u8_pressAndRelease = 1;
82 e_mystate = STATE_WAIT_FOR_PRESS;
86 e_mystate = STATE_WAIT_FOR_PRESS;
93 #define ISR_PERIOD 15 // in ms
94 void configTimer3(
void) {
99 T3CON = T3_OFF |T3_IDLE_CON | T3_GATE_OFF
123 if (!u8_pressAndRelease) {
129 u8_pressAndRelease = 0;