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.
Dependencies: EthernetInterface SDFileSystem mbed-rtos mbed
cli.cpp
- Committer:
- micbio
- Date:
- 2016-12-05
- Revision:
- 2:e699312248f3
- Parent:
- 1:58d2021e301d
File content as of revision 2:e699312248f3:
#include "cli.hpp" #define CMD_LENGTH 15 extern Serial pc; void cli_sd::welcome(void) { printf("***********************************************\r\n"); printf("** Welcome to an example application showing **\r\n"); printf("** basic file operations on sd card. **\r\n"); printf("***********************************************\r\n"); } void cli_sd::print_help(void) { pc.printf("List of commands:\r\n"); pc.printf("m : mounts a sd_card\r\n"); pc.printf("p : changes the file to write to\r\n"); pc.printf("w : write to example file\r\n"); pc.printf("a : append to example file\r\n"); pc.printf("r : read text from example file\r\n"); } char cli_sd::get_cmd(void) { char c; while(true) { c = pc.getc(); if (c == 'm' || c == 'p' || c == 'w' || c == 'a' || c == 'r') { break; } else { pc.printf("Unkown command.\r\n"); this->print_help(); } } return c; }