SBB Micro
Source code for the self-balancing-bike microcontroller unit (Teensy 4.1-based). 🚀️
Loading...
Searching...
No Matches
MTP

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.
 

Detailed Description

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:

See also
sbbmtp.h LedMode::MTP MTP_LED

Macro Definition Documentation

◆ DOMTP

#define DOMTP   1

Enable or disable MTP (1/0).

◆ MTP_ENABLE_TIMEOUT

#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.

◆ STORAGENAME

#define STORAGENAME   "SBB Logger"

MTP storage name.

The name shown in the PC when connecting the USB.

Function Documentation

◆ check_mtp()

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.

Returns
True for entering in MTP mode, false otherwise.
See also
MTP_ENABLE_TIMEOUT

◆ do_mtp()

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.