Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
Permission to use, copy, modify, distribute, and sell this
software and its documentation for any purpose is hereby granted
}
/** Initializes the hardware and software associated with the V2 protocol command handling. */
void V2Protocol_Init(void)
{
}
/** Initializes the hardware and software associated with the V2 protocol command handling. */
void V2Protocol_Init(void)
{
/* Initialize the ADC converter for VTARGET level detection on supported AVR models */
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
ADC_SetupChannel(VTARGET_ADC_CHANNEL);
ADC_StartReading(VTARGET_REF_MASK | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK);
#endif
/* Initialize the ADC converter for VTARGET level detection on supported AVR models */
ADC_Init(ADC_FREE_RUNNING | ADC_PRESCALE_128);
ADC_SetupChannel(VTARGET_ADC_CHANNEL);
ADC_StartReading(VTARGET_REF_MASK | ADC_RIGHT_ADJUSTED | VTARGET_ADC_CHANNEL_MASK);
#endif
- /* Start the watchdog with timeout interrupt enabled to manage the timeout */
- TimeoutExpired = false;
- wdt_enable(WDTO_1S);
- WDTCSR |= (1 << WDIE);
+ /* Reset timeout counter duration and start the timer */
+ TimeoutTicksRemaining = COMMAND_TIMEOUT_TICKS;
+ TCCR0B = ((1 << CS02) | (1 << CS00));