### Get Example Information
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_package_pg.html
Retrieves information about an example, including its version.
```APIDOC
## GET /package/examples/example
### Description
Retrieves information about an example and its version.
### Method
GET
### Endpoint
/package/examples/example
### Parameters
#### Query Parameters
- **version** (string) - Required - The version attribute of the example.
### Response
#### Success Response (200)
- **example_info** (object) - Information about the example.
- **version** (string) - The version of the example.
#### Response Example
{
"example_info": {
"version": "1.0.0"
}
}
```
--------------------------------
### GET /package/examples/example
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
Retrieves details for a specific example project, including its folder location, associated board, and required components.
```APIDOC
## GET /package/examples/example
### Description
Provides the metadata required to access and load an example project. Includes paths, documentation references, and environment-specific project files.
### Method
GET
### Endpoint
/package/examples/example
### Parameters
#### Attributes
- **name** (string) - Required - Name of the example.
- **folder** (string) - Required - Relative path to the example base folder.
- **doc** (string) - Required - Document describing the example.
- **version** (string) - Optional - Version number of the example.
### Response
#### Success Response (200)
- **description** (string) - Brief purpose of the example.
- **board** (BoardReferenceType) - Targeted hardware board.
- **project** (ExampleProjectType) - Environment-specific project files.
- **attributes** (ExampleAttributesType) - Required components and keywords.
```
--------------------------------
### Ethernet MAC and PHY Driver Initialization Example (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__eth__interface__gr.html
This code snippet demonstrates the typical setup sequence for Ethernet MAC and PHY drivers. It shows how to declare and access the driver structures for both the MAC and PHY, which are usually used in combination. The example assumes that the Ethernet MAC driver provides a media interface to the Ethernet PHY.
```c
extern ARM_DRIVER_ETH_MAC Driver_ETH_MAC0;
extern ARM_DRIVER_ETH_PHY Driver_ETH_PHY0;
```
--------------------------------
### Example: Start Timer using CMSIS-RTOS
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__TimerMgmt.html
Provides an example of starting a periodic timer with a specified delay. It defines a timer callback function and then uses osTimerCreate and osTimerStart.
```c
#include "cmsis_os.h"
void Time_Callback (void const *arg) {
// arg contains &exec
// called every second after osTimerStart
}
osTimerDef(Timer, Time_Callback);
uint32_t exec;
void TimerStart_example (void) {
osTimerId id;
uint32_t timerDelay;
osStatus status;
// Create periodic timer
exec = 1;
id = osTimerCreate(osTimer(Timer), osTimerPeriodic, NULL);
timerDelay = 1000UL;
status = osTimerStart(id, timerDelay);
// ... further logic ...
}
```
--------------------------------
### Flash Driver Setup and Operation Example
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__flash__interface__gr.html
Demonstrates a standard workflow for initializing a flash driver, powering it on, performing a read operation, and shutting down. It includes a callback function to handle asynchronous events using CMSIS-RTOS2.
```C
#include "Driver_Flash.h"
#include "cmsis_os2.h"
extern ARM_DRIVER_FLASH Driver_Flash0;
static ARM_DRIVER_FLASH * flashDev = &Driver_Flash0;
osThreadId_t Flash_Thread_Id;
void Flash_Callback(uint32_t event) {
if (event & ARM_FLASH_EVENT_READY) {
osThreadFlagsSet(Flash_Thread_Id, 1U);
}
if (event & ARM_FLASH_EVENT_ERROR) {
__breakpoint(0);
}
}
void Flash_Thread (void *argument) {
const ARM_FLASH_CAPABILITIES capabilities = flashDev->GetCapabilities();
if (capabilities.event_ready) {
flashDev->Initialize (&Flash_Callback);
} else {
flashDev->Initialize (NULL);
}
flashDev->PowerControl (ARM_POWER_FULL);
uint8_t buf[256U];
flashDev->ReadData (0x1000U, buf, sizeof(buf)>>capabilities.data_width);
if (capabilities.event_ready) {
osThreadFlagsWait (1U, osFlagsWaitAny, 100U);
} else {
osDelay(100U);
}
flashDev->PowerControl (ARM_POWER_OFF);
flashDev->Uninitialize ();
}
```
--------------------------------
### Kernel Initialization and Start
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__KernelCtrl.html
Demonstrates how to initialize and start the RTOS kernel. The kernel must be initialized before it can be started, and at least one thread should be created prior to starting.
```APIDOC
## Kernel Initialization and Start
### Description
Initializes the RTOS kernel if it is inactive and then starts thread execution. This process involves checking the kernel state, initializing it if necessary, and then starting the scheduler. Ensure at least one thread is created before calling `osKernelStart`.
### Method
- `osKernelInitialize()`: Initializes the RTOS kernel.
- `osKernelStart()`: Starts the RTOS kernel and thread switching.
### Endpoint
N/A (These are function calls within the embedded system)
### Parameters
- `osKernelInitialize()`: None
- `osKernelStart()`: None
### Request Example
```c
// System Initialization
SystemCoreClockUpdate();
// Initialize RTOS kernel if inactive
if (osKernelGetState() == osKernelInactive) {
osKernelInitialize();
}
// Create threads here...
// Start RTOS kernel if ready
if (osKernelGetState() == osKernelReady) {
osKernelStart();
}
while(1); // Program halts here in case of error
```
### Response
- `osKernelInitialize()`: Void
- `osKernelStart()`: `osStatus_t` indicating success or error.
- `osOK`: Kernel started successfully.
- `osError`: Unspecific error occurred.
- `osErrorISR`: Called from an Interrupt Service Routine (not allowed).
### Notes
- `osKernelStart()` will not return if successful.
- Only specific functions like `osKernelGetInfo`, `osKernelGetState`, and object creation functions can be called before `osKernelStart`.
- `osKernelStart()` cannot be called from an Interrupt Service Routine.
```
--------------------------------
### GET /package/examples
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
Retrieves the collection of examples defined within a CMSIS-Pack. This element acts as a container for one or more example project definitions.
```APIDOC
## GET /package/examples
### Description
This is the root grouping element for all examples contained within a software pack. Only one such group is permitted per pack.
### Method
GET
### Endpoint
/package/examples
### Parameters
None
### Response
#### Success Response (200)
- **example** (ExampleType) - A list of fully specified project examples.
#### Response Example
...
```
--------------------------------
### Example Usage: Ping www.arm.com - C
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__wifi__socket__gr.html
This C code example demonstrates how to use the ARM WiFi socket functions to resolve the IP address of 'www.arm.com' and then ping it. It initializes the WiFi driver, calls SocketGetHostByName to get the IP, and then calls Ping to check connectivity. Error handling is included for both resolution and ping operations.
```c
extern ARM_DRIVER_WIFI Driver_WiFi0;
static ARM_DRIVER_WIFI *wifi;
void ping_arm_com (void) {
uint8_t ip[4];
uint32_t ip_len;
int32_t res;
wifi = &Driver_WiFi0;
ip_len = sizeof(ip);
res = wifi->SocketGetHostByName("www.arm.com", ARM_SOCKET_AF_INET, (uint8_t *)ip, &ip_len);
if (res == ARM_DRIVER_OK) {
res = wifi->Ping((uint8_t *)ip, sizeof(ip));
if (res == ARM_DRIVER_OK) {
// "www.arm.com" responded to ping
}
} else {
// "www.arm.com" not resolved
}
}
```
--------------------------------
### Initialize and Start CMSIS-RTOS Kernel
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__KernelCtrl.html
Demonstrates how to check the kernel state, initialize the kernel if inactive, and start thread execution once the kernel is ready.
```c
int main (void) {
SystemCoreClockUpdate();
if(osKernelGetState() == osKernelInactive) {
osKernelInitialize();
}
// ... Start Threads
if (osKernelGetState() == osKernelReady) {
osKernelStart();
}
while(1);
}
```
--------------------------------
### Define Example Attributes and Components
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_examples_pg.html
Categorizes example projects using keywords, categories, and specific software components required for the build.
```xml
Example Project
Blinky
```
--------------------------------
### RTC Initialization and Alarm Setup (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Projects/NUCLEO-G071RB/Examples_LL/RTC/RTC_Alarm/readme.txt
This code demonstrates the initialization of the RTC peripheral, including setting the time, date, and configuring an alarm. The example sets the time to 11:59:55 PM and schedules an alarm to trigger 30 seconds later at 12:00:25 AM. The current time and date are updated and displayed.
```c
// Configure the RTC peripheral
Configure_RTC();
// Initialize time, date, and alarm
// Time is set to 11:59:55 PM
// Alarm is set to trigger after 30 seconds at 12:00:25 AM
Configure_RTC_Alarm();
// Update and display current time and date
while (1) {
HAL_Delay(1000);
Update_RTC_Time();
ShowTime();
ShowDate();
}
```
--------------------------------
### Complete Requirements Section Example (XML)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/element_requirements_pg.html
An example demonstrating the complete requirements section, encompassing packages, compilers, and languages for a project configuration.
```xml
```
--------------------------------
### Main Example Functions
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/NN/html/globals_func.html
Main functions for example implementations, such as CIFAR-10 and GRU examples.
```APIDOC
## Main Example Functions
### Description
Entry points for example applications demonstrating the capabilities of the CMSIS-NN library, such as image classification (CIFAR-10) and GRU models.
### Functions
- **main()**: The main function for executing example applications like `arm_nnexamples_cifar10` and `arm_nnexamples_gru`.
```
--------------------------------
### Kernel Execution Started (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__rtx__evr__kernel.html
Logs an event when the RTOS kernel execution has successfully started via osKernelStart.
```c
void EvrRtxKernelStarted(
void
)
{
// Event Recorder logic for kernel started
}
```
--------------------------------
### Start a CMSIS-RTOS Timer
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__TimerMgmt.html
Demonstrates how to create a periodic timer using osTimerNew and start it using osTimerStart with a specified tick delay.
```c
#include "cmsis_os2.h"
void Timer_Callback (void *arg) { }
uint32_t exec;
void TimerStart_example (void) {
osTimerId_t id;
uint32_t timerDelay;
osStatus_t status;
exec = 1U;
id = osTimerNew(Timer_Callback, osTimerPeriodic, &exec, NULL);
if (id != NULL) {
timerDelay = 1000U;
status = osTimerStart(id, timerDelay);
if (status != osOK) {
}
}
}
```
--------------------------------
### Get Example Component Attribute
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/pdsc_package_pg.html
Retrieves the component version attribute for a specific example.
```APIDOC
## GET /package/examples/example/attributes/component
### Description
Retrieves the component version attribute associated with an example.
### Method
GET
### Endpoint
/package/examples/example/attributes/component
### Parameters
#### Query Parameters
- **_Cversion_** (string) - Required - The component version attribute.
### Response
#### Success Response (200)
- **component_attribute** (object) - The component version attribute.
- **c_version** (string) - The component version.
#### Response Example
{
"component_attribute": {
"c_version": "3.0.0"
}
}
```
--------------------------------
### Initialize WiFi Bypass Mode Example (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__wifi__bypass__gr.html
Example demonstrating the initialization process for WiFi bypass mode, including retrieving driver capabilities and setting up a notification handler. This snippet illustrates how to check for bypass mode support and obtain necessary driver information.
```c
extern ARM_DRIVER_WIFI Driver_WiFi0;
static ARM_DRIVER_WIFI *wifi;
static ARM_ETH_MAC_ADDR own_mac_address;
static void wifi_notify (uint32_t event, void *arg) {
switch (event) {
// ... event handling ...
}
}
void initialize_wifi_bypass (void) {
ARM_WIFI_CAPABILITIES capabilities;
wifi = &Driver_WiFi0;
capabilities = wifi->GetCapabilities();
// ... further initialization ...
}
```
--------------------------------
### POST /osKernelStart
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__KernelCtrl.html
Starts the RTOS kernel and begins thread switching.
```APIDOC
## POST /osKernelStart
### Description
Starts the RTOS kernel and begins thread switching. Cannot be called from Interrupt Service Routines (ISR).
### Method
POST
### Endpoint
osKernelStart()
### Response
#### Success Response (200)
- **status** (osStatus) - Returns osOK if successfully started.
#### Error Response (400)
- **status** (osStatus) - Returns osErrorISR if called from an ISR.
### Response Example
{
"status": "osOK"
}
```
--------------------------------
### Example: Delete Timer using CMSIS-RTOS
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__TimerMgmt.html
An example function demonstrating the deletion of a timer created with osTimerCreate. It includes starting the timer and checking the status of the osTimerDelete call.
```c
#include "cmsis_os.h"
void Timer_Callback (void const *arg);
osTimerDef(Timer, Timer_Callback);
void TimerDelete_example (void) {
osTimerId id;
osStatus status;
// Create periodic timer
exec = 1;
id = osTimerCreate(osTimer(Timer2), osTimerPeriodic, NULL);
osTimerStart(id, 1000UL);
status = osTimerDelete(id);
if (status != osOK) {
// Timer could not be deleted
}
}
```
--------------------------------
### GET /cmsis-dsp/matrix-example-f32
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__matrix__example__f32_8c.html
Retrieves the structure and definitions for the floating-point matrix example in the CMSIS-DSP library.
```APIDOC
## GET /cmsis-dsp/matrix-example-f32
### Description
This endpoint provides the technical reference for the `arm_matrix_example_f32.c` file, which demonstrates matrix operations using the CMSIS-DSP library.
### Method
GET
### Endpoint
/cmsis-dsp/matrix-example-f32
### Parameters
#### Path Parameters
- None
#### Query Parameters
- None
#### Request Body
- None
### Request Example
GET /cmsis-dsp/matrix-example-f32
### Response
#### Success Response (200)
- **main** (int32_t) - The entry point function for the matrix example.
- **SNR_THRESHOLD** (macro) - The signal-to-noise ratio threshold constant.
- **A_f32** (float32_t[16]) - Input matrix A.
- **B_f32** (float32_t[4]) - Input matrix B.
- **AT_f32** (float32_t[16]) - Transposed matrix storage.
- **ATMA_f32** (float32_t[16]) - Intermediate matrix product storage.
- **ATMAI_f32** (float32_t[16]) - Inverted matrix storage.
- **X_f32** (float32_t[4]) - Resultant vector.
- **snr** (float32_t) - Calculated signal-to-noise ratio.
#### Response Example
{
"status": "success",
"file": "arm_matrix_example_f32.c",
"version": "1.7.0",
"variables": ["A_f32", "B_f32", "AT_f32", "ATMA_f32", "ATMAI_f32", "X_f32", "snr"]
}
```
--------------------------------
### DAP_SETUP Initialization
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DAP/html/group__DAP__Config__Initialization__gr.html
Initializes the Debug Unit I/O pins and LEDs.
```APIDOC
## DAP_SETUP
### Description
Setup of the Debug Unit I/O pins and LEDs (called when Debug Unit is initialized).
This function performs the initialization of the CMSIS-DAP Hardware I/O Pins and the Status LEDs. In detail the operation of Hardware I/O and LED pins are enabled and set:
* I/O clock system enabled.
* all I/O pins: input buffer enabled, output pins are set to HighZ mode.
* for nTRST, nRESET a weak pull-up (if available) is enabled.
* LED output pins are enabled and LEDs are turned off.
### Method
`__STATIC_INLINE void`
### Endpoint
N/A (This is a function call within the firmware)
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
```c
DAP_SETUP();
```
### Response
#### Success Response (void)
This function does not return a value.
#### Response Example
N/A
```
--------------------------------
### Initialize and Start RTX Kernel
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/cre_rtx_proj.html
Initializes the RTX kernel, sets the NVIC priority grouping, creates threads, and starts the kernel execution. This is a fundamental setup for using the RTX real-time operating system.
```c
#include "cmsis_os2.h"
// ... other code ...
osKernelInitialize(); // initialize RTX
NVIC_SetPriorityGrouping(3); // setup priority grouping
// Assuming tread_func is defined elsewhere
// osThreadId_t tread_id;
// tread_id = osThreadNew(tread_func, NULL, NULL); // create some threads
osKernelStart(); // start RTX kernel
```
--------------------------------
### Install Dependencies in Virtual Environment
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/DSP/PythonWrapper/README.md
Installs necessary Python packages (NumPy, SciPy, Matplotlib) within an activated virtual environment. These packages are required to run the examples provided with the CMSIS-DSP Python wrapper.
```bash
pip install numpy
pip install scipy
pip install matplotlib
```
--------------------------------
### osKernelStart
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__KernelCtrl.html
Starts the RTOS kernel and begins thread switching.
```APIDOC
## osKernelStart
### Description
Starts the RTOS Kernel and enables thread switching.
### Method
Function Call
### Parameters
None
### Response
- **osStatus** (enum) - Returns osOK on success or an error code.
```
--------------------------------
### Message Queue Get Pending Event
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__rtx__evr__message__queue.html
Logs when osMessageQueueGet starts waiting for a message to be retrieved from the queue.
```APIDOC
## EvrRtxMessageQueueGetPending
### Description
Logs when `osMessageQueueGet` starts waiting for a message to be retrieved from the queue.
### Method
None (Event Recorder Function)
### Endpoint
N/A
### Parameters
#### Path Parameters
None
#### Query Parameters
None
#### Request Body
None
### Request Example
None
### Response
#### Success Response (200)
None
#### Response Example
None
### Event Details
- **mq_id** (osMessageQueueId_t): Message queue ID obtained by `osMessageQueueNew`.
- **msg_ptr** (void *): Pointer to the buffer for the message to be retrieved.
- **timeout** (uint32_t): Timeout value or 0 for no timeout.
### Related Functions
- `osMessageQueueGet`
- `osMessageQueueNew`
```
--------------------------------
### osKernelStart
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS/html/group__CMSIS__RTOS__KernelCtrl.html
Starts the RTOS kernel and begins thread switching.
```APIDOC
## osKernelStart
### Description
Starts the RTOS kernel and begins the execution of created threads. This function typically does not return.
### Method
Function Call
### Parameters
None
### Request Example
osKernelStart();
### Response
#### Success Response (200)
- **void** - The kernel begins thread execution.
```
--------------------------------
### GET /dsp/test-data
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DSP/html/globals_vars_t.html
Retrieves information about test input/output data arrays used in signal processing examples.
```APIDOC
## GET /dsp/test-data
### Description
Provides access to the definitions and source files for various test data arrays (e.g., testInput_f32, testOutput) used in DSP algorithm verification.
### Method
GET
### Endpoint
/dsp/test-data
### Parameters
#### Query Parameters
- **type** (string) - Optional - Filter by data type (e.g., f32, q31, q15)
### Request Example
GET /dsp/test-data?type=f32
### Response
#### Success Response (200)
- **data_name** (string) - Name of the test array
- **source_file** (string) - File containing the array definition
#### Response Example
{
"testInput_f32": "arm_graphic_equalizer_data.c",
"testOutput": "arm_class_marks_example_f32.c"
}
```
--------------------------------
### Startup Initialization Macros
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Core/html/group__compiler__conntrol__gr.html
Demonstrates the use of __PROGRAM_START and __STACK_LIMIT within the Reset_Handler for low-level system initialization.
```C
void Reset_Handler(void) {
SystemInit();
__set_MSPLIM((uint32_t)(&__STACK_LIMIT));
__PROGRAM_START();
}
```
--------------------------------
### Implement an Echo Server using WiFi Sockets
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__wifi__socket__gr.html
This example demonstrates how to create a TCP server using the STM32CubeG0 WiFi driver. It includes binding a socket, setting it to listen mode, accepting incoming connections, and performing a basic echo loop.
```c
extern ARM_DRIVER_WIFI Driver_WiFi0;
static ARM_DRIVER_WIFI *wifi;
void Echo_Server_Thread (void *arg) {
uint8_t ip[4] = { 0U, 0U, 0U, 0U };
int32_t sock, sd, res;
char dbuf[120];
while (1) {
wifi = &Driver_WiFi0;
sock = wifi->SocketCreate(ARM_SOCKET_AF_INET, ARM_SOCKET_SOCK_STREAM, ARM_SOCKET_IPPROTO_TCP);
wifi->SocketBind(sock, (uint8_t *)ip, sizeof(ip), 7U);
wifi->SocketListen(sock, 1);
sd = wifi->SocketAccept(sock, NULL, NULL, NULL);
wifi->SocketClose(sock);
sock = sd;
while (1) {
res = wifi->SocketRecv(sock, dbuf, sizeof(dbuf));
if (res < 0) break;
if (res > 0) wifi->SocketSend(sock, dbuf, res);
}
wifi->SocketClose(sock);
}
}
```
--------------------------------
### GET /data-fields/m
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Core_A/html/functions_m.html
Retrieves the list of data fields starting with the letter 'm' within the CMSIS-Core (Cortex-A) structures.
```APIDOC
## GET /data-fields/m
### Description
Retrieves a list of all struct and union fields starting with the letter 'm' defined in the CMSIS-Core (Cortex-A) library.
### Method
GET
### Endpoint
/data-fields/m
### Parameters
None
### Request Example
GET /data-fields/m
### Response
#### Success Response (200)
- **M** (union) - Field present in CPSR_Type and SCTLR_Type
- **MASKED_INT_STATUS** (field) - Field present in L2C_310_TypeDef
- **mem_t** (field) - Field present in mmu_region_attributes_Type
#### Response Example
{
"fields": [
{"name": "M", "parent": ["CPSR_Type", "SCTLR_Type"]},
{"name": "MASKED_INT_STATUS", "parent": "L2C_310_TypeDef"},
{"name": "mem_t", "parent": "mmu_region_attributes_Type"}
]
}
```
--------------------------------
### FIR Filter Example Main Function (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DSP/html/arm__fir__example__f32_8c.html
The main function serves as the entry point for the FIR filter example. It orchestrates the setup, execution, and verification of the FIR filter operation using predefined test data and coefficients.
```c
int32_t main(void)
{
// Example execution and verification logic would go here
return 0;
}
```
--------------------------------
### Initialize and Power Up Peripheral
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/theoryOperation.html
Demonstrates the standard sequence to initialize I/O resources and power up a peripheral using the CMSIS-Driver API.
```C
drv->Initialize (...); // Allocate I/O pins
drv->PowerControl (ARM_POWER_FULL); // Power up peripheral, setup IRQ/DMA
```
--------------------------------
### Low-Power Stop Mode Example
Source: https://context7.com/stmicroelectronics/stm32cubeg0/llms.txt
Demonstrates how to configure and enter the low-power Stop 0 mode using LL drivers, minimizing power consumption while retaining wake-up capabilities.
```APIDOC
## Low-Power Stop Mode
Enter Stop mode for ultra-low power consumption with wake-up capability.
### Description
This code snippet shows how to configure the power controller and enter Stop 0 mode. It includes setting GPIOs to analog mode to further reduce power and disabling their clocks before entering the low-power state.
### Method
N/A (C code example)
### Endpoint
N/A (Embedded C code)
### Parameters
N/A
### Request Example
```c
#include "main.h"
void Configure_PWR(void)
{
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
}
void EnterSTOP0Mode(void)
{
LL_GPIO_InitTypeDef gpio_initstruct = {
LL_GPIO_PIN_ALL,
LL_GPIO_MODE_ANALOG,
LL_GPIO_SPEED_FREQ_HIGH,
LL_GPIO_OUTPUT_PUSHPULL,
LL_GPIO_PULL_NO,
LL_GPIO_AF_0
};
/* Set all GPIO to analog mode to reduce power consumption */
LL_IOP_GRP1_EnableClock(LL_IOP_GRP1_PERIPH_GPIOA |
LL_IOP_GRP1_PERIPH_GPIOB |
LL_IOP_GRP1_PERIPH_GPIOC |
LL_IOP_GRP1_PERIPH_GPIOD |
LL_IOP_GRP1_PERIPH_GPIOF);
LL_GPIO_Init(GPIOA, &gpio_initstruct);
LL_GPIO_Init(GPIOB, &gpio_initstruct);
LL_GPIO_Init(GPIOC, &gpio_initstruct);
LL_GPIO_Init(GPIOD, &gpio_initstruct);
LL_GPIO_Init(GPIOF, &gpio_initstruct);
/* Disable GPIO clocks */
LL_IOP_GRP1_DisableClock(LL_IOP_GRP1_PERIPH_GPIOA |
LL_IOP_GRP1_PERIPH_GPIOB |
LL_IOP_GRP1_PERIPH_GPIOC |
LL_IOP_GRP1_PERIPH_GPIOD |
LL_IOP_GRP1_PERIPH_GPIOF);
/* Set STOP 0 mode */
LL_PWR_SetPowerMode(LL_PWR_MODE_STOP0);
/* Set SLEEPDEEP bit */
LL_LPM_EnableDeepSleep();
/* Enter Stop mode with WFI instruction */
__WFI();
}
int main(void)
{
LL_APB2_GRP1_EnableClock(LL_APB2_GRP1_PERIPH_SYSCFG);
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
SystemClock_Config();
MX_GPIO_Init();
Configure_PWR();
/* Blink LED for 5 seconds before entering stop mode */
for (int i = 0; i < 25; i++)
{
LL_GPIO_TogglePin(GPIOC, LL_GPIO_PIN_6);
LL_mDelay(200);
}
/* Turn off LED and enter Stop mode */
LL_GPIO_ResetOutputPin(GPIOC, LL_GPIO_PIN_6);
EnterSTOP0Mode();
while (1) { }
}
```
### Response
N/A (C code example)
```
--------------------------------
### GET /mpu_setup
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Zone/html/fm_mpu_setup.html
Retrieves the configuration schema for the Memory Protection Unit (MPU) setup, including implementation type and region-specific settings.
```APIDOC
## GET /mpu_setup
### Description
Retrieves the MPU configuration details, including the architecture version and a sequence of defined memory regions.
### Method
GET
### Endpoint
/mpu_setup
### Parameters
#### Path Parameters
- None
#### Query Parameters
- None
#### Request Body
- None
### Request Example
{}
### Response
#### Success Response (200)
- **mpu_setup.type** (string) - Implementation of the MPU (e.g., "v7M" or "v8M").
- **mpu_setup.region[n]** (sequence) - List of MPU region settings.
- **mpu_setup.region[n].no** (string) - The index number of the region.
- **mpu_setup.region[n].BaseAddress** (string) - The starting memory address of the region.
- **mpu_setup.region[n].RASR** (string) - The MPU region attribute and size register value.
#### Response Example
{
"mpu_setup": {
"type": "v8M",
"region": [
{
"no": "0",
"BaseAddress": "0x00000000",
"RASR": "0x00000000"
}
]
}
}
```
--------------------------------
### CMSIS-DAP V2 WinUSB Configuration INF File
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DAP/html/group__DAP__ConfigUSB__gr.html
This INF file is used to install the CMSIS-DAP V2 device on Windows 7 systems, enabling WinUSB driver installation. It specifies the device class, GUID, and links to the standard WinUSB driver.
```inf
[Version]
Signature = "$Windows NT$"
Class = USBDevice
ClassGUID = {88BAE032-5A81-49f0-BC3D-A4FF138216D6}
Provider = %ManufacturerName%
DriverVer = 04/13/2016, 1.0.0.0
CatalogFile.nt = CMSIS_DAP_v2_x86.cat
CatalogFile.ntx86 = CMSIS_DAP_v2_x86.cat
CatalogFile.ntamd64 = CMSIS_DAP_v2_amd64.cat
; ========== Manufacturer/Models sections ===========
[Manufacturer]
%ManufacturerName% = Devices, NTx86, NTamd64
[Devices.NTx86]
%DeviceName% = USB_Install, USB\VID_c251&PID_f000
[Devices.NTamd64]
%DeviceName% = USB_Install, USB\VID_c251&PID_f000
; ========== Class definition ===========
[ClassInstall32]
AddReg = ClassInstall_AddReg
[ClassInstall_AddReg]
HKR,,%ClassName%
HKR,,NoInstallClass,,1
HKR,,IconPath,0x10000,"%%SystemRoot%%\System32\setupapi.dll,-20"
HKR,,LowerLogoVersion,,5.2
; =================== Installation ===================
[USB_Install]
Include = winusb.inf
Needs = WINUSB.NT
[USB_Install.Services]
Include = winusb.inf
Needs = WINUSB.NT.Services
[USB_Install.HW]
AddReg = Dev_AddReg
[Dev_AddReg]
HKR,,DeviceInterfaceGUIDs,0x10000,"{CDB3B5AD-293B-4663-AA36-1AAE46463776}"
; =================== Strings ===================
[Strings]
ClassName = "Universal Serial Bus devices"
ManufacturerName = "KEIL - Tools By ARM"
DeviceName = "CMSIS-DAP v2"
```
--------------------------------
### Get USB Frame Number (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__usbh__host__gr.html
Retrieves the current USB frame number. This is a sequential 11-bit number updated by each Start of Frame (SOF) packet.
```c
uint16_t ARM_USBH_GetFrameNumber(
void
)
```
--------------------------------
### Initialize and Control SAI Interface
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/Driver__SAI_8c.html
Demonstrates the initialization and power management functions for the SAI peripheral driver.
```c
ARM_SAI_Initialize(cb_event);
ARM_SAI_PowerControl(ARM_POWER_FULL);
ARM_SAI_Control(control, arg1, arg2);
```
--------------------------------
### USART Asynchronous Communication Setup
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__usart__interface__gr.html
This example demonstrates how to initialize a thread and define a callback function for asynchronous USART operations using the CMSIS-RTOS and the USART driver access structure.
```c
#include "Driver_USART.h"
#include "cmsis_os.h"
#include
#include
void myUART_Thread(void const *argument);
osThreadId tid_myUART_Thread;
/* USART Driver */
extern ARM_DRIVER_USART Driver_USART3;
void myUSART_callback(uint32_t event)
{
uint32_t mask;
}
```
--------------------------------
### Neon Optimization Initialization Example
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DSP/html/group__BiquadCascadeDF2T.html
Demonstrates how to initialize a filter instance for Neon-optimized processing using a larger coefficient array.
```c
arm_biquad_cascade_df2T_init_f32(&SNeon, nbCascade, neonCoefs, stateNeon);
arm_biquad_cascade_df2T_compute_coefs_f32(&SNeon, nbCascade, coefs);
```
--------------------------------
### Initialize and Verify Ethernet PHY Driver
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__eth__phy__interface__gr.html
This example demonstrates how to retrieve the driver version and verify that the API version meets the minimum requirements before proceeding with initialization.
```c
extern ARM_DRIVER_ETH_PHY Driver_ETH_PHY0;
ARM_DRIVER_ETH_PHY *drv_info;
void setup_ethernet_phy (void) {
ARM_DRIVER_VERSION version;
drv_info = &Driver_ETH_PHY0;
version = drv_info->GetVersion();
if (version.api < 0x10A) { // requires at minimum API version 1.10 or higher
// error handling
return;
}
}
```
--------------------------------
### Define SAU Region Configuration in XML
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Zone/html/xml_sau_init.html
Example structure for defining an SAU region within the CMSIS-Zone configuration. This includes mandatory start and size attributes, along with optional security and processor identification.
```xml
```
--------------------------------
### Initialize and Configure SPI Master
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__spi__interface__gr.html
Demonstrates the initialization of an SPI driver instance, power management, and configuration of master mode parameters including clock polarity, phase, and data bit length.
```C
drv_capabilities = SPIdrv->GetCapabilities();
if (drv_capabilities.event_mode_fault == 0) {
return;
}
SPIdrv->Initialize(mySPI_callback);
SPIdrv->PowerControl(ARM_POWER_FULL);
SPIdrv->Control(ARM_SPI_MODE_MASTER | ARM_SPI_CPOL1_CPHA1 | ARM_SPI_MSB_LSB | ARM_SPI_SS_MASTER_SW | ARM_SPI_DATA_BITS(8), 10000000);
SPIdrv->Control(ARM_SPI_CONTROL_SS, ARM_SPI_SS_INACTIVE);
```
--------------------------------
### SPI Interface Usage Example
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/theoryOperation.html
Provides a detailed C code example demonstrating the initialization, configuration, and usage of the SPI interface, including event handling via callbacks and integration with an RTOS.
```APIDOC
## SPI Interface Usage Example
This example shows the usage of the SPI interface, including initialization, power control, configuration, and handling of transfer completion and error events.
### Include Headers
```c
#include "Driver_SPI.h"
#include "cmsis_os.h" // ARM::CMSIS:RTOS:Keil RTX
```
### Global Variables and Callback
```c
void mySPI_Thread(void const *argument);
osThreadDef(mySPI_Thread, osPriorityNormal, 1, 0);
/* SPI Driver */
extern ARM_DRIVER_SPI Driver_SPI0;
void mySPI_callback(uint32_t event)
{
switch (event)
{
case ARM_SPI_EVENT_TRANSFER_COMPLETE:
/* Success: Wakeup Thread */
osSignalSet(tid_mySPI_Thread, 0x01);
break;
case ARM_SPI_EVENT_DATA_LOST:
/* Occurs in slave mode when data is requested/sent by master
but send/receive/transfer operation has not been started
and indicates that data is lost. Occurs also in master mode
when driver cannot transfer data fast enough. */
__breakpoint(0); /* Error: Call debugger or replace with custom error handling */
break;
case ARM_SPI_EVENT_MODE_FAULT:
/* Occurs in master mode when Slave Select is deactivated and
indicates Master Mode Fault. */
__breakpoint(0); /* Error: Call debugger or replace with custom error handling */
break;
}
}
```
### Test Data Buffers
```c
/* Test data buffers */
const uint8_t testdata_out[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
uint8_t testdata_in[8];
```
### SPI Thread Function
```c
void mySPI_Thread(void const* arg)
{
ARM_DRIVER_SPI* SPIdrv = &Driver_SPI0;
osEvent evt;
#ifdef DEBUG
ARM_DRIVER_VERSION version;
ARM_SPI_CAPABILITIES drv_capabilities;
version = SPIdrv->GetVersion();
if (version.api < 0x200) /* requires at minimum API version 2.00 or higher */
{
/* error handling */
return;
}
drv_capabilities = SPIdrv->GetCapabilities();
if (drv_capabilities.event_mode_fault == 0)
{
/* error handling */
return;
}
#endif
/* Initialize the SPI driver */
SPIdrv->Initialize(mySPI_callback);
/* Power up the SPI peripheral */
SPIdrv->PowerControl(ARM_POWER_FULL);
/* Configure the SPI to Master, 8-bit mode @10000 kBits/sec */
// SPIdrv->Configure(...);
// SPIdrv->Transfer(...);
/* Wait for transfer complete signal */
// evt = osSignalWait(0x01, osWaitForever);
// if (evt.value.signals == 0x01) { ... }
}
```
```
--------------------------------
### Implement CMSIS-Core System Configuration Template
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Core_A/html/system_c_pg.html
A template for system_.c providing the structure for device initialization, clock definitions, and the SystemCoreClock variable. It serves as a starting point for silicon vendors to implement device-specific hardware setup.
```c
#include
#include ".h"
#include "irq_ctrl.h"
#define XTAL (12000000U)
#define SYSTEM_CLOCK (5 * XTAL)
uint32_t SystemCoreClock = SYSTEM_CLOCK;
void SystemCoreClockUpdate (void) {
SystemCoreClock = SYSTEM_CLOCK;
}
```
--------------------------------
### ADC HAL Driver Continuous Conversion (C)
Source: https://context7.com/stmicroelectronics/stm32cubeg0/llms.txt
Configures the ADC for continuous analog-to-digital conversion using a software trigger. This example demonstrates how to initialize the ADC, start a conversion, poll for completion, and read the converted data, converting it to millivolts.
```c
ADC_HandleTypeDef hadc1;
uint16_t uhADCxConvertedData = 0;
uint16_t uhADCxConvertedData_Voltage_mVolt = 0;
#define VDDA_APPLI 3300 /* Voltage reference in mV */
static void MX_ADC1_Init(void)
{
ADC_ChannelConfTypeDef sConfig = {0};
hadc1.Instance = ADC1;
hadc1.Init.ClockPrescaler = ADC_CLOCK_SYNC_PCLK_DIV4;
hadc1.Init.Resolution = ADC_RESOLUTION_12B;
hadc1.Init.DataAlign = ADC_DATAALIGN_RIGHT;
hadc1.Init.ScanConvMode = ADC_SCAN_DISABLE;
hadc1.Init.EOCSelection = ADC_EOC_SINGLE_CONV;
hadc1.Init.LowPowerAutoWait = DISABLE;
hadc1.Init.LowPowerAutoPowerOff = DISABLE;
hadc1.Init.ContinuousConvMode = ENABLE;
hadc1.Init.NbrOfConversion = 1;
hadc1.Init.ExternalTrigConv = ADC_SOFTWARE_START;
hadc1.Init.ExternalTrigConvEdge = ADC_EXTERNALTRIGCONVEDGE_NONE;
hadc1.Init.DMAContinuousRequests = DISABLE;
hadc1.Init.Overrun = ADC_OVR_DATA_OVERWRITTEN;
hadc1.Init.SamplingTimeCommon1 = ADC_SAMPLETIME_39CYCLES_5;
if (HAL_ADC_Init(&hadc1) != HAL_OK)
{
Error_Handler();
}
/* Configure ADC channel */
sConfig.Channel = ADC_CHANNEL_4;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLINGTIME_COMMON_1;
if (HAL_ADC_ConfigChannel(&hadc1, &sConfig) != HAL_OK)
{
Error_Handler();
}
}
int main(void)
{
HAL_Init();
SystemClock_Config();
MX_ADC1_Init();
/* Run ADC calibration */
if (HAL_ADCEx_Calibration_Start(&hadc1) != HAL_OK)
{
Error_Handler();
}
/* Start ADC conversion */
if (HAL_ADC_Start(&hadc1) != HAL_OK)
{
Error_Handler();
}
/* Wait for first conversion */
if (HAL_ADC_PollForConversion(&hadc1, 2) != HAL_OK)
{
Error_Handler();
}
while (1)
{
/* Get ADC converted data */
uhADCxConvertedData = HAL_ADC_GetValue(&hadc1);
/* Compute voltage in mV */
uhADCxConvertedData_Voltage_mVolt = __LL_ADC_CALC_DATA_TO_VOLTAGE(
VDDA_APPLI, uhADCxConvertedData, hadc1.Init.Resolution);
}
}
```
--------------------------------
### Updated Startup Concept for Clock and Memory Configuration
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/DSP/html/ChangeLog_pg.html
The startup sequence has been modified to call SystemInit() from the startup file before premain. This ensures the clock system and external memory controller are configured correctly before main execution, addressing limitations of the previous approach.
```c
Changed startup concept
The old startup concept (calling SystemInit_ExtMemCtl from startup file and calling SystemInit from main) has the weakness that it does not work for controllers which need a already configuerd clock system to configure the external memory controller.
Changed startup concept
* SystemInit() is called from startup file before premain.
* SystemInit() configures the clock system and also configures an existing external memory controller.
* SystemInit() must not use global variables.
* SystemCoreClock is initialized with a correct predefined value.
* Additional function void SystemCoreClockUpdate (void) is provided.
* SystemCoreClockUpdate() updates the variable SystemCoreClock and must be called whenever the core clock is changed.
* SystemCoreClockUpdate() evaluates the clock register settings and calculates the current core clock.
```
--------------------------------
### Get IP Configuration Options for STM32 WiFi
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__wifi__management__gr.html
Provides an example of how to retrieve IP configuration settings such as IP address, subnet mask, and gateway address for the STM32 WiFi module's station interface using the GetOption function.
```c
uint8_t ip[4]; // IP address
uint8_t mask[4]; // Subnet mask
uint8_t gateway[4]; // Gateway address
// Get IP address, Subnet mask and Gateway address of the Station
wifi->GetOption(0U, ARM_WIFI_IP, &ip, sizeof(ip));
wifi->GetOption(0U, ARM_WIFI_IP_SUBNET_MASK, &mask, sizeof(mask));
wifi->GetOption(0U, ARM_WIFI_IP_GATEWAY, &gateway, sizeof(gateway));
```
--------------------------------
### Storage Interface Lifecycle Management
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__storage__interface__gr.html
Demonstrates the standard sequence for initializing and powering up the storage peripheral, as well as the sequence for powering down and uninitializing it to release resources.
```c
/* Start Sequence */
drv->Initialize(...); // Allocate I/O pins
drv->PowerControl(ARM_POWER_FULL); // Power up peripheral, setup IRQ/DMA
/* Stop Sequence */
drv->PowerControl(ARM_POWER_OFF); // Terminate pending transfers, reset IRQ/DMA, power off
drv->Uninitialize(...); // Release I/O pins
```
--------------------------------
### Setup OS Tick Timer - CMSIS-RTOS2
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/group__CMSIS__RTOS__TickAPI.html
Configures the OS Tick timer to generate periodic RTOS kernel ticks. It takes the desired frequency and an IRQ handler as input. The timer is initialized but not started, with the RTOS kernel responsible for enabling interrupts.
```c
int32_t OS_Tick_Setup(uint32_t freq, IRQHandler_t handler)
{
// Implementation details for setting up the OS Tick timer
return 0; // Success
}
```
--------------------------------
### SystemInit Function
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Core_A/html/group__system__init__gr.html
Initializes the microcontroller system, including oscillator and PLL configuration.
```APIDOC
## void SystemInit()
### Description
Initializes the microcontroller system. Typically, this function configures the oscillator (PLL) that is part of the microcontroller device. For systems with a variable clock speed, it updates the SystemCoreClock variable.
### Method
Internal Function Call
### Parameters
None
### Request Example
SystemInit();
### Response
- **void** - No return value
```
--------------------------------
### RTX Kernel State and Scheduler Control Events (C)
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/RTOS2/html/rtx__evr_8h.html
Defines events related to retrieving the RTOS kernel state and controlling the scheduler. Includes functions for getting the kernel state, starting, locking, unlocking, restoring lock states, suspending, and resuming the scheduler.
```c
void EvrRtxKernelGetState (osKernelState_t state)
void EvrRtxKernelStart (void)
void EvrRtxKernelStarted (void)
void EvrRtxKernelLock (void)
void EvrRtxKernelLocked (int32_t lock)
void EvrRtxKernelUnlock (void)
void EvrRtxKernelUnlocked (int32_t lock)
void EvrRtxKernelRestoreLock (int32_t lock)
void EvrRtxKernelLockRestored (int32_t lock)
void EvrRtxKernelSuspend (void)
void EvrRtxKernelSuspended (uint32_t sleep_ticks)
void EvrRtxKernelResume (uint32_t sleep_ticks)
void EvrRtxKernelResumed (void)
```
--------------------------------
### Project File Grouping Example
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Pack/html/cpdsc_pg.html
This example demonstrates how to group different types of files within a project, including source code and documentation. It shows nested grouping for C and Assembler source files.
```xml
...
```
--------------------------------
### Read Setup Packet from Control Endpoint
Source: https://github.com/stmicroelectronics/stm32cubeg0/blob/master/Drivers/CMSIS/docs/Driver/html/group__usbd__interface__gr.html
Reads a setup packet received over the Control Endpoint. Setup packets are used for device configuration and command transfer during enumeration and operation.
```c
int32_t ReadSetupPacket (uint8_t *setup);
```