atduskgreg-rad 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- data/History.txt +104 -0
- data/License.txt +282 -0
- data/Manifest.txt +142 -0
- data/README.rdoc +55 -0
- data/Rakefile +142 -0
- data/bin/hello_world_test/Makefile +436 -0
- data/bin/hello_world_test/hello_world.cpp +23 -0
- data/bin/rad +302 -0
- data/lib/examples/add_hysteresis.rb +13 -0
- data/lib/examples/basic_blink.rb +10 -0
- data/lib/examples/blink_m_address_assignment.rb +104 -0
- data/lib/examples/blink_m_hello.rb +14 -0
- data/lib/examples/blink_m_multi.rb +61 -0
- data/lib/examples/blink_with_serial.rb +16 -0
- data/lib/examples/configure_pa_lcd_boot.rb +91 -0
- data/lib/examples/debounce_methods.rb +49 -0
- data/lib/examples/external_variable_fu.rb +26 -0
- data/lib/examples/external_variables.rb +32 -0
- data/lib/examples/first_sound.rb +23 -0
- data/lib/examples/frequency_generator.rb +30 -0
- data/lib/examples/hello_array.rb +48 -0
- data/lib/examples/hello_array2.rb +79 -0
- data/lib/examples/hello_array_eeprom.rb +59 -0
- data/lib/examples/hello_clock.rb +84 -0
- data/lib/examples/hello_eeprom.rb +51 -0
- data/lib/examples/hello_eeprom_lcdpa.rb +81 -0
- data/lib/examples/hello_format_print.rb +94 -0
- data/lib/examples/hello_lcd_charset.rb +75 -0
- data/lib/examples/hello_pa_lcd.rb +59 -0
- data/lib/examples/hello_servos.rb +88 -0
- data/lib/examples/hello_spectra_sound.rb +38 -0
- data/lib/examples/hello_world.rb +11 -0
- data/lib/examples/hello_xbee.rb +12 -0
- data/lib/examples/hysteresis_duel.rb +39 -0
- data/lib/examples/i2c_with_clock_chip.rb +124 -0
- data/lib/examples/midi_beat_box.rb +86 -0
- data/lib/examples/midi_scales.rb +94 -0
- data/lib/examples/motor_knob.rb +30 -0
- data/lib/examples/servo_buttons.rb +23 -0
- data/lib/examples/servo_calibrate_continuous.rb +92 -0
- data/lib/examples/servo_throttle.rb +40 -0
- data/lib/examples/software_serial.rb +10 -0
- data/lib/examples/sparkfun_lcd.rb +48 -0
- data/lib/examples/spectra_soft_pot.rb +34 -0
- data/lib/examples/times_method.rb +8 -0
- data/lib/examples/toggle.rb +10 -0
- data/lib/examples/twitter.rb +57 -0
- data/lib/examples/two_wire.rb +14 -0
- data/lib/libraries/AFSoftSerial/AFSoftSerial.cpp +321 -0
- data/lib/libraries/AFSoftSerial/AFSoftSerial.h +61 -0
- data/lib/libraries/AFSoftSerial/keywords.txt +18 -0
- data/lib/libraries/AF_XPort/AF_XPort.cpp +166 -0
- data/lib/libraries/AF_XPort/AF_XPort.h +48 -0
- data/lib/libraries/DS1307/DS1307.cpp +162 -0
- data/lib/libraries/DS1307/DS1307.h +66 -0
- data/lib/libraries/DS1307/keywords.txt +18 -0
- data/lib/libraries/FrequencyTimer2/FrequencyTimer2.cpp +144 -0
- data/lib/libraries/FrequencyTimer2/FrequencyTimer2.h +42 -0
- data/lib/libraries/FrequencyTimer2/keywords.txt +22 -0
- data/lib/libraries/I2CEEPROM/I2CEEPROM.cpp +120 -0
- data/lib/libraries/I2CEEPROM/I2CEEPROM.h +70 -0
- data/lib/libraries/I2CEEPROM/keywords.txt +21 -0
- data/lib/libraries/LoopTimer/LoopTimer.cpp +35 -0
- data/lib/libraries/LoopTimer/LoopTimer.h +34 -0
- data/lib/libraries/LoopTimer/keywords.txt +27 -0
- data/lib/libraries/OneWire/OneWire.cpp +194 -0
- data/lib/libraries/OneWire/OneWire.h +63 -0
- data/lib/libraries/OneWire/keywords.txt +35 -0
- data/lib/libraries/OneWire/readme.txt +13 -0
- data/lib/libraries/SWSerLCDpa/SWSerLCDpa.cpp +296 -0
- data/lib/libraries/SWSerLCDpa/SWSerLCDpa.h +69 -0
- data/lib/libraries/SWSerLCDsf/SWSerLCDsf.cpp +311 -0
- data/lib/libraries/SWSerLCDsf/SWSerLCDsf.h +67 -0
- data/lib/libraries/Servo/Servo.cpp +192 -0
- data/lib/libraries/Servo/Servo.h +61 -0
- data/lib/libraries/Stepper/Stepper.cpp +220 -0
- data/lib/libraries/Stepper/Stepper.h +86 -0
- data/lib/libraries/Stepper/keywords.txt +28 -0
- data/lib/libraries/Wire/Wire.cpp +262 -0
- data/lib/libraries/Wire/Wire.h +67 -0
- data/lib/libraries/Wire/keywords.txt +31 -0
- data/lib/libraries/Wire/twi.h +57 -0
- data/lib/libraries/Wire/utility/twi.c +449 -0
- data/lib/libraries/Wire/utility/twi.h +57 -0
- data/lib/plugins/bitwise_ops.rb +54 -0
- data/lib/plugins/blink.rb +25 -0
- data/lib/plugins/blink_m.rb +356 -0
- data/lib/plugins/debounce.rb +138 -0
- data/lib/plugins/debug_output_to_lcd.rb +71 -0
- data/lib/plugins/hysteresis.rb +52 -0
- data/lib/plugins/input_output_state.rb +84 -0
- data/lib/plugins/lcd_padding.rb +58 -0
- data/lib/plugins/mem_test.rb +37 -0
- data/lib/plugins/midi.rb +60 -0
- data/lib/plugins/parallax_ping.rb +50 -0
- data/lib/plugins/servo_pulse.rb +31 -0
- data/lib/plugins/servo_setup.rb +86 -0
- data/lib/plugins/smoother.rb +54 -0
- data/lib/plugins/spark_fun_serial_lcd.rb +100 -0
- data/lib/plugins/spectra_symbol.rb +79 -0
- data/lib/plugins/twitter_connect.rb +145 -0
- data/lib/rad.rb +5 -0
- data/lib/rad/README.rdoc +5 -0
- data/lib/rad/arduino_plugin.rb +246 -0
- data/lib/rad/arduino_sketch.rb +627 -0
- data/lib/rad/generators/makefile/makefile.erb +243 -0
- data/lib/rad/generators/makefile/makefile.rb +38 -0
- data/lib/rad/hardware_library.rb +813 -0
- data/lib/rad/init.rb +14 -0
- data/lib/rad/progressbar.rb +236 -0
- data/lib/rad/rad_processor.rb +128 -0
- data/lib/rad/rad_rewriter.rb +94 -0
- data/lib/rad/rad_type_checker.rb +26 -0
- data/lib/rad/sim/arduino_sketch.rb +57 -0
- data/lib/rad/sketch_compiler.rb +47 -0
- data/lib/rad/tasks/build_and_make.rake +210 -0
- data/lib/rad/tasks/rad.rb +2 -0
- data/lib/rad/todo.txt +13 -0
- data/lib/rad/variable_processing.rb +153 -0
- data/lib/rad/version.rb +9 -0
- data/scripts/txt2html +67 -0
- data/setup.rb +1585 -0
- data/spec/examples/hello_world.rb +11 -0
- data/spec/examples/serial_motor.rb +12 -0
- data/spec/models/arduino_sketch_spec.rb +82 -0
- data/spec/models/sketch_compiler_spec.rb +96 -0
- data/spec/models/spec_helper.rb +2 -0
- data/spec/sim/hello_world_spec.rb +42 -0
- data/spec/spec.opts +1 -0
- data/test/test_array_processing.rb +179 -0
- data/test/test_plugin_loading.rb +151 -0
- data/test/test_translation_post_processing.rb +185 -0
- data/test/test_variable_processing.rb +238 -0
- data/website/examples/assembler_test.rb.html +73 -0
- data/website/examples/gps_reader.rb.html +39 -0
- data/website/examples/hello_world.rb.html +38 -0
- data/website/examples/serial_motor.rb.html +41 -0
- data/website/index.html +178 -0
- data/website/index.txt +64 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +169 -0
- data/website/template.rhtml +48 -0
- metadata +217 -0
@@ -0,0 +1,63 @@
|
|
1
|
+
#ifndef OneWire_h
|
2
|
+
#define OneWire_h
|
3
|
+
|
4
|
+
#include <inttypes.h>
|
5
|
+
|
6
|
+
// you can exclude onewire_search by defining that to 0
|
7
|
+
#ifndef ONEWIRE_SEARCH
|
8
|
+
#define ONEWIRE_SEARCH 0
|
9
|
+
#endif
|
10
|
+
|
11
|
+
// You can exclude onewire_crc16 by defining that to 0
|
12
|
+
#ifndef ONEWIRE_CRC16
|
13
|
+
#define ONEWIRE_CRC16 0
|
14
|
+
#endif
|
15
|
+
|
16
|
+
class OneWire
|
17
|
+
{
|
18
|
+
private:
|
19
|
+
uint8_t pin;
|
20
|
+
uint8_t port;
|
21
|
+
uint8_t bitmask;
|
22
|
+
volatile uint8_t *outputReg;
|
23
|
+
volatile uint8_t *inputReg;
|
24
|
+
volatile uint8_t *modeReg;
|
25
|
+
|
26
|
+
public:
|
27
|
+
OneWire( uint8_t pin);
|
28
|
+
|
29
|
+
// Perform a 1-Wire reset cycle. Returns 1 if a device responds
|
30
|
+
// with a presence pulse. Returns 0 if there is no device or the
|
31
|
+
// bus is shorted or otherwise held low for more than 250uS
|
32
|
+
uint8_t reset();
|
33
|
+
|
34
|
+
// Issue a 1-Wire rom skip command, to address all on bus.
|
35
|
+
void skip();
|
36
|
+
|
37
|
+
// Write a byte. If 'power' is one then the wire is held high at
|
38
|
+
// the end for parasitically powered devices. You are responsible
|
39
|
+
// for eventually depowering it by calling depower() or doing
|
40
|
+
// another read or write.
|
41
|
+
void write( uint8_t v, uint8_t power = 0);
|
42
|
+
|
43
|
+
// Read a byte.
|
44
|
+
uint8_t read();
|
45
|
+
|
46
|
+
// Write a bit. The bus is always left powered at the end, see
|
47
|
+
// note in write() about that.
|
48
|
+
void write_bit( uint8_t v);
|
49
|
+
|
50
|
+
// Read a bit.
|
51
|
+
uint8_t read_bit();
|
52
|
+
|
53
|
+
// Stop forcing power onto the bus. You only need to do this if
|
54
|
+
// you used the 'power' flag to write() or used a write_bit() call
|
55
|
+
// and aren't about to do another read or write. You would rather
|
56
|
+
// not leave this powered if you don't have to, just in case
|
57
|
+
// someone shorts your bus.
|
58
|
+
void depower();
|
59
|
+
|
60
|
+
|
61
|
+
};
|
62
|
+
|
63
|
+
#endif
|
@@ -0,0 +1,35 @@
|
|
1
|
+
#######################################
|
2
|
+
# Syntax Coloring Map For OneWire
|
3
|
+
#######################################
|
4
|
+
|
5
|
+
#######################################
|
6
|
+
# Datatypes (KEYWORD1)
|
7
|
+
#######################################
|
8
|
+
|
9
|
+
OneWire KEYWORD1
|
10
|
+
|
11
|
+
#######################################
|
12
|
+
# Methods and Functions (KEYWORD2)
|
13
|
+
#######################################
|
14
|
+
|
15
|
+
reset KEYWORD2
|
16
|
+
write_bit KEYWORD2
|
17
|
+
read_bit KEYWORD2
|
18
|
+
write KEYWORD2
|
19
|
+
read KEYWORD2
|
20
|
+
select KEYWORD2
|
21
|
+
skip KEYWORD2
|
22
|
+
depower KEYWORD2
|
23
|
+
reset_search KEYWORD2
|
24
|
+
search KEYWORD2
|
25
|
+
crc8 KEYWORD2
|
26
|
+
crc16 KEYWORD2
|
27
|
+
|
28
|
+
#######################################
|
29
|
+
# Instances (KEYWORD2)
|
30
|
+
#######################################
|
31
|
+
|
32
|
+
|
33
|
+
#######################################
|
34
|
+
# Constants (LITERAL1)
|
35
|
+
#######################################
|
@@ -0,0 +1,13 @@
|
|
1
|
+
See:
|
2
|
+
http://www.arduino.cc/playground/Learning/OneWire
|
3
|
+
http://www.federated.com/~jim/onewire/
|
4
|
+
|
5
|
+
The version of the OneWire library at federated.com works with arduino-0007.
|
6
|
+
The version here works with arduino-0008, thanks to the very helpful Jim Studt.
|
7
|
+
|
8
|
+
To use, make a new directory: arduino-0008/lib/targets/libraries/OneWire/
|
9
|
+
and put OneWire.cpp, OneWire.h and keywords.txt in it.
|
10
|
+
|
11
|
+
--Josh Larios
|
12
|
+
hades (at) elsewhere (dot) org
|
13
|
+
2007/07/06
|
@@ -0,0 +1,296 @@
|
|
1
|
+
/*
|
2
|
+
SWSerLCDpa.cpp - Software serial to Peter Anderson controller chip based
|
3
|
+
LCD display library Adapted from SoftwareSerial.cpp (c) 2006 David A. Mellis
|
4
|
+
by Brian B. Riley, Underhill Center, Vermont, USA, July 2007
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
8
|
+
License as published by the Free Software Foundation; either
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This library is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
17
|
+
License along with this library; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
/******************************************************************************
|
22
|
+
* Includes
|
23
|
+
******************************************************************************/
|
24
|
+
|
25
|
+
#include "WConstants.h"
|
26
|
+
#include "SWSerLCDpa.h"
|
27
|
+
|
28
|
+
/******************************************************************************
|
29
|
+
* Definitions
|
30
|
+
******************************************************************************/
|
31
|
+
|
32
|
+
/******************************************************************************
|
33
|
+
* Constructors
|
34
|
+
******************************************************************************/
|
35
|
+
|
36
|
+
SWSerLCDpa::SWSerLCDpa(uint8_t transmitPin)
|
37
|
+
{
|
38
|
+
_transmitPin = transmitPin;
|
39
|
+
_baudRate = 0;
|
40
|
+
pinMode(_transmitPin, OUTPUT);
|
41
|
+
_geometry = 0;
|
42
|
+
}
|
43
|
+
|
44
|
+
SWSerLCDpa::SWSerLCDpa(uint8_t transmitPin, int geometry)
|
45
|
+
{
|
46
|
+
_transmitPin = transmitPin;
|
47
|
+
_baudRate = 0;
|
48
|
+
pinMode(_transmitPin, OUTPUT);
|
49
|
+
_geometry = geometry;
|
50
|
+
}
|
51
|
+
|
52
|
+
|
53
|
+
|
54
|
+
/******************************************************************************
|
55
|
+
* User API
|
56
|
+
******************************************************************************/
|
57
|
+
|
58
|
+
void SWSerLCDpa::begin(long speed)
|
59
|
+
{
|
60
|
+
_baudRate = speed;
|
61
|
+
_bitPeriod = 1000000 / _baudRate;
|
62
|
+
|
63
|
+
digitalWrite(_transmitPin, HIGH);
|
64
|
+
delayMicroseconds( _bitPeriod); // if we were low this establishes the end
|
65
|
+
delay(50);
|
66
|
+
if (_geometry)
|
67
|
+
setgeo(_geometry);
|
68
|
+
}
|
69
|
+
|
70
|
+
void SWSerLCDpa::print(uint8_t b)
|
71
|
+
{
|
72
|
+
if (_baudRate == 0)
|
73
|
+
return;
|
74
|
+
|
75
|
+
int bitDelay = _bitPeriod - clockCyclesToMicroseconds(50); // a digitalWrite is about 50 cycles
|
76
|
+
byte mask;
|
77
|
+
|
78
|
+
digitalWrite(_transmitPin, LOW);
|
79
|
+
delayMicroseconds(bitDelay);
|
80
|
+
|
81
|
+
for (mask = 0x01; mask; mask <<= 1) {
|
82
|
+
if (b & mask){ // choose bit
|
83
|
+
digitalWrite(_transmitPin,HIGH); // send 1
|
84
|
+
}
|
85
|
+
else{
|
86
|
+
digitalWrite(_transmitPin,LOW); // send 1
|
87
|
+
}
|
88
|
+
delayMicroseconds(bitDelay);
|
89
|
+
}
|
90
|
+
|
91
|
+
digitalWrite(_transmitPin, HIGH);
|
92
|
+
delayMicroseconds(bitDelay);
|
93
|
+
}
|
94
|
+
|
95
|
+
void SWSerLCDpa::print(const char *s)
|
96
|
+
{
|
97
|
+
while (*s) {
|
98
|
+
print(*s++);
|
99
|
+
delay(2);
|
100
|
+
}
|
101
|
+
}
|
102
|
+
|
103
|
+
void SWSerLCDpa::print(char c)
|
104
|
+
{
|
105
|
+
print((uint8_t) c);
|
106
|
+
}
|
107
|
+
|
108
|
+
void SWSerLCDpa::print(int n)
|
109
|
+
{
|
110
|
+
print((long) n);
|
111
|
+
}
|
112
|
+
|
113
|
+
void SWSerLCDpa::print(unsigned int n)
|
114
|
+
{
|
115
|
+
print((unsigned long) n);
|
116
|
+
}
|
117
|
+
|
118
|
+
void SWSerLCDpa::print(long n)
|
119
|
+
{
|
120
|
+
if (n < 0) {
|
121
|
+
print('-');
|
122
|
+
n = -n;
|
123
|
+
}
|
124
|
+
printNumber(n, 10);
|
125
|
+
}
|
126
|
+
|
127
|
+
void SWSerLCDpa::print(unsigned long n)
|
128
|
+
{
|
129
|
+
printNumber(n, 10);
|
130
|
+
}
|
131
|
+
|
132
|
+
void SWSerLCDpa::print(long n, int base)
|
133
|
+
{
|
134
|
+
if (base == 0)
|
135
|
+
print((char) n);
|
136
|
+
else if (base == 10)
|
137
|
+
print(n);
|
138
|
+
else
|
139
|
+
printNumber(n, base);
|
140
|
+
}
|
141
|
+
|
142
|
+
// -------- PHA unique codes -------------------------
|
143
|
+
|
144
|
+
|
145
|
+
void SWSerLCDpa::clearscr(void)
|
146
|
+
{
|
147
|
+
print("?f");
|
148
|
+
delay(30);
|
149
|
+
}
|
150
|
+
|
151
|
+
void SWSerLCDpa::clearscr(const char *s)
|
152
|
+
{
|
153
|
+
clearscr();
|
154
|
+
print(s);
|
155
|
+
}
|
156
|
+
|
157
|
+
void SWSerLCDpa::clearscr(int n)
|
158
|
+
{
|
159
|
+
clearscr();
|
160
|
+
print(n);
|
161
|
+
}
|
162
|
+
|
163
|
+
void SWSerLCDpa::clearscr(long n, int base)
|
164
|
+
{
|
165
|
+
clearscr();
|
166
|
+
print(n, base);
|
167
|
+
}
|
168
|
+
|
169
|
+
|
170
|
+
void SWSerLCDpa::clearline(int line)
|
171
|
+
{
|
172
|
+
setxy(0,line);
|
173
|
+
print("?l");
|
174
|
+
delay(20);
|
175
|
+
}
|
176
|
+
|
177
|
+
void SWSerLCDpa::clearline(int line, const char *s)
|
178
|
+
{
|
179
|
+
clearline(line);
|
180
|
+
print(s);
|
181
|
+
}
|
182
|
+
|
183
|
+
void SWSerLCDpa::clearline(int line, int n)
|
184
|
+
{
|
185
|
+
clearline(line);
|
186
|
+
print(n);
|
187
|
+
}
|
188
|
+
|
189
|
+
void SWSerLCDpa::clearline(int line, long n, int base)
|
190
|
+
{
|
191
|
+
clearline(line);
|
192
|
+
print(n, base);
|
193
|
+
}
|
194
|
+
|
195
|
+
void SWSerLCDpa::setxy(int x, int y)
|
196
|
+
{
|
197
|
+
print("?y");
|
198
|
+
print(y);
|
199
|
+
print("?x");
|
200
|
+
if (x < 10)
|
201
|
+
print('0');
|
202
|
+
print(x);
|
203
|
+
delay(10);
|
204
|
+
}
|
205
|
+
|
206
|
+
void SWSerLCDpa::setxy(int x, int y, const char *s)
|
207
|
+
{
|
208
|
+
setxy(x,y);
|
209
|
+
print(s);
|
210
|
+
}
|
211
|
+
|
212
|
+
void SWSerLCDpa::setxy(int x, int y, int n)
|
213
|
+
{
|
214
|
+
setxy(x,y);
|
215
|
+
print(n);
|
216
|
+
}
|
217
|
+
|
218
|
+
void SWSerLCDpa::setxy(int x, int y, long n, int base)
|
219
|
+
{
|
220
|
+
setxy(x,y);
|
221
|
+
print(n, base);
|
222
|
+
}
|
223
|
+
|
224
|
+
void SWSerLCDpa::home(void)
|
225
|
+
{
|
226
|
+
print("?a");
|
227
|
+
delay(10);
|
228
|
+
}
|
229
|
+
|
230
|
+
void SWSerLCDpa::home(const char *s)
|
231
|
+
{
|
232
|
+
home();
|
233
|
+
print(s);
|
234
|
+
}
|
235
|
+
|
236
|
+
void SWSerLCDpa::home(int n)
|
237
|
+
{
|
238
|
+
home();
|
239
|
+
print(n);
|
240
|
+
}
|
241
|
+
|
242
|
+
void SWSerLCDpa::home(long n, int base)
|
243
|
+
{
|
244
|
+
home();
|
245
|
+
print(n, base);
|
246
|
+
}
|
247
|
+
|
248
|
+
void SWSerLCDpa::setgeo(int geometry)
|
249
|
+
{
|
250
|
+
print("?G");
|
251
|
+
print(geometry);
|
252
|
+
delay(200);
|
253
|
+
}
|
254
|
+
|
255
|
+
void SWSerLCDpa::setintensity(int intensity)
|
256
|
+
{
|
257
|
+
print("?B");
|
258
|
+
if (intensity < 16)
|
259
|
+
print('0');
|
260
|
+
print(intensity, 16);
|
261
|
+
delay(200);
|
262
|
+
}
|
263
|
+
|
264
|
+
void SWSerLCDpa::intoBignum(void)
|
265
|
+
{
|
266
|
+
print("?>3");
|
267
|
+
}
|
268
|
+
|
269
|
+
void SWSerLCDpa::outofBignum(void)
|
270
|
+
{
|
271
|
+
print("?<");
|
272
|
+
}
|
273
|
+
|
274
|
+
// Private Methods /////////////////////////////////////////////////////////////
|
275
|
+
|
276
|
+
void SWSerLCDpa::printNumber(unsigned long n, uint8_t base)
|
277
|
+
{
|
278
|
+
unsigned char buf[8 * sizeof(long)]; // Assumes 8-bit chars.
|
279
|
+
unsigned long i = 0;
|
280
|
+
|
281
|
+
if (n == 0) {
|
282
|
+
print('0');
|
283
|
+
return;
|
284
|
+
}
|
285
|
+
|
286
|
+
while (n > 0) {
|
287
|
+
buf[i++] = n % base;
|
288
|
+
n /= base;
|
289
|
+
}
|
290
|
+
|
291
|
+
for (; i > 0; i--) {
|
292
|
+
print((char) (buf[i - 1] < 10 ? '0' + buf[i - 1] : 'A' + buf[i - 1] - 10));
|
293
|
+
delay(2);
|
294
|
+
}
|
295
|
+
|
296
|
+
}
|
@@ -0,0 +1,69 @@
|
|
1
|
+
/*
|
2
|
+
SWSerLCDpa.h - Software serial to Peter Anderson controller chip based
|
3
|
+
LCD display library Adapted from SoftwareSerial.cpp (c) 2006 David A. Mellis
|
4
|
+
by Brian B. Riley, Underhill Center, Vermont, USA, July 2007
|
5
|
+
|
6
|
+
This library is free software; you can redistribute it and/or
|
7
|
+
modify it under the terms of the GNU Lesser General Public
|
8
|
+
License as published by the Free Software Foundation; either
|
9
|
+
version 2.1 of the License, or (at your option) any later version.
|
10
|
+
|
11
|
+
This library is distributed in the hope that it will be useful,
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14
|
+
Lesser General Public License for more details.
|
15
|
+
|
16
|
+
You should have received a copy of the GNU Lesser General Public
|
17
|
+
License along with this library; if not, write to the Free Software
|
18
|
+
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
19
|
+
*/
|
20
|
+
|
21
|
+
#ifndef SWSerLCDpa_h
|
22
|
+
#define SWSerLCDpa_h
|
23
|
+
|
24
|
+
#include <inttypes.h>
|
25
|
+
|
26
|
+
class SWSerLCDpa
|
27
|
+
{
|
28
|
+
private:
|
29
|
+
uint8_t _transmitPin;
|
30
|
+
long _baudRate;
|
31
|
+
int _bitPeriod;
|
32
|
+
int _geometry;
|
33
|
+
void printNumber(unsigned long, uint8_t);
|
34
|
+
public:
|
35
|
+
SWSerLCDpa(uint8_t, int);
|
36
|
+
SWSerLCDpa(uint8_t);
|
37
|
+
void begin(long);
|
38
|
+
void print(char);
|
39
|
+
void print(const char[]);
|
40
|
+
void print(uint8_t);
|
41
|
+
void print(int);
|
42
|
+
void print(unsigned int);
|
43
|
+
void print(long);
|
44
|
+
void print(unsigned long);
|
45
|
+
void print(long, int);
|
46
|
+
void clearscr(void);
|
47
|
+
void clearscr(const char[]);
|
48
|
+
void clearscr(int);
|
49
|
+
void clearscr(long, int);
|
50
|
+
void clearline(int);
|
51
|
+
void clearline(int, const char[]);
|
52
|
+
void clearline(int, int);
|
53
|
+
void clearline(int, long, int);
|
54
|
+
void home(void);
|
55
|
+
void home(const char[]);
|
56
|
+
void home(int);
|
57
|
+
void home(long, int);
|
58
|
+
void setxy(int, int);
|
59
|
+
void setxy(int, int, const char[]);
|
60
|
+
void setxy(int, int, int);
|
61
|
+
void setxy(int, int, long, int);
|
62
|
+
void setgeo(int);
|
63
|
+
void setintensity(int);
|
64
|
+
void intoBignum(void);
|
65
|
+
void outofBignum(void);
|
66
|
+
};
|
67
|
+
|
68
|
+
#endif
|
69
|
+
|