1
0
mirror of https://github.com/taigrr/arduinolibs synced 2025-01-18 04:33:12 -08:00

Memory-efficient encapsulation of command arguments

This commit is contained in:
Rhys Weatherley
2016-03-11 20:46:13 +10:00
parent 57fb8f2fe3
commit c24e67c63d
4 changed files with 154 additions and 55 deletions

View File

@@ -10,7 +10,7 @@ int ledPin = 13;
Shell shell;
void cmdLed(Shell &shell, int argc, char *argv[])
void cmdLed(Shell &shell, int argc, const ShellArguments &argv)
{
if (argc > 1 && !strcmp(argv[1], "on"))
digitalWrite(ledPin, HIGH);

View File

@@ -21,7 +21,7 @@ bool haveClient = false;
Shell shell;
void cmdLed(Shell &shell, int argc, char *argv[])
void cmdLed(Shell &shell, int argc, const ShellArguments &argv)
{
if (argc > 1 && !strcmp(argv[1], "on"))
digitalWrite(ledPin, HIGH);
@@ -29,7 +29,7 @@ void cmdLed(Shell &shell, int argc, char *argv[])
digitalWrite(ledPin, LOW);
}
void cmdExit(Shell &shell, int argc, char *argv[])
void cmdExit(Shell &shell, int argc, const ShellArguments &argv)
{
client.stop();
}