-
Notifications
You must be signed in to change notification settings - Fork 0
/
TwiISR.cpp
33 lines (26 loc) · 1.09 KB
/
TwiISR.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
//======================================================================
// TwiISR.cpp
//======================================================================
#include "MyAvr.hpp"
#include "Twis.hpp"
#include "Twim.hpp"
//TWIxN_ISR_ENABLE located in MyAvr.hpp
//call the static function isr() with the instance number
//the Twim/Twis class will use the instance number to lookup
//the object, then call the object's private isr_() function
//(default instance number for isr() is 0)
//this method is used so the class is not required to be
//all static, and allows the use of more than one twi
//instance (TWI1) if available
#if defined(TWIM0_ISR_ENABLE) && TWIM0_ISR_ENABLE
ISR (TWI0_TWIS_vect) { Twis::isr();} //TWI0
#endif
#if defined(TWIS0_ISR_ENABLE) && TWIS0_ISR_ENABLE
ISR (TWI0_TWIM_vect) { Twim::isr(); }
#endif
#if defined(TWI1) && defined(TWIM1_ISR_ENABLE) && TWIM1_ISR_ENABLE
ISR (TWI1_TWIS_vect) { Twis::isr(1);} //1 = TWI1
#endif
#if defined(TWI1) && defined(TWIM1_ISR_ENABLE) && TWIM1_ISR_ENABLE
ISR (TWI1_TWIM_vect) { Twim::isr(1); }
#endif