SBB Micro
Source code for the self-balancing-bike microcontroller unit (Teensy 4.1-based). 🚀️
|
Functions and definitions for MTP mode. More...
Namespaces | |
namespace | LedMode |
Led mode constants. | |
Macros | |
#define | DOMTP 1 |
Enable or disable MTP (1/0). | |
#define | STORAGENAME "SBB Logger" |
MTP storage name. | |
#define | MTP_ENABLE_TIMEOUT 3000 |
Timeout for enabling MTP mode (ms). | |
Functions | |
bool | check_mtp (void) |
Check for MTP mode. | |
void | do_mtp (void) |
Run MTP mode. | |
Functions and definitions for MTP mode.
Definition of the MTP functions, variables, and macros. This include functions to initialize and run the MTP mode. MTP (standing for media-transfer-protocol) is a communication protocol that allows media files to be transferred automatically to and from portable devices. In particular, the MTP mode allows transferring of the log files from the built-in SD card to a PC via USB. To enter in MTP mode, it is sufficient to keep the on/off button pressed for at least MTP_ENABLE_TIMEOUT milliseconds when turning on. During logging the LEDmode is LedMode::MTP, and status LED blinks depending on MTP_LED. To get the MTP mode working in the PC side:
#define DOMTP 1 |
Enable or disable MTP (1/0).
#define MTP_ENABLE_TIMEOUT 3000 |
Timeout for enabling MTP mode (ms).
If the on/off button is pressed for a time longer than this, the microcontroller enters in MTP mode.
#define STORAGENAME "SBB Logger" |
MTP storage name.
The name shown in the PC when connecting the USB.
bool check_mtp | ( | void | ) |
Check for MTP mode.
Function to check the on/off button state with a timeout of MTP_ENABLE_TIMEOUT milliseconds and to initialize the built-in SD card. If SD card initization fails, the MTP mode is not enabled.
void do_mtp | ( | void | ) |
Run MTP mode.
Function to initialize the MTP and to run the MTP loop. If the USB is not connected, the MTP loop is not run. The function is blocking.