RRH46410 Firmware Documentation
template.c File Reference

This file serves as a template for a customer specific HAL. More...

Functions

static void _Sleep (uint32_t ms)
 
static int _I2CRead (void *handle, uint8_t slAddr, uint8_t *wrData, int wrLen, uint8_t *rdData, int rdLen)
 
static int _I2CWrite (void *handle, uint8_t slAddr, uint8_t *wrData1, int wrLen1, uint8_t *wrData2, int wrLen2)
 
static int _Reset ()
 
int HAL_Init (Interface_t *hal)
 Initialize hardware and populate Interface_t object. More...
 
int HAL_Deinit (Interface_t *hal)
 Cleanup before program exit. More...
 
void HAL_HandleError (int errorCode, void const *context)
 Error handling function. More...
 

Function Documentation

◆ _I2CRead()

static int _I2CRead ( void *  handle,
uint8_t  slAddr,
uint8_t *  wrData,
int  wrLen,
uint8_t *  rdData,
int  rdLen 
)
static

The implementation of this function shall read data from I2C, strictly following the procedure below. If wrLen is not zero, the read must be preceded by an I2C write.

  • I2C Start
  • if wrLen != 0:
    • Send: slAddr + WRITE
    • Send: wrLen bytes from wrData
    • I2C Restart ( no stop before this start condition! )
  • Send: SlaveAddres + READ
  • Receive: rdLen bytes into rdData
  • I2CStop

◆ _I2CWrite()

static int _I2CWrite ( void *  handle,
uint8_t  slAddr,
uint8_t *  wrData1,
int  wrLen1,
uint8_t *  wrData2,
int  wrLen2 
)
static

The implementation of this function shall send the data provided in arguments wrData1 and wrData2 over the I2C bus. Both data blocks shall be sent directly after each other without a new start/restart condition.

  • I2C Start
  • Send: slAddr + WRITE
  • if wrLen1 != 0:
    • Send: wrLen1 bytes from wrData1
  • if wrLen2 != 0;
    • Send: wrLen2 bytes from wrData2
  • I2CStop

◆ _Reset()

static int _Reset ( )
static

This function shall pulse the reset pin of the RRH46410.

Note
Refer to the datasheet of the sensor(s) being interfaced for reset timing requirements.

◆ _Sleep()

static void _Sleep ( uint32_t  ms)
static

This function should do nothing but returning after the number of milliseconds passed in the 'ms' argument.