AvrIO  1.4.5
Bibliothèque C modulaire pour ATMEL AVR
tws.h
1 
22 #ifndef _AVRIO_TWS_H_
23 #define _AVRIO_TWS_H_
24 
25 #include <avrio/defs.h>
26 #include <avr/interrupt.h>
27 __BEGIN_C_DECLS
28 /* ========================================================================== */
73 uint8_t ucTwsToMaster (void);
74 
75 
89 void ucTwsFromMaster (uint8_t data);
90 
97 void vTwsBusErrorCheck (void);
98 
103 #if defined(__DOXYGEN__)
104 /*
105  * __DOXYGEN__ defined
106  * Partie documentation ne devant pas être compilée.
107  * =============================================================================
108  */
115 static inline void vTwsInit (uint8_t ucOwnAddress);
116 
117 #else
118 /*
119  * __DOXYGEN__ not defined
120  * Partie ne devant pas être documentée.
121  * =============================================================================
122  */
123 #include <avr/io.h>
124 #include <avr/interrupt.h>
125 
126 // -----------------------------------------------------------------------------
127 INLINE void
128 vTwsInit (uint8_t ucOwnAddress) {
129 
130  TWSA = ucOwnAddress; // Set TWI slave address.
131  TWSD = 0xFF; // Default content = SDA released.
132  TWSCRB = _BV(TWHNM);
133  TWSCRA = (uint8_t) (_BV (TWEN) | _BV (TWSHE) | // Enable TWI-interface and release TWI pins.
134  _BV (TWDIE) | _BV (TWASIE) | _BV (TWSIE)); // Enable TWI Interupts.
135 }
136 #endif /* __DOXYGEN__ not defined */
137 
138 /* ========================================================================== */
139 __END_C_DECLS
140 #endif /* _AVRIO_TWS_H_ */
void ucTwsFromMaster(uint8_t data)
Gestionnaire de réception au maître.
uint8_t ucTwsToMaster(void)
Gestionnaire de transmission au maître.
void vTwsBusErrorCheck(void)
Vérification et acquittement des erreurs bus I2C.
#define _BV(n)
Renvoie un masque avec le bit de rang n à 1.
Definition: defs.h:76