/*----------------------------------------------------------------------------- * Author: Nelso G. Jost (nelsojost@gmail.com) * License: GPLv2 * Purpose: Provide basic GPIO control commands for the REPL. *---------------------------------------------------------------------------*/ #ifndef REPL_GPIO_H #define REPL_GPIO_H #define CMD_REPL_DWRITE {\ "dwrite", REPL_DWRITE, "dwrite ",\ "Perform pinMode(pin, OUTPUT) and digitalWrite(pin, value)."} #define CMD_REPL_AWRITE {\ "awrite", REPL_AWRITE, "awrite ",\ "Perform analogWrite(pin, value) with 0 <= PWM value <= 255 (duty cycle)."} #define CMD_REPL_AREAD {\ "aread", REPL_AREAD, "aread ", \ "Perform analogRead(pin)"} #define CMD_REPL_DREAD {\ "dread", REPL_DREAD, "dread ", \ "Perform digitalRead(pin)"} #define CMD_REPL_LOG {\ "log", REPL_LOG, "log ", \ "Start logging a pin reading with given interval (in seconds). " \ "Pin must be aX (analog) or dX (digital) where X is an integer."} #define CMD_REPL_BLINK {\ "blink", REPL_BLINK, "blink ", \ "Blink builtin led (pin 2) with given in seconds (int|float). " \ "Use \"blink 0\" to stop it."} #define ALLCMD_REPL_GPIO \ CMD_REPL_DWRITE, \ CMD_REPL_AWRITE, \ CMD_REPL_AREAD, \ CMD_REPL_DREAD, \ CMD_REPL_LOG, \ CMD_REPL_BLINK void REPL_DWRITE(REPL * repl); void REPL_AWRITE(REPL * repl); void REPL_AREAD(REPL * repl); void REPL_DREAD(REPL * repl); void REPL_LOG(REPL * repl); void REPL_BLINK(REPL * repl); #endif