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. |
ERROR | There is no drive that can be mounted on the USB MSD. |
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 changing to USB MSD mode, this function does not return control to the application program. Please note that quitting the USB MSD will restart the device, so running the following code will make it difficalt to change the app.
void main(void){
SetUsbMsdMode(BS_KEY);
}
Requirements
Header file:
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: 2021/10/01