Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
cascoda_sensorif.h File Reference

Declarations of I2C and SPI interface functions for sensorif. More...

Include dependency graph for cascoda_sensorif.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define SENSORIF_I2C_TIMEOUT   100 /* I2C bus access time-out time in [ms] */
 
#define SENSORIF_I2C_CLK_FREQUENCY   100000 /* I2C SCL frequency [Hz], 100kHz (full-speed) */
 
#define SENSORIF_INT_PULLUPS   0 /* I2C use internal pull-ups flag */
 
#define SENSORIF_SPI_CLK_FREQUENCY   4000000 /* SPI CLK frequency [Hz], 4MHz (max frequency for E-paper display) */
 
#define SENSORIF_SPI_DATA_WIDTH   8
 
#define UART_SENSORIF_BAUDRATE   115200
 

Enumerations

enum  sensorif_i2c_status {
  SENSORIF_I2C_ST_START = 0x08 , SENSORIF_I2C_ST_RSTART = 0x10 , SENSORIF_I2C_ST_TX_AD_ACK = 0x18 , SENSORIF_I2C_ST_TX_AD_NACK = 0x20 ,
  SENSORIF_I2C_ST_TX_DT_ACK = 0x28 , SENSORIF_I2C_ST_TX_DT_NACK = 0x30 , SENSORIF_I2C_ST_ARB_LOST = 0x38 , SENSORIF_I2C_ST_RX_AD_ACK = 0x40 ,
  SENSORIF_I2C_ST_RX_AD_NACK = 0x48 , SENSORIF_I2C_ST_RX_DT_ACK = 0x50 , SENSORIF_I2C_ST_RX_DT_NACK = 0x58 , SENSORIF_I2C_ST_BUS_ERROR_RAW = 0x00 ,
  SENSORIF_I2C_ST_STOP = 0xF0 , SENSORIF_I2C_ST_RELEASED = 0xF8 , SENSORIF_I2C_ST_NOT_IMPLEMENTED = 0xFE , SENSORIF_I2C_ST_SUCCESS = 0x00 ,
  SENSORIF_I2C_ST_TIMEOUT = 0xFF , SENSORIF_I2C_ST_BUS_ERROR = 0xF1
}
 I2C master status enumerations. More...
 
enum  PWM_type_t { NOT_INITIALISED = 0 , USING_BPWM = 1 , USING_EPWM = 2 }
 

Functions

void SENSORIF_I2C_Init (void)
 Initialises and enables I2C interface. More...
 
void SENSORIF_I2C_Deinit (void)
 Disables I2C interface. More...
 
enum sensorif_i2c_status SENSORIF_I2C_Write (u8_t slaveaddr, u8_t *data, u32_t *len)
 Writes bytes to I2C slave. More...
 
enum sensorif_i2c_status SENSORIF_I2C_Read (u8_t slaveaddr, u8_t *pdata, u32_t *plen)
 Reads bytes from I2C slave. More...
 
void SENSORIF_SPI_Init (bool is_eink_display_present)
 Initialises and enables SPI interface. More...
 
void SENSORIF_SPI_Deinit (void)
 Disables SPI interface. More...
 
ca_error SENSORIF_SPI_Write (u8_t out_data)
 Writes bytes to SPI slave. More...
 
void SENSORIF_SPI_FULL_DUPLEX_RXONLY (u8_t *RxBuf, u8_t RxLen)
 Read data in the RX while sending IDLE data to TX. More...
 
void SENSORIF_SPI_WRITE_THEN_READ (u8_t *RxBuf, u8_t *TxBuf, u8_t RxLen, u8_t TxLen)
 Exchange bytes between SPI slave and master. More...
 
void SENSORIF_UART_Init (void)
 Initialises and enables UART interface. More...
 
void SENSORIF_UART_Deinit (void)
 Disables UART interface. More...
 
u32_t SENSORIF_UART_Write (u8_t *out_data, u32_t writebytes)
 Writes bytes to UART slave. More...
 
u32_t SENSORIF_UART_Read (u8_t *in_data, u32_t readbytes)
 Read bytes to UART slave. More...
 
void SENSORIF_I2C_Config (u32_t portnum)
 Set I2C Configuration. More...
 
void SENSORIF_SPI_Config (u32_t portnum)
 Set SPI Configuration. More...
 
void SENSORIF_UART_Config (u32_t portnum)
 Set UART Configuration. More...
 
ca_error SENSORIF_PWM_Init (u8_t pin, u32_t u32Frequency, u32_t u32DutyCycle)
 Initialises and enables PWM for the specified frequency and duty cycle. More...
 
void SENSORIF_PWM_Deinit (void)
 Deinitialises and disables PWM. More...
 
void SENSORIF_PWM_SetDutyCycle (u32_t u32DutyCycle)
 Changes the duty cycle of the PWM. More...
 

Detailed Description

Declarations of I2C and SPI interface functions for sensorif.