You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When working with the Watchdog, code has to be executed directly after waking up, otherwise the watchdog resets the Microcontroller.
When USI_Start_Condition_ISR() is called, then the processor might have been woken from any sleep mode, which means that the Watchdog has to be turned off very early during its execution.
I propose a callback for this. I have tested an implementation of this with my current application ATTinyDaemon with different communication partners (RPi3, RPI Zero...) and it works without adverse effects. Here is what my implementation looks like in USI_TWI_Slave.c, line 161ff:
__interrupt void USI_Start_Condition_ISR(void)
#endif
{
unsigned char tmpPin; // Temporary variable for pin state
unsigned char tmpRxHead; // Temporary variable to store volatile
if (USI_TWI_On_Slave_Interrupt) {
USI_TWI_On_Slave_Interrupt();
}
// call slave receive callback on repeated start
...
together with adding the attribute in TWI_Slave.h, line 41,
void (*USI_TWI_On_Slave_Interrupt)(void);
a method declaration in USIWire.h, line 66
void onInterrupt( void (*)(void) );
and the following in USIWire.c, line 282ff:
// sets function called on slave interrupt
void USIWire::onInterrupt( void (*function)(void) ) {
USI_TWI_On_Slave_Interrupt = function;
}
The text was updated successfully, but these errors were encountered:
When working with the Watchdog, code has to be executed directly after waking up, otherwise the watchdog resets the Microcontroller.
When USI_Start_Condition_ISR() is called, then the processor might have been woken from any sleep mode, which means that the Watchdog has to be turned off very early during its execution.
I propose a callback for this. I have tested an implementation of this with my current application ATTinyDaemon with different communication partners (RPi3, RPI Zero...) and it works without adverse effects. Here is what my implementation looks like in USI_TWI_Slave.c, line 161ff:
together with adding the attribute in TWI_Slave.h, line 41,
a method declaration in USIWire.h, line 66
and the following in USIWire.c, line 282ff:
The text was updated successfully, but these errors were encountered: