Buoyancy Firmware  1.0
Buoyancy Vehicle Firmware Documentation
TWI program file

Contain TWI/I^2C module with related structures and functions. More...

Macros

#define TMP117   (0x48)
 
#define ICM_MOTION   (0x68)
 
#define HALL_EFFECT   (0x30)
 
#define PIN_SCL   (27UL)
 
#define PIN_SDA   (26UL)
 

Functions

nrfx_twim_evt_handler_t twim_Handler (nrfx_twim_evt_t const *p_event, void *p_context)
 Handler function for Two Wire Interface Master module. More...
 
void TWIMInit (void)
 Initialization Two Wire Interface Master (TWIM) module. More...
 
void TWIMtx (uint8_t address, uint8_t data)
 
More...
 
void TWIMrx (uint8_t address, uint8_t *p_data)
 
More...
 
void TWIMtxrx (uint8_t address, uint8_t txMsg, uint8_t *p_rxMsg)
 
More...
 
void TWIMtxtx (uint8_t address, uint8_t data1, uint8_t data2)
 
More...
 
bool isTWIMbusy ()
 
More...
 

Variables

nrfx_twim_t m_twim = NRFX_TWIM_INSTANCE(0)
 
bool TMP117dataReady
 Flag to signal data from TMP117 temmperature sensor is ready to be read. More...
 
bool receiveTMP117
 Flag to signal waiting for data from TMP117 temmperature sensor is ready to be read. More...
 
uint8_t cnt = 0
 Counter variable to count the number of received bytes over TWIM. More...
 

Detailed Description

Contain TWI/I^2C module with related structures and functions.

Macro Definition Documentation

◆ HALL_EFFECT

#define HALL_EFFECT   (0x30)

◆ ICM_MOTION

#define ICM_MOTION   (0x68)

◆ PIN_SCL

#define PIN_SCL   (27UL)

◆ PIN_SDA

#define PIN_SDA   (26UL)

◆ TMP117

#define TMP117   (0x48)

Function Documentation

◆ isTWIMbusy()

bool isTWIMbusy ( void  )

Check if Two Wire Interface Master (TWIM) module is in a busy state.

The module is busy while transmission is ongoing.

Returns
bool true if busy, false if not busy

◆ twim_Handler()

nrfx_twim_evt_handler_t twim_Handler ( nrfx_twim_evt_t const *  p_event,
void *  p_context 
)

Handler function for Two Wire Interface Master module.

Parameters
[in]p_eventEvent type
[in]p_contextnot used

◆ TWIMInit()

void TWIMInit ( void  )

Initialization Two Wire Interface Master (TWIM) module.

◆ TWIMrx()

void TWIMrx ( uint8_t  ,
uint8_t  
)

receive one byte on Two Wire Interface Master (TWIM) module.

Parameters
[in]addressSensor/module address
[out]p_datapointer to where received data is stored

◆ TWIMtx()

void TWIMtx ( uint8_t  ,
uint8_t   
)

Transmit one byte on Two Wire Interface Master (TWIM) module.

Parameters
[in]addressSensor/module address
[in]datadata to be transmitted, register address or configuration data

◆ TWIMtxrx()

void TWIMtxrx ( uint8_t  ,
uint8_t  ,
uint8_t  
)

transmit byte, then receive byte on Two Wire Interface Master (TWIM) module.

Parameters
[in]addressSensor/module address
[in]txMsgdata byte to be sent to sensor/module, register address or configuration data
[out]p_rxMsgpointer to where received data is stored

◆ TWIMtxtx()

void TWIMtxtx ( uint8_t  ,
uint8_t  ,
uint8_t   
)

transmit two bytes on Two Wire Interface Master (TWIM) module.

Typically used when configuring/storing data on sensor/module

Parameters
[in]addressSensor/module address
[in]data1first byte to be sent to sensor/module, register address
[out]data2second byte to be sent to sensor/module, configuration data

Variable Documentation

◆ cnt

uint8_t cnt = 0

Counter variable to count the number of received bytes over TWIM.

◆ m_twim

nrfx_twim_t m_twim = NRFX_TWIM_INSTANCE(0)

◆ receiveTMP117

bool receiveTMP117

Flag to signal waiting for data from TMP117 temmperature sensor is ready to be read.

Flag to signal waiting for data from TMP117 temmperature sensor is ready to be read.

◆ TMP117dataReady

bool TMP117dataReady

Flag to signal data from TMP117 temmperature sensor is ready to be read.

Flag to signal data from TMP117 temmperature sensor is ready to be read.