twi_avr.h File Reference

Driver for the AVR ATMega TWI (interface). More...

#include <cfg/compiler.h>

Go to the source code of this file.


Functions

bool twi_start_w (uint8_t id)
 Send START condition and select slave for write.
bool twi_start_r (uint8_t id)
 Send START condition and select slave for read.
void twi_stop (void)
 Send STOP condition.
bool twi_put (const uint8_t data)
 Put a single byte in master transmitter mode to the selected slave device through the TWI bus.
bool twi_send (const void *_buf, size_t count)
 Send a sequence of bytes in master transmitter mode to the selected slave device through the TWI bus.
bool twi_recv (void *_buf, size_t count)
 Receive a sequence of one or more bytes from the selected slave device in master receive mode through the TWI bus.
void twi_init (void)
 Init the (broken) sam7 twi driver.

Detailed Description

Driver for the AVR ATMega TWI (interface).

Version:
Id
twi_avr.h 872 2007-10-11 16:11:45Z batt

Author:
Stefano Fedrigo <aleph@develer.com>

Bernardo Innocenti <bernie@develer.com>

Definition in file twi_avr.h.


Function Documentation

bool twi_put ( const uint8_t  data  ) 

Put a single byte in master transmitter mode to the selected slave device through the TWI bus.

Returns:
true on success, false on error.

Definition at line 151 of file twi_avr.c.

bool twi_recv ( void *  _buf,
size_t  count 
)

Receive a sequence of one or more bytes from the selected slave device in master receive mode through the TWI bus.

Received data is placed in buf.

Returns:
true on success, false on error

Definition at line 193 of file twi_avr.c.

bool twi_send ( const void *  _buf,
size_t  count 
)

Send a sequence of bytes in master transmitter mode to the selected slave device through the TWI bus.

Returns:
true on success, false on error.

Definition at line 171 of file twi_avr.c.

bool twi_start_r ( uint8_t  id  ) 

Send START condition and select slave for read.

id is the device id comprehensive of address left shifted by 1. The LSB of id is ignored and set to 1 for read operation.

Returns:
true on success, false otherwise.

Definition at line 118 of file twi_avr.c.

bool twi_start_w ( uint8_t  id  ) 

Send START condition and select slave for write.

id is the device id comprehensive of address left shifted by 1. The LSB of id is ignored and reset to 0 for write operation.

Returns:
true on success, false otherwise.

Definition at line 84 of file twi_avr.c.