Start working on system initialization
This commit is contained in:
@@ -13,6 +13,9 @@
|
||||
#define TW_MR_SLA_NACK 0x48
|
||||
#define TW_MR_DATA_ACK 0x50
|
||||
|
||||
// XXX: Handle interrupts in TWI_vect ISR? This may not
|
||||
// actually be much better than the blocking approach
|
||||
|
||||
int TWI_Init(void)
|
||||
{
|
||||
// Set SCL bit rate to 400kHz
|
||||
@@ -23,7 +26,7 @@ int TWI_Init(void)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TWI_Start(char addr, char mode)
|
||||
int TWI_Start(unsigned char addr, unsigned char mode)
|
||||
{
|
||||
unsigned int status;
|
||||
|
||||
@@ -60,7 +63,7 @@ int TWI_Start(char addr, char mode)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int TWI_Write(char data)
|
||||
int TWI_Write(unsigned char data)
|
||||
{
|
||||
TWDR = data;
|
||||
TWCR = (1 << TWEN) // Enable TWI
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#define MAD_CORE_BUS_TWI_H
|
||||
|
||||
int TWI_Init(void);
|
||||
int TWI_Start(char addr, char mode);
|
||||
int TWI_Write(char data);
|
||||
int TWI_Start(unsigned char addr, unsigned char mode);
|
||||
int TWI_Write(unsigned char data);
|
||||
int TWI_Wait_ACK(void);
|
||||
int TWI_Stop(void);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user