|
Zephyr Project API 4.2.99
A Scalable Open Source RTOS
|
Interfaces for Peripheral Sensor Interface (PSI5). More...
Data Structures | |
| struct | psi5_frame |
| PSI5 frame structure. More... | |
Typedefs | |
| typedef void(* | psi5_tx_callback_t) (const struct device *dev, uint8_t channel, int status, void *user_data) |
| Defines the application callback handler function signature for sending. | |
| typedef void(* | psi5_rx_frame_callback_t) (const struct device *dev, uint8_t channel, uint32_t num_frame, void *user_data) |
| Defines the application callback handler function signature for receiving frame. | |
Enumerations | |
| enum | psi5_frame_type { PSI5_SERIAL_FRAME_4_BIT_ID , PSI5_SERIAL_FRAME_8_BIT_ID , PSI5_DATA_FRAME } |
| PSI5 frame type. More... | |
Functions | |
| int | psi5_start_sync (const struct device *dev, uint8_t channel) |
| Start the sync pulse generator on a specific channel. | |
| int | psi5_stop_sync (const struct device *dev, uint8_t channel) |
| Stop the sync pulse generator on a specific channel. | |
| int | psi5_send (const struct device *dev, uint8_t channel, const uint64_t data, k_timeout_t timeout, psi5_tx_callback_t callback, void *user_data) |
| Transmitting PSI5 data on a specific channel. | |
| int | psi5_register_callback (const struct device *dev, uint8_t channel, struct psi5_rx_callback_configs callback_configs) |
| Add a callback function to handle messages received for a specific channel. | |
Interfaces for Peripheral Sensor Interface (PSI5).
| typedef void(* psi5_rx_frame_callback_t) (const struct device *dev, uint8_t channel, uint32_t num_frame, void *user_data) |
#include <include/zephyr/drivers/psi5/psi5.h>
Defines the application callback handler function signature for receiving frame.
| dev | Pointer to the device structure for the driver instance. |
| channel | The hardware channel of the driver instance. |
| num_frame | Number of received frame. |
| user_data | User data provided when receiving frame. |
| typedef void(* psi5_tx_callback_t) (const struct device *dev, uint8_t channel, int status, void *user_data) |
#include <include/zephyr/drivers/psi5/psi5.h>
Defines the application callback handler function signature for sending.
| dev | Pointer to the device structure for the driver instance. |
| channel | The hardware channel of the driver instance. |
| status | PSI5 status (0: transmission completed successfully, -EIO: transmission error occurred). |
| user_data | User data provided when the frame was sent. |
| enum psi5_frame_type |
#include <include/zephyr/drivers/psi5/psi5.h>
PSI5 frame type.
| Enumerator | |
|---|---|
| PSI5_SERIAL_FRAME_4_BIT_ID | Serial message frame with 4-bit message ID. |
| PSI5_SERIAL_FRAME_8_BIT_ID | Serial message frame with 8-bit message ID. |
| PSI5_DATA_FRAME | Data frame. |
| int psi5_register_callback | ( | const struct device * | dev, |
| uint8_t | channel, | ||
| struct psi5_rx_callback_configs | callback_configs | ||
| ) |
#include <include/zephyr/drivers/psi5/psi5.h>
Add a callback function to handle messages received for a specific channel.
The callback must be registered before the sync pulse generator started when the channel is configured to synchronous mode.
| dev | Pointer to the device structure for the driver instance. |
| channel | The hardware channel of the driver instance. |
| callback_configs | The callback configurations. |
| 0 | successful. |
| -EINVAL | invalid channel. |
| int psi5_send | ( | const struct device * | dev, |
| uint8_t | channel, | ||
| const uint64_t | data, | ||
| k_timeout_t | timeout, | ||
| psi5_tx_callback_t | callback, | ||
| void * | user_data | ||
| ) |
#include <include/zephyr/drivers/psi5/psi5.h>
Transmitting PSI5 data on a specific channel.
The channel must be configured to synchronous mode and can only begin transmission after the sync pulse generator has started.
| dev | Pointer to the device structure for the driver instance. |
| channel | The hardware channel of the driver instance. |
| data | PSI5 data to transmit. |
| timeout | Timeout waiting for ready to transmit new data. |
| callback | Optional callback for when the frame was sent or a transmission error occurred. If NULL, this function is blocking until frame is sent. |
| user_data | User data to pass to callback function. |
| 0 | successful. |
| -EINVAL | invalid channel. |
| -ENOTSUP | unsupported parameter was passed to the function. |
| -ENETDOWN | stopped state. |
| -EIO | general transmit error occurred. |
| -EAGAIN | timeout. |
#include <include/zephyr/drivers/psi5/psi5.h>
Start the sync pulse generator on a specific channel.
| dev | Pointer to the device structure for the driver instance. |
| channel | The hardware channel of the driver instance. |
| 0 | successful. |
| -EINVAL | invalid channel. |
| -EALREADY | device is already started. |
| -EIO | general input/output error, failed to start device. |
#include <include/zephyr/drivers/psi5/psi5.h>
Stop the sync pulse generator on a specific channel.
| dev | Pointer to the device structure for the driver instance. |
| channel | The hardware channel of the driver instance. |
| 0 | successful. |
| -EINVAL | invalid channel. |
| -EALREADY | device is already started. |
| -EIO | general input/output error, failed to stop device. |