Sound Byte Libs 0.5.1-340-gab5b79a
C++ firmware library for audio applications on 32-bit ARM Cortex-M processors
Loading...
Searching...
No Matches
usb.hpp
Go to the documentation of this file.
1#ifndef SBL_USB_USB_HPP_
2#define SBL_USB_USB_HPP_
3
4/**
5 * @file usb.hpp
6 * @brief USB subsystem control
7 *
8 * Provides initialization and task processing for USB functionality.
9 * The actual implementation is MCU-specific and lives in sbl-hardware.
10 *
11 * Usage:
12 * @code
13 * #include <sbl/usb/usb.hpp>
14 *
15 * int main() {
16 * sbl::driver::init();
17 * sbl::usb::init();
18 *
19 * while (true) {
20 * sbl::usb::task(); // Process USB events
21 * // ... application code ...
22 * }
23 * }
24 * @endcode
25 */
26
27#include <cstdint>
28
29namespace sbl::usb {
30
31/**
32 * @brief Initialize USB subsystem
33 *
34 * Sets up USB peripheral clocks, pins, and initializes TinyUSB.
35 * Call once at startup after sbl::driver::init().
36 */
37void init();
38
39/**
40 * @brief Process USB events
41 *
42 * Must be called periodically (from main loop or timer) to handle
43 * USB enumeration, data transfer, and protocol handling.
44 */
45void task();
46
47/**
48 * @brief Check if USB is enumerated and ready
49 *
50 * @return true if USB device is configured and ready for communication
51 */
52bool ready();
53
54} // namespace sbl::usb
55
56#endif // SBL_USB_USB_HPP_
USB device classes.
Definition cdc.cpp:25
void init()
Initialize USB subsystem.
void task()
Process USB events.
bool ready()
Check if USB is enumerated and ready.