i2c_avr.c File Reference
Driver for the AVR ATMega TWI (implementation).
More...
#include <hw/hw_cpufreq.h>
#include "cfg/cfg_i2c.h"
#include <cfg/log.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
#include <cfg/module.h>
#include <cpu/detect.h>
#include <cpu/irq.h>
#include <drv/timer.h>
#include <drv/i2c.h>
#include <compat/twi.h>
Go to the source code of this file.
Functions |
| static bool | i2c_builtin_start (void) |
| | Send START condition on the bus.
|
| bool | i2c_builtin_start_w (uint8_t id) |
| | Send START condition and select slave for write.
|
| bool | i2c_builtin_start_r (uint8_t id) |
| | Send START condition and select slave for read.
|
|
void | i2c_builtin_stop (void) |
| | Send STOP condition.
|
| bool | i2c_builtin_put (const uint8_t data) |
| | Put a single byte in master transmitter mode to the selected slave device through the TWI bus.
|
| int | i2c_builtin_get (bool ack) |
| | Get 1 byte from slave in master transmitter mode to the selected slave device through the TWI bus.
|
| void | i2c_builtin_init (void) |
| | Initialize TWI module.
|
Detailed Description
Driver for the AVR ATMega TWI (implementation).
- Version:
- Id
- i2c_avr.c 2506 2009-04-15 08:29:07Z duplo
- Author:
- Stefano Fedrigo <aleph@develer.com>
-
Bernie Innocenti <bernie@codewiz.org>
Definition in file i2c_avr.c.
Function Documentation
| int i2c_builtin_get |
( |
bool |
ack |
) |
|
Get 1 byte from slave in master transmitter mode to the selected slave device through the TWI bus.
If ack is true issue a ACK after getting the byte, otherwise a NACK is issued.
- Returns:
- the byte read if ok, EOF on errors.
Definition at line 184 of file i2c_avr.c.
| void i2c_builtin_init |
( |
void |
|
) |
|
Initialize TWI module.
I2c builtin prototypes.
Definition at line 215 of file i2c_avr.c.
| bool i2c_builtin_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 163 of file i2c_avr.c.
| static bool i2c_builtin_start |
( |
void |
|
) |
[static] |
Send START condition on the bus.
- Returns:
- true on success, false otherwise.
Definition at line 70 of file i2c_avr.c.
| bool i2c_builtin_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 130 of file i2c_avr.c.
| bool i2c_builtin_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 90 of file i2c_avr.c.