|
Cascoda SDK
Cascoda SDK for building software to run with CA-821x transceivers
|
Sensor/Actuator I2C & SPI interface functions, used by Baremetal Sensor/Actuator interface. More...

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... | |
Sensor/Actuator I2C & SPI interface functions, used by Baremetal Sensor/Actuator interface.
| #define SENSORIF_I2C_CLK_FREQUENCY 100000 /* I2C SCL frequency [Hz], 100kHz (full-speed) */ |
| #define SENSORIF_I2C_TIMEOUT 100 /* I2C bus access time-out time in [ms] */ |
| #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 |
| enum PWM_type_t |
| enum sensorif_i2c_status |
I2C master status enumerations.
| void SENSORIF_I2C_Config | ( | u32_t | portnum | ) |
Set I2C Configuration.
| portnum | - I2C port number |
| void SENSORIF_I2C_Deinit | ( | void | ) |
Disables I2C interface.
| void SENSORIF_I2C_Init | ( | void | ) |
Initialises and enables I2C interface.
| enum sensorif_i2c_status SENSORIF_I2C_Read | ( | u8_t | slaveaddr, |
| u8_t * | pdata, | ||
| u32_t * | plen | ||
| ) |
Reads bytes from I2C slave.
| slaveaddr | - 6-Bit Slave Address |
| pdata | - Pointer to Data Buffer |
| plen | - Pointer to Buffer Length (actual length is returned in plen) |
| enum sensorif_i2c_status SENSORIF_I2C_Write | ( | u8_t | slaveaddr, |
| u8_t * | data, | ||
| u32_t * | len | ||
| ) |
Writes bytes to I2C slave.
| slaveaddr | - 6-Bit Slave Address |
| data | - Pointer to Data Buffer |
| len | - Pointer to Buffer Length (actual length is returned in plen) |
| void SENSORIF_PWM_Deinit | ( | void | ) |
Deinitialises and disables PWM.
Initialises and enables PWM for the specified frequency and duty cycle.
Note: After initialisation, change the duty cycle by calling SENSORIF_PWM_SetDutyCycle(). To change the frequency, deinitialise the PWM with SENSORIF_PWM_Deinit(), then call this function again with the required frequency.
| pin | - Number of the pin (e.g. 31) which the PWM will drive |
| u32Frequency | - Frequency of the PWM output waveform |
| u32DutyCycle | - Duty cycle as a percentage (number between 0 and 100) |
| CA_ERROR_SUCCESS | - Initialisation succeeded |
| CA_ERROR_INVALID_ARGS | - Pin doesn't support PWM |
| CA_ERROR_ALREADY | - PWM already initialised. Call Deinit() first before reinitialising. |
| void SENSORIF_PWM_SetDutyCycle | ( | u32_t | u32DutyCycle | ) |
Changes the duty cycle of the PWM.
| u32DutyCycle | - PWM Duty Cycle as a percentage (number between 0 and 100) |
| void SENSORIF_SPI_Config | ( | u32_t | portnum | ) |
Set SPI Configuration.
| portnum | - SPI port number |
| void SENSORIF_SPI_Deinit | ( | void | ) |
Disables SPI interface.
Read data in the RX while sending IDLE data to TX.
This is intended for receive-only transmission from the slave.
| RxBuf | - read data buffer |
| RxLen | - the data length |
| void SENSORIF_SPI_Init | ( | bool | is_eink_display_present | ) |
Initialises and enables SPI interface.
| is_eink_display_present | whether the SPI interface is used for communicating with a eink display. This configures it to half-duplex mode (MOSI only) and frees up PB5, which is usually used as an interrupt pin for the display. |
Writes bytes to SPI slave.
| out_data | - 8-bit data to send |
Exchange bytes between SPI slave and master.
*** Not being tested yet ***
| RxBuf | - read data buffer |
| TxBuf | - write data buffer |
| RxLen | - read data length |
| TxLen | - write data length This function exchange data between SPI slave and master. It is able to transmit data and receive data. |
| void SENSORIF_UART_Config | ( | u32_t | portnum | ) |
Set UART Configuration.
| portnum | - UART port number |
| void SENSORIF_UART_Deinit | ( | void | ) |
Disables UART interface.
| void SENSORIF_UART_Init | ( | void | ) |
Initialises and enables UART interface.
Read bytes to UART slave.
| in_data | - 8-bit data to read |
| readbytes | - number of bytes to read |