Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: KL46Z-lpc81isp lpcterm2
USBLocalFileSystem Class Reference
Access the LocalFileSystem using RamDisk(64KB) More...
#include <USBLocalFileSystem.h>
Public Member Functions | |
USBLocalFileSystem (const char *name="local") | |
Create the Local File System using RamDisk(64KB) | |
USBLocalFileSystem (PinName mosi, PinName miso, PinName sclk, PinName cs, const char *name="local") | |
Create the Local File System for accessing an SD Card using SPI. | |
USBLocalFileSystem (StorageInterface *storage, const char *name="local") | |
Create the Local File System using StorageInterface. | |
int | readable () |
Determine if there is a character available to read. | |
int | writeable () |
Determine if there is space available to write a character. | |
int | getc () |
Read a char from the serial port. | |
int | putc (int c) |
Write a char to the serial port. | |
int | puts (const char *str) |
Write a string to the serial port. |
Detailed Description
Access the LocalFileSystem using RamDisk(64KB)
#include "USBLocalFileSystem.h" int main() { USBLocalFileSystem* usb_local = new USBLocalFileSystem(); // RamDisk(64KB) FILE *fp = fopen("/local/mbed.txt", "a"); fprintf(fp, "Hello World!\n"); fclose(fp); }
Definition at line 18 of file USBLocalFileSystem.h.
Constructor & Destructor Documentation
USBLocalFileSystem | ( | const char * | name = "local" ) |
Create the Local File System using RamDisk(64KB)
- Parameters:
-
name The name used to access the virtual filesystem
Definition at line 6 of file USBLocalFileSystem.cpp.
USBLocalFileSystem | ( | PinName | mosi, |
PinName | miso, | ||
PinName | sclk, | ||
PinName | cs, | ||
const char * | name = "local" |
||
) |
Create the Local File System for accessing an SD Card using SPI.
- Parameters:
-
mosi SPI mosi pin connected to SD Card miso SPI miso pin conencted to SD Card sclk SPI sclk pin connected to SD Card cs DigitalOut pin used as SD Card chip select name The name used to access the virtual filesystem
Definition at line 12 of file USBLocalFileSystem.cpp.
USBLocalFileSystem | ( | StorageInterface * | storage, |
const char * | name = "local" |
||
) |
Create the Local File System using StorageInterface.
- Parameters:
-
storage StorageInterface name The name used to access the virtual filesystem
Definition at line 19 of file USBLocalFileSystem.cpp.
Member Function Documentation
int getc | ( | ) |
Read a char from the serial port.
- Returns:
- The char read from the serial port
Definition at line 60 of file USBLocalFileSystem.cpp.
int putc | ( | int | c ) |
Write a char to the serial port.
- Parameters:
-
c The char to write
- Returns:
- The written char or -1 if an error occured
Definition at line 65 of file USBLocalFileSystem.cpp.
int puts | ( | const char * | str ) |
Write a string to the serial port.
- Parameters:
-
str The string to write
- Returns:
- 0 if the write succeeds, EOF for error
Definition at line 71 of file USBLocalFileSystem.cpp.
int readable | ( | ) |
Determine if there is a character available to read.
- Returns:
- 1 if there is a character available to read, 0 otherwise
Definition at line 50 of file USBLocalFileSystem.cpp.
int writeable | ( | ) |
Determine if there is space available to write a character.
- Returns:
- 1 if there is space to write a character, 0 otherwise
Definition at line 55 of file USBLocalFileSystem.cpp.
Generated on Tue Jul 12 2022 19:39:32 by
