23 lines
369 B
C++
23 lines
369 B
C++
#ifndef TWI_H
|
|
#define TWI_H
|
|
|
|
#include <avr/io.h>
|
|
|
|
#define TWI_OK 0x00
|
|
namespace TWI {
|
|
typedef uint8_t BusState;
|
|
typedef uint8_t Address;
|
|
|
|
|
|
void init(uint32_t busSpeed);
|
|
void close();
|
|
BusState startMessage(Address addr);
|
|
BusState sendByte(uint8_t byte);
|
|
BusState ack();
|
|
uint8_t readByte();
|
|
BusState nack();
|
|
void wait();
|
|
}
|
|
|
|
|
|
#endif |