IRremote
|
This is a minimalistic Girs server. It only depends on (a subset of) IRremote. It can be used with IrScrutinizer (select Sending/Capturing hw = Girs Client) as well as Lirc version 0.9.4 and later, using the driver Girs). (Authors of similar software are encourage to implement support.) More...
Go to the source code of this file.
Classes | |
class | Tokenizer |
Our own tokenizer class. More... | |
Macros | |
#define | INPUTPIN 5 |
Input Pin used by the receiver, can be arbitrary (almost...) More... | |
#define | BAUDRATE 115200 |
Baud rate for the serial/USB connection. More... | |
#define | RECEIVE |
Define to support reception of IR. More... | |
#define | TRANSMIT |
Define to support transmission of IR signals. More... | |
#define | EOLCHAR '\r' |
Character that ends the command lines. More... | |
#define | modulesSupported "base transmit receive" |
The modules supported, as given by the "modules" command. More... | |
#define | PROGNAME "MicroGirs" |
Name of program, as reported by the "version" command. More... | |
#define | VERSION "2020-07-05" |
Version of program, as reported by the "version" command. More... | |
#define | okString "OK" |
#define | errorString "ERROR" |
#define | timeoutString "." |
Typedefs | |
typedef unsigned | frequency_t |
Type used for modulation frequency in Hz (not kHz). More... | |
typedef unsigned | microseconds_t |
Type used for durations in micro seconds. More... | |
Functions | |
static unsigned | hz2khz (frequency_t hz) |
static void | sendRaw (const microseconds_t intro[], unsigned lengthIntro, const microseconds_t repeat[], unsigned lengthRepeat, const microseconds_t ending[], unsigned lengthEnding, frequency_t frequency, unsigned times) |
Transmits the IR signal given as argument. More... | |
static void | receive (Stream &stream) |
Reads a command from the stream given as argument. More... | |
static void | dump (Stream &stream, decode_results *results) |
void | setup () |
Initialization. More... | |
static String | readCommand (Stream &stream) |
static void | processCommand (const String &line, Stream &stream) |
void | loop () |
Reads a command from the serial line and executes it-. More... | |
Variables | |
static const microseconds_t | DUMMYENDING = 40000U |
static const frequency_t | FREQUENCY_T_MAX = UINT16_MAX |
static const frequency_t | MICROSECONDS_T_MAX = UINT16_MAX |
IRrecv | irRecv (INPUTPIN) |
Instance of the IRremote class. More... | |
IRsend | irSend |
This is a minimalistic Girs server. It only depends on (a subset of) IRremote. It can be used with IrScrutinizer (select Sending/Capturing hw = Girs Client) as well as Lirc version 0.9.4 and later, using the driver Girs). (Authors of similar software are encourage to implement support.)
It runs on all hardware on which IRemote runs.
It consists of an interactive IR server, taking one-line commands from the "user" (which is typically not a person but another program), and responds with a one-line response. In the language of the Girs specifications, the modules "base", receive, and transmit are implemented. (The two latter can be disabled by not defining two corresponding CPP symbols.)
It understands the following commands:
The "version" command returns the program name and version, The "modules" command returns the modules implemented, normally base, receive and transmit. The "receive" command reads an IR signal using the used, demodulating IR sensor. The "send" commands transmits a supplied raw signal the requested number of times.
Only the first character of the command is evaluated in this implementation.
The "receive" command returns the received IR sequence as a sequence of durations, including a (dummy) trailing silence. On-periods ("marks", "flashes") are prefixed by "+", while off-periods ("spaces", "gaps") are prefixed by "-". The present version never times out.
The send
command takes the following parameters:
send noSends frequencyHz introLength repeatLength endingLength durations...
where
Semantics: first the intro sequence will be sent once (i.e., the first repeatLength durations) (if non-empty). Then the repeat sequence will be sent (noSends-1) times, unless the intro sequence was empty, in which case it will be send noSends times. Finally, the ending sequence will be send once (if non-empty).
Weaknesses of the IRremote implementation:
For minimal footprint, undefine all DECODE* and SEND_* in IRremote.h.
For optimal results, try for example to set _GAP to 100000 (what a brilliant variable name!!) and RAW_BUFFER_LENGTH to 251 in IRremoteInt.h.
Definition in file MicroGirs.ino.
#define BAUDRATE 115200 |
Baud rate for the serial/USB connection.
(115200 is the default for IrScrutinizer and Lirc.)
Definition at line 83 of file MicroGirs.ino.
#define EOLCHAR '\r' |
Character that ends the command lines.
Do not change unless you known what you are doing. IrScrutinizer and Lirc expects \r.
Definition at line 104 of file MicroGirs.ino.
#define errorString "ERROR" |
Definition at line 136 of file MicroGirs.ino.
#define INPUTPIN 5 |
Input Pin used by the receiver, can be arbitrary (almost...)
Definition at line 77 of file MicroGirs.ino.
#define modulesSupported "base transmit receive" |
The modules supported, as given by the "modules" command.
Definition at line 113 of file MicroGirs.ino.
#define okString "OK" |
Definition at line 135 of file MicroGirs.ino.
#define PROGNAME "MicroGirs" |
Name of program, as reported by the "version" command.
Definition at line 128 of file MicroGirs.ino.
#define RECEIVE |
Define to support reception of IR.
Definition at line 91 of file MicroGirs.ino.
#define timeoutString "." |
Definition at line 137 of file MicroGirs.ino.
#define TRANSMIT |
Define to support transmission of IR signals.
Definition at line 96 of file MicroGirs.ino.
#define VERSION "2020-07-05" |
Version of program, as reported by the "version" command.
Definition at line 133 of file MicroGirs.ino.
typedef unsigned frequency_t |
Type used for modulation frequency in Hz (not kHz).
Definition at line 144 of file MicroGirs.ino.
typedef unsigned microseconds_t |
Type used for durations in micro seconds.
Definition at line 149 of file MicroGirs.ino.
|
static |
Definition at line 300 of file MicroGirs.ino.
|
inlinestatic |
Definition at line 248 of file MicroGirs.ino.
void loop | ( | ) |
Reads a command from the serial line and executes it-.
Definition at line 404 of file MicroGirs.ino.
|
static |
Definition at line 345 of file MicroGirs.ino.
|
static |
Definition at line 336 of file MicroGirs.ino.
|
static |
Reads a command from the stream given as argument.
stream | Stream to read from, typically Serial. |
Definition at line 288 of file MicroGirs.ino.
|
static |
Transmits the IR signal given as argument.
The intro sequence (possibly empty) is first sent. Then the repeat signal (also possibly empty) is sent, "times" times, except for the case of the intro signal being empty, in which case it is sent "times" times. Finally the ending sequence (possibly empty) is sent.
intro | Sequence to be sent exactly once at the start. |
lengthIntro | Number of durations in intro sequence, must be even. |
repeat | Sequence top possibly be sent multiple times |
lengthRepeat | Number of durations in repeat sequence. |
ending | Sequence to be sent at the end, possibly empty |
lengthEnding | Number of durations in ending sequence |
frequency | Modulation frequency, in Hz (not kHz as normally in IRremote) |
times | Number of times to send the signal, in the sense above. |
Definition at line 269 of file MicroGirs.ino.
void setup | ( | ) |
Initialization.
Definition at line 318 of file MicroGirs.ino.
|
static |
Definition at line 151 of file MicroGirs.ino.
|
static |
Definition at line 152 of file MicroGirs.ino.
IRsend irSend |
Definition at line 166 of file MicroGirs.ino.
|
static |
Definition at line 153 of file MicroGirs.ino.