updated math functions
This commit is contained in:
18
headers/i2c.h
Normal file
18
headers/i2c.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef I2C_H
|
||||
#define I2C_H
|
||||
|
||||
// table 22-7 : prescale sets
|
||||
#define TWI_PRESCALE_SET(value) \
|
||||
((value) == 1 ? (0<<TWPS1 | 0<<TWPS0) : \
|
||||
(value) == 4 ? (0<<TWPS1 | 1<<TWPS0) : \
|
||||
(value) == 16 ? (1<<TWPS1 | 0<<TWPS0) : \
|
||||
(value) == 64 ? (1<<TWPS1 | 1<<TWPS0) : 0x00)
|
||||
|
||||
// 22.7.1 : TWCR, Master Transmitter Mode
|
||||
#define SEND_START_CONDITION ((1<<TWINT) | (1<<TWEN)) | (1<<TWSTA)
|
||||
#define SEND_CONTINUE_TRANSMISSION ((1<<TWINT) | (1<<TWEN))
|
||||
#define SEND_STOP_CONDITION ((1<<TWINT) | (1<<TWEN)) | (1<<TWSTO)
|
||||
#define SEND_ACKNOWLEDGE ((1<<TWINT) | (1<<TWEN) | (1<<TWEA))
|
||||
#define SEND_NACKNOWLEDGE ((1<<TWINT) | (1<<TWEN))
|
||||
|
||||
#endif // I2C_H
|
||||
Reference in New Issue
Block a user