Contiki-NG

Implementation file of the I2C Control module. More...

#include "i2c.h"
#include <stdint.h>
#include "clock.h"
#include "sys-ctrl.h"

Go to the source code of this file.

Functions

I2C Functions
void i2c_init (uint8_t port_sda, uint8_t pin_sda, uint8_t port_scl, uint8_t pin_scl, uint32_t bus_speed)
 Initialize the I2C peripheral and pins. More...
 
void i2c_master_enable (void)
 Enable master I2C module.
 
void i2c_master_disable (void)
 Disable master I2C module.
 
void i2c_set_frequency (uint32_t freq)
 Initialize I2C peripheral clock with given frequency. More...
 
void i2c_master_set_slave_address (uint8_t slave_addr, uint8_t access_mode)
 Set the address of slave and access mode for the next I2C communication. More...
 
void i2c_master_data_put (uint8_t data)
 Prepare data to be transmitted. More...
 
uint8_t i2c_master_data_get (void)
 Return received data from I2C. More...
 
void i2c_master_command (uint8_t cmd)
 Control the state of the master module for send and receive operations. More...
 
uint8_t i2c_master_busy (void)
 Return the busy state of I2C module. More...
 
uint8_t i2c_master_error (void)
 Return the status register if error occurred during last communication. More...
 
uint8_t i2c_single_send (uint8_t slave_addr, uint8_t data)
 Perform all operations to send a byte to a slave. More...
 
uint8_t i2c_single_receive (uint8_t slave_addr, uint8_t *data)
 Perform all operations to receive a byte from a slave. More...
 
uint8_t i2c_burst_send (uint8_t slave_addr, uint8_t *data, uint8_t len)
 Perform all operations to send multiple bytes to a slave. More...
 
uint8_t i2c_burst_receive (uint8_t slave_addr, uint8_t *data, uint8_t len)
 Perform all operations to receive multiple bytes from a slave. More...
 

Detailed Description

Implementation file of the I2C Control module.

Author
Mehdi Migault

Definition in file i2c.c.