/
bitlash.h
61 lines (44 loc) · 2.17 KB
/
bitlash.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
/***
bitlash.h
Bitlash is a tiny language interpreter that provides a serial port shell environment
for bit banging and hardware hacking.
This is the Bitlash library for Arduino 0014.
Bitlash lives at: http://bitlash.net
The author can be reached at: bill@bitlash.net
Copyright (C) 2008, 2009 Bill Roy
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
***/
///////////////////////
// Start Bitlash, and give it cycles to do stuff
//
void initBitlash(unsigned long baud); // start up and set baud rate
void runBitlash(void); // call this in loop(), frequently
///////////////////////
// Pass a command to Bitlash for interpretation
//
void doCommand(char *); // execute a command from your sketch
///////////////////////
// Access to Numeric Variables
//
// NOTE: access to variables a..z is via an index 0..25, not the variable names. Got it?
//
typedef long int numvar; // bitlash returns things of type numvar
typedef unsigned long int unumvar; // sometimes unsigned interpretation is best (like millis)
numvar getVar(unsigned char); // return value of bitlash variable. id is [0..25] for [a..z]
void assignVar(unsigned char, numvar); // assign value to variable. id is [0..25] for [a..z]
numvar incVar(unsigned char); // increment variable. id is [0..25] for [a..z]
///////////////////////
// Access to the Bitlash EEPROM key:value store
//
// Lookup key in EEPROM and return the location of its value
int getValue(char *key); // return location of macro value in EEPROM or -1