Modmata
v0
An arduino communications server using Modbus
|
Base class for a host computer to control this (LattePanda's Arduino Leonardo) device. More...
#include <Modmata.h>
Public Member Functions | |
void | begin (int baud) |
Begin listening for a Modmata connection over serial/USB. More... | |
void | attach (uint8_t command, struct registers(*fn)(uint8_t argc, uint8_t *argv)) |
Assign a function to a command number. Standard commands have default functions, but those can be overwritten here, or more commands can be added. More... | |
void | processInput () |
Read the command and args sent and execute the corresponding callback function, store the results of which in holding functions to be communicated with the host. | |
bool | available () |
Private Attributes | |
struct registers(* | callbackFunctions [100])(uint8_t argc, uint8_t *argv) |
An array of references to callback functions indexed by their function code number. Use 'Modmata.attach( function_code, &function )' to add your own callback functions. | |
ModbusSerial | mb |
Object representing an interactive Modbus connection over Serial. | |
Base class for a host computer to control this (LattePanda's Arduino Leonardo) device.
void ModmataClass::attach | ( | uint8_t | command, |
struct registers(*)(uint8_t argc, uint8_t *argv) | fn | ||
) |
Assign a function to a command number. Standard commands have default functions, but those can be overwritten here, or more commands can be added.
command | The modbus command being assigned a function |
fn | A pointer to the function to be called when the command is recieved |
Definition at line 69 of file Modmata.cpp.
References callbackFunctions.
bool ModmataClass::available | ( | ) |
Update modbus registers and check if a command has been received
Definition at line 121 of file Modmata.cpp.
References mb.
void ModmataClass::begin | ( | int | baud | ) |
Begin listening for a Modmata connection over serial/USB.
baud | Set the baud rate of the listening serial connection |
Definition at line 31 of file Modmata.cpp.
References callbackFunctions, and mb.