* Debug on pin 1 of DIP18 package, RA2.
* Set pin high when processing in the loop. Low during wait or sleep.
At 4 MHz, we see that processing within the loop is at most 12 ms, and
we have a loop period constraint of 32 ms. We could run at 2 MHz too...
const static int range_fade_steps[4] = { 1, 1, 1, 1 };
#endif
+#define dbgpin_init() \
+do { \
+ /* Set RA2 as output low */ \
+ PORTA &= ~0x04; \
+ TRISA &= ~0x04; \
+} while (0)
+
+#define dbgpin_high() PORTA |= 0x04;
+#define dbgpin_low() PORTA &= ~0x04;
+
int main(void)
{
led_t red = INIT_LED;
unused_init();
buttons_init();
rgb_init();
+ dbgpin_init();
reset_steps();
if (buttons_on())
rgb_on();
+ dbgpin_high();
while (1) {
unsigned char buttons = buttons_read();
wht.increment = (neww - wht.value) / fade_steps;
wht.remainder = neww - (wht.value + wht.increment * fade_steps);
}
+ dbgpin_low();
__delay_ms(STEP_SIZE); /* step should be start to start... */
+ dbgpin_high();
} else {
rgb_off();
+ dbgpin_low();
buttons_sleep();
+ dbgpin_high();
reset_steps();
rgb_on();
red.value = 0;