MAV'RIC
Classes | Public Member Functions
I2c_chibios Class Reference

I2C peripheral driver using ChibiOS/HAL. More...

#include <i2c_chibios.hpp>

Inheritance diagram for I2c_chibios:
Inheritance graph
[legend]
Collaboration diagram for I2c_chibios:
Collaboration graph
[legend]

List of all members.

Classes

struct  conf_t
 Configuration structure. More...

Public Member Functions

 I2c_chibios (conf_t config)
 Constructor.
bool init (void)
 Hardware initialization.
bool probe (uint32_t address)
 Test if a chip answers for a given I2C address.
bool write (const uint8_t *buffer, uint32_t nbytes, uint32_t address)
 Write multiple bytes to a I2C slave device.
bool read (uint8_t *buffer, uint32_t nbytes, uint32_t address)
 Read multiple bytes to a I2C slave device.
bool transfer (uint8_t *out_buffer, uint32_t ntxbytes, uint8_t *in_buffer, uint32_t nrxbytes, uint32_t address)
 Write then Read data to/from an I2C device.

Detailed Description

I2C peripheral driver using ChibiOS/HAL.


Constructor & Destructor Documentation

Constructor.

Parameters:
configDevice configuration

Member Function Documentation

bool I2c_chibios::init ( void  ) [virtual]

Hardware initialization.

Returns:
true Success
false Error

Implements I2c.

Here is the caller graph for this function:

bool I2c_chibios::probe ( uint32_t  address) [virtual]

Test if a chip answers for a given I2C address.

Parameters:
addressSlave adress
Returns:
True Slave found
False Slave not found

Implements I2c.

Here is the call graph for this function:

bool I2c_chibios::read ( uint8_t *  buffer,
uint32_t  nbytes,
uint32_t  address 
) [virtual]

Read multiple bytes to a I2C slave device.

Parameters:
bufferData buffer
nbytesNumber of bytes to read
addressSlave adress
Returns:
True Data successfully read
False Data not read

Implements I2c.

bool I2c_chibios::transfer ( uint8_t *  out_buffer,
uint32_t  ntxbytes,
uint8_t *  in_buffer,
uint32_t  nrxbytes,
uint32_t  address 
) [virtual]

Write then Read data to/from an I2C device.

Parameters:
out_bufferData buffer (output)
ntxbytesNumber of bytes to write
in_bufferData buffer (input)
nrxbytesNumber of bytes to read
Returns:
true Success
false Failed

Reimplemented from I2c.

bool I2c_chibios::write ( const uint8_t *  buffer,
uint32_t  nbytes,
uint32_t  address 
) [virtual]

Write multiple bytes to a I2C slave device.

Parameters:
bufferData buffer
nbytesNumber of bytes to write
addressSlave adress
Returns:
False Data not written

Implements I2c.

Here is the caller graph for this function:


The documentation for this class was generated from the following files:
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines