IRPyro Micro controller template only
Routines to enable the MCU to use the USART and the I2C

Master to slave read and write functions. More...

Collaboration diagram for I2C Control Functions:

Functions

uint8_t i2c_Read (uint8_t DeviceAddr, uint8_t Command, uint8_t *pBuffer, uint16_t len)
 Reads data via I2C port. More...
 
uint8_t i2c_Write (uint8_t DeviceAddr, uint8_t Command, uint8_t *pBuffer, uint8_t len)
 Sends data via I2C port. More...
 

Detailed Description

Master to slave read and write functions.

*    The I2C implementation on the STM32F3 micro controllers
*    provides architecture independence to the IRPyro API
* 
Note
Modify accordingly depending on architecture

Function Documentation

uint8_t i2c_Read ( uint8_t  DeviceAddr,
uint8_t  Command,
uint8_t *  pBuffer,
uint16_t  len 
)

Reads data via I2C port.

Parameters
DeviceAddrSlave device address
CommandFirst byte to be sent
*pBufferPointer to receiving bytes array
lenNumber of bytes to be received
Return values
Pass/Fail
This function is used to receive an array of bytes over the I2C bus
*           of a given length. The function is responsible for setting up the
*           I2C transfer handling, i.e. calling the slave address and reading
*           the data if an ACK is received.
* 
Attention
Modify this function to implement an I2C read that is platform specific
Todo:
Use of GOTO on the I2C read and write functions in order to detect what causes the function to return. Needs to be addressed. Multiple returns reduce complexity but is difficult to trace. This functions could be re-factored since there are several waiting loops, required for the flags in use.

Definition at line 770 of file Micro_controller_template.c.

uint8_t i2c_Write ( uint8_t  DeviceAddr,
uint8_t  Command,
uint8_t *  pBuffer,
uint8_t  len 
)

Sends data via I2C port.

Parameters
[in]DeviceAddrSlave device address
[in]CommandFirst byte to be sent
[in,out]*pBufferRemaining data bytes to be sent
[in]lenNumber of bytes to be sent
Return values
Pass/Fail
*            This function sends an array of bytes over the I2C bus of a given
*            length. The function is responsible for setting up the I2C transfer
*            handling, i.e. calling the slave address and sending the data if an ACK is received.
* 
Attention
Modify this function to implement an I2C write that is platform specific
Todo:
Use of GOTO on the I2C read and write functions in order to detect what causes the function to return. Needs to be addressed. Multiple returns reduce complexity but is difficult to trace. This functions could be re-factored since there are several waiting loops, required for the flags in use

Definition at line 679 of file Micro_controller_template.c.