5 years ago.

How to prevent pop-up window when LPC1768 connected to pc?

when I connect mbed NXP LPC1768 to USB, MBED E: \ opens, how to prevent opening?

1 Answer

5 years ago.

Use LocalFileSystem and on startup open a file and never close it.

While LocalFileSystem has a file open the flash storage isn't available to windows. It may pop up briefly when first connected but if this is the first thing your code does the drive is normally locked before windows has a chance to show anything.

If you do this then I'd recommend setting an unused IO pin as a DigitalIn with pull up and then check the pin is high before opening the file. That way you can pull that pin to ground and reset the board if you need to gain access to the drive.

e.g.

#include "mbed.h"

DigitalIn locked(p21,PullUp);
LocalFileSystem localFS("local");
FILE *fsLockFile;

main() {
    if (locked)
        fsLockFile = fopen("/local/lock.txt","w");
    // rest of code here
}