Hierodule 1.6.2
Utility module set for STM32 MCUs
Loading...
Searching...
No Matches
hierodule_usb.h
Go to the documentation of this file.
1
12#ifndef __HIERODULE_USB_H
13#define __HIERODULE_USB_H
14
15#ifdef __cplusplus
16extern "C"
17{
18#endif
36#include <main.h>
37#include <stddef.h>
38#include <stdlib.h>
39
41#if __has_include("usbd_cdc_if.h")
42#include <usbd_cdc_if.h>
44#endif
51typedef struct
52{
58 uint8_t *RX_Buffer;
62 uint32_t RX_Index;
66 uint32_t RX_New;
70 uint16_t RX_BufferSize;
71
75 void (*TC_Handler)(void);
76
78
87
91uint8_t HIERODULE_USB_GetNextByte(void);
92
99void HIERODULE_USB_InitWrapper(uint16_t RX_BufferSize, void (*TC_Handler)(void) );
100
105
111void HIERODULE_USB_TransmitPackage(uint8_t *TX_Buffer, uint32_t Size);
112
119void HIERODULE_USB_Receive_Callback(uint8_t *Buf, uint32_t *Len);
127#ifdef __cplusplus
128}
129#endif
130
131#endif /* __HIERODULE_USB_H */
132
133
134
uint8_t HIERODULE_USB_GetNextByte(void)
Fetches the next byte in the RX ring buffer.
void HIERODULE_USB_InitWrapper(uint16_t RX_BufferSize, void(*TC_Handler)(void))
Initializes the wrapper for the USB peripheral.
HIERODULE_USB_Wrapper Wrapper
Extern declaration for the wrapper instance in the source file.
void HIERODULE_USB_TransmitPackage(uint8_t *TX_Buffer, uint32_t Size)
Sets up the data to be transmitted.
void HIERODULE_USB_Receive_Callback(uint8_t *Buf, uint32_t *Len)
Callback function that updates the ring buffer and invokes TC_Handler if it's not NULL.
void HIERODULE_USB_ReleaseWrapper(void)
De-initializes the wrapper for the USB peripheral.
Struct that keeps variables for the ring buffer and a pointer to the transmission end callback routin...
uint8_t * RX_Buffer
The ring buffer where the data received is appended.
uint32_t RX_New
Number of new bytes in the ring buffer.
uint16_t RX_BufferSize
Number of elements in the ring buffer.
uint32_t RX_Index
Index of next-byte-to-be-received in the ring buffer.