Syntax
int SetUsbMsdMode(
int key
);
Parameters
- key
-
[in] Specifies the key to stop the USB MSD mode.
Return value
Value | Description |
---|---|
None(reboot) | The function does not return control to the application program after entering USB MSD mode. |
Remarks
When this function is called, the USB port will be changed to USB MSD (USB mass storage device) and the terminal will be restarted. When you connect the device to your a with a USB cable, it will be recognized as a USB drive.
When the key specified by key is pressed, the USB port is returned to the USB serial port and the terminal is restarted. If you specify an invalid key for key, the BS key will be set.
After switching to USB MSD mode, this function does not return control to the application program. If you execute an application with the following code, the system menu cannot be launched in USB MSD mode. To launch the system menu, press the BS key in USB MSD mode, then press and hold the Q1+Q2 keys.
void main(void){
SetUsbMsdMode(BS_KEY);
}
Requirements
lib.hLibrary file:
libSTARTUPOPH5000.a
Sample
#include <stdio.h>
#include "lib.h"
void main(void)
{
char ch;
GotoXY( 1,1 );
printf("Press F1 Key\n");
while(1)
{
if (kbhit())
{
ch = getchar();
if (ch == F1_KEY) break;
ResetKey();
}
}
SetUsbMsdMode(BS_KEY);
while(1)
{
Idle();
}
}
Last updated: 2025/01/23