Driver API for DVRT (dvrt.h)
More...
Driver API for DVRT (dvrt.h)
Usage Example
The following example demonstrates typical usage of the DVRT peripheral:
#include "Driver_USART.h"
#if defined(ARM_USART_MODE_ASYNCHRONOUS)
static ARM_DRIVER_USART *dvrt_usart_drv;
void DVRT_Init(ARM_DRIVER_USART *usart_drv, uint32_t baud_rate)
{
dvrt_usart_drv = usart_drv;
dvrt_usart_drv->PowerControl(ARM_POWER_FULL);
dvrt_usart_drv->Control(
ARM_USART_MODE_ASYNCHRONOUS |
ARM_USART_DATA_BITS_8 |
ARM_USART_PARITY_NONE |
ARM_USART_STOP_BITS_1,
baud_rate);
dvrt_usart_drv->Control(ARM_USART_CONTROL_TX, 1);
dvrt_usart_drv->Control(ARM_USART_CONTROL_RX, 1);
}
#endif
Data Visualizer Run-Time (DVRT) Public Interface.
int32_t DVRT_USART_StartReceive(void)
Start continuous USART reception into the DVRT ring buffer.
void DVRT_USART_RxHandler(uint32_t event)
USART event callback for DVRT reception.
void DVRT_Initialize(void)
Initializes the DVRT middleware.
◆ DV_END_OF_FRAME
| #define DV_END_OF_FRAME 0xFCU |
End of frame marker for DVRT protocol.
◆ DV_FW_CODE
Firmware identification code for ping response.
◆ DV_RX_CMD_MIN_SIZE
| #define DV_RX_CMD_MIN_SIZE 3U |
Minimum size of a valid received command frame.
◆ DV_RX_CMD_TIMEOUT
| #define DV_RX_CMD_TIMEOUT 200U |
Timeout for receiving commands in milliseconds.
◆ DV_START_OF_FRAME
| #define DV_START_OF_FRAME 0x03U |
Start of frame marker for DVRT protocol.
◆ DV_STREAM_TIME
| #define DV_STREAM_TIME 20U |
Default streaming interval in milliseconds.
◆ DYNAMIC_VAR_PTR_COUNT
| #define DYNAMIC_VAR_PTR_COUNT 8U |
Maximum number of variable pointers that can be monitored.
◆ DVRT_error_t
DVRT error type definition.
◆ DVRT_TMR_PLIB_CALLBACK
| typedef void(* DVRT_TMR_PLIB_CALLBACK) (uint32_t status, uintptr_t context) |
Function pointer type for timer callback.
- Parameters
-
| status | - Timer status value. |
| context | - User-defined context pointer. |
◆ DVRT_TMR_PLIB_CALLBACK_REGISTER
Function pointer type for timer callback registration.
- Parameters
-
| callback | - Callback function to register. |
| context | - User-defined context pointer. |
◆ DVRT_TMR_PLIB_PERIOD_SET
| typedef void(* DVRT_TMR_PLIB_PERIOD_SET) (uint32_t period) |
Function pointer type for timer period setting.
- Parameters
-
| period | - Timer period value. |
◆ DVRT_TMR_PLIB_START
| typedef void(* DVRT_TMR_PLIB_START) (void) |
Function pointer type for timer start operation.
◆ DVRT_TMR_PLIB_STOP
| typedef void(* DVRT_TMR_PLIB_STOP) (void) |
Function pointer type for timer stop operation.
◆ DVRT_USART_CALLBACK
| typedef void(* DVRT_USART_CALLBACK) (uint32_t event) |
Function pointer type for USART callback.
- Parameters
-
| event | - USART event identifier. |
◆ DVRT_commands
DVRT command identifiers.
This enumeration defines the command codes used in the DVRT protocol for communication between the target device and Data Visualizer.
| Enumerator |
|---|
| UPDATE_VARIABLE_POINTER_TABLE | |
| UPDATE_VARIABLE_VALUE | |
| UPDATE_STREAMING_TICK | |
| TURN_STREAMING_OFF | |
| TURN_STREAMING_ON | |
| ONE_SHOT_READ | |
| PING | |
◆ __attribute__()
| struct __attribute__ |
( |
(packed) | | ) |
|
Variable pointer table entry structure.
Variable update message structure.
This structure defines an entry in the variable pointer table, containing the size and address of a monitored variable.
This structure defines the format of a variable update message for modifying variable values.
◆ DVRT_HandleCommand()
| void DVRT_HandleCommand |
( |
void | | ) |
|
Handles received DVRT commands.
- Parameters
-
- Returns
- None.
- Note
- This function parses and executes commands received from Data Visualizer.
◆ DVRT_Initialize()
| void DVRT_Initialize |
( |
void | | ) |
|
Initializes the DVRT middleware.
- Parameters
-
- Returns
- None.
- Note
- This function must be called before using any other DVRT functions. It initializes the variable pointer table and sets default streaming parameters.
◆ DVRT_Process()
| void DVRT_Process |
( |
void | | ) |
|
Main DVRT processing function.
- Parameters
-
- Returns
- None.
- Note
- Call this periodically (every 1 ms recommended) from your main loop or SysTick handler to process commands and send streaming data.
◆ DVRT_USART_RxHandler()
| void DVRT_USART_RxHandler |
( |
uint32_t | event | ) |
|
USART event callback for DVRT reception.
- Parameters
-
| event | - USART event flags from CMSIS-Driver. |
- Note
- Pass this callback to the CMSIS USART Initialize() function:
ARM_DRIVER_USART Driver_USART1
External declaration for CMSIS USART driver instance 1.
◆ DVRT_USART_StartReceive()
| int32_t DVRT_USART_StartReceive |
( |
void | | ) |
|
Start continuous USART reception into the DVRT ring buffer.
- Returns
- ARM_DRIVER_OK on success, or error code.
- Note
- Call this after USART is initialized and configured, before entering the main loop.
◆ DVRT_WritePacket()
| size_t DVRT_WritePacket |
( |
void | | ) |
|
Writes a data packet to the USART.
- Parameters
-
- Returns
- Number of bytes written.
- Note
- This function constructs and sends a streaming data packet containing the current values of all monitored variables.
◆ usart_rx_available()
| uint32_t usart_rx_available |
( |
void | | ) |
|
Gets the number of bytes available in the receive buffer.
- Returns
- Number of bytes available to read.
◆ usart_rx_get()
| bool usart_rx_get |
( |
uint8_t * | byte | ) |
|
Gets a single byte from the receive buffer.
- Parameters
-
| byte | - Pointer to store the received byte. |
- Returns
- true if a byte was successfully retrieved, false otherwise.
◆ address
| uint8_t* DVPMT_t::address |
◆ command [1/3]
| uint8_t DVRT_StreamUpdates_t::command |
◆ command [2/3]
| uint8_t DVRT_StreamIntervalUpdate_t::command |
◆ command [3/3]
| uint8_t DVRT_CommandTemplate_t::command |
◆ data
| uint8_t DVRT_CommandTemplate_t::data |
◆ Driver_USART1
| ARM_DRIVER_USART Driver_USART1 |
|
extern |
External declaration for CMSIS USART driver instance 1.
- Note
- This driver is defined in the CMSIS-Driver pack and provides the USART communication interface used by the DVRT middleware.
◆ DVPMT
◆ dvrt_TMRPlibAPI
◆ dvrt_USART_API
| ARM_DRIVER_USART* const dvrt_USART_API |
|
extern |
External CMSIS USART driver API pointer.
◆ dvrt_USARTPlibAPI
External USART peripheral library API instance.
◆ DVRT_VariablePointerTableEntry_t
| DVRT_VariablePointerTableEntry_t |
◆ DVRT_VariableUpdate_t
◆ endOfFrame [1/3]
| uint8_t DVRT_StreamUpdates_t::endOfFrame |
◆ endOfFrame [2/3]
| uint8_t DVRT_StreamIntervalUpdate_t::endOfFrame |
◆ endOfFrame [3/3]
| uint8_t DVRT_CommandTemplate_t::endOfFrame |
◆ errorGet
| uint32_t(* DVRT_USART_INTERFACE::errorGet) (void) |
◆ period
| uint16_t DVRT_StreamIntervalUpdate_t::period |
◆ read_t
| size_t(* DVRT_USART_INTERFACE::read_t) (void *buffer, size_t size) |
◆ readCallbackRegister
| void(* DVRT_USART_INTERFACE::readCallbackRegister) (DVRT_USART_CALLBACK callback, uintptr_t context) |
◆ readCountGet
| size_t(* DVRT_USART_INTERFACE::readCountGet) (void) |
◆ readNotificationEnable
| void(* DVRT_USART_INTERFACE::readNotificationEnable) (bool isEnabled, bool isPersistent) |
◆ readThresholdSet
| void(* DVRT_USART_INTERFACE::readThresholdSet) (uint32_t nBytesThreshold) |
◆ size [1/2]
| uint8_t DVRT_StreamUpdates_t::size |
◆ size [2/2]
◆ startOfFrame [1/3]
| uint8_t DVRT_StreamUpdates_t::startOfFrame |
◆ startOfFrame [2/3]
| uint8_t DVRT_StreamIntervalUpdate_t::startOfFrame |
◆ startOfFrame [3/3]
| uint8_t DVRT_CommandTemplate_t::startOfFrame |
◆ timerCallbackRegister
◆ timerPeriodSet
◆ timerStart
◆ timerStop
◆ write_t
| size_t(* DVRT_USART_INTERFACE::write_t) (const void *buffer, size_t size) |