XENSIV PAS CO2 Sensor platform functions.
To adapt the driver to your platform you need to provide an implementation for the functions declared in this file. See example implementation in xensiv_pasco2_mtb.c using the PSoC6 HAL.
|
int32_t | xensiv_pasco2_plat_i2c_transfer (void *ctx, uint16_t dev_addr, const uint8_t *tx_buffer, size_t tx_len, uint8_t *rx_buffer, size_t rx_len) |
| Target platform-specific function to perform I2C write/read transfer. More...
|
|
int32_t | xensiv_pasco2_plat_uart_read (void *ctx, uint8_t *data, size_t len) |
| Target platform-specific function to read over UART. More...
|
|
int32_t | xensiv_pasco2_plat_uart_write (void *ctx, uint8_t *data, size_t len) |
| Target platform-specific function to write over UART. More...
|
|
void | xensiv_pasco2_plat_delay (uint32_t ms) |
| Target platform-specific function that waits for a specified time period in milliseconds. More...
|
|
uint16_t | xensiv_pasco2_plat_htons (uint16_t x) |
| Target platform-specific function to reverse the byte order (16-bit) A sample implementation would look like. More...
|
|
void | xensiv_pasco2_plat_assert (int expr) |
| Target platform-specific function that implements a runtime assertion; used to verify the assumptions made by the program and take appropiate actions if assumption is false. More...
|
|
◆ xensiv_pasco2_plat_i2c_transfer()
int32_t xensiv_pasco2_plat_i2c_transfer |
( |
void * |
ctx, |
|
|
uint16_t |
dev_addr, |
|
|
const uint8_t * |
tx_buffer, |
|
|
size_t |
tx_len, |
|
|
uint8_t * |
rx_buffer, |
|
|
size_t |
rx_len |
|
) |
| |
Target platform-specific function to perform I2C write/read transfer.
Synchronously writes a block of data and optionally receive a block of data.
- Parameters
-
[in] | ctx | Target platform object |
[in] | dev_addr | device address (7-bit) |
[in] | tx_buffer | I2C send data |
[in] | tx_len | I2C send data size |
[in] | rx_buffer | I2C receive data |
- Note
- Can be NULL to indicate no read access.
- Parameters
-
[in] | rx_len | I2C receive data size |
- Returns
- XENSIV_PASCO2_OK if the I2C transfer was successful; an error indicating what went wrong otherwise
◆ xensiv_pasco2_plat_uart_read()
int32_t xensiv_pasco2_plat_uart_read |
( |
void * |
ctx, |
|
|
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
Target platform-specific function to read over UART.
- Parameters
-
[in] | ctx | UART object |
[out] | data | Receive buffer |
[in] | len | Number of bytes to receive |
- Returns
- XENSIV_PASCO2_OK if the UART read was successful; an error indicating what went wrong otherwise
◆ xensiv_pasco2_plat_uart_write()
int32_t xensiv_pasco2_plat_uart_write |
( |
void * |
ctx, |
|
|
uint8_t * |
data, |
|
|
size_t |
len |
|
) |
| |
Target platform-specific function to write over UART.
- Parameters
-
[in] | ctx | UART object |
[in] | data | Transmit buffer |
[in] | len | Number of bytes to transmit |
- Returns
- XENSIV_PASCO2_OK if the UART write was successful; an error indicating what went wrong otherwise
◆ xensiv_pasco2_plat_delay()
void xensiv_pasco2_plat_delay |
( |
uint32_t |
ms | ) |
|
Target platform-specific function that waits for a specified time period in milliseconds.
- Parameters
-
[in] | ms | Number of miliseconds to wait for |
◆ xensiv_pasco2_plat_htons()
uint16_t xensiv_pasco2_plat_htons |
( |
uint16_t |
x | ) |
|
Target platform-specific function to reverse the byte order (16-bit) A sample implementation would look like.
return ((uint16_t)(((x & 0x00ffU) << 8) |
((x & 0xff00U) >> 8)));
- Parameters
-
- Returns
- Reversed value
◆ xensiv_pasco2_plat_assert()
void xensiv_pasco2_plat_assert |
( |
int |
expr | ) |
|
Target platform-specific function that implements a runtime assertion; used to verify the assumptions made by the program and take appropiate actions if assumption is false.
- Parameters
-
[in] | expr | Expression to be verified |