twi_avr.c File Reference
Driver for the AVR ATMega TWI (implementation).
More...
#include "twi_avr.h"
#include <cfg/debug.h>
#include <cpu/detect.h>
#include <cpu/irq.h>
#include <cfg/macros.h>
#include <hw_cpu.h>
#include <appconfig.h>
#include <compat/twi.h>
Go to the source code of this file.
|
Functions |
| static bool | twi_start (void) |
| | Send START condition on the bus.
|
| 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) |
| | Initialize TWI module.
|
Detailed Description
Driver for the AVR ATMega TWI (implementation).
- Version:
- Id
- twi_avr.c 1228 2008-04-09 15:11:20Z batt
- Author:
- Stefano Fedrigo <aleph@develer.com>
Bernardo Innocenti <bernie@develer.com>
Definition in file twi_avr.c.
Function Documentation
Initialize TWI module.
Init the (broken) sam7 twi driver.
Definition at line 232 of file twi_avr.c.
| 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.
| static bool twi_start |
( |
void |
|
) |
[static] |
Send START condition on the bus.
- Returns:
- true on success, false otherwise.
Definition at line 64 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.