Skip to content

Commit 5d21d48

Browse files
committed
LCD rework, syncing sketches
1 parent 582620a commit 5d21d48

File tree

145 files changed

+4575
-14380
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

145 files changed

+4575
-14380
lines changed

Mpe/I2CPIR/I2CPIR.ino

+114-142
Large diffs are not rendered by default.

Mpe/i2c_all/i2c_all.ino

+11-11
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ PortI2C i2cbus (1); /* Virtual I2C bus at JeeNode Port 1*/
2323
/** LCD 16x2 Character Display at 8bit I2C I/O expander (PCF8574 compatible) */
2424
#define I2C_ADDR 0x20
2525
#define BACKLIGHT_PIN 7
26-
#define En_pin 4
26+
#define En_pin 6
2727
#define Rw_pin 5
28-
#define Rs_pin 6
28+
#define Rs_pin 4
2929
#define D4_pin 0
3030
#define D5_pin 1
3131
#define D6_pin 2
@@ -185,7 +185,7 @@ void setup()
185185
Serial.begin(57600);
186186
Serial.println("I2C_ALL");
187187

188-
lux_init();
188+
//lux_init();
189189
i2c_lcd_init();
190190
//exp_setup();
191191
}
@@ -194,7 +194,7 @@ void loop()
194194
{
195195
//cycle_dimmer();
196196
//cycle_expander();
197-
cycle_lux();
197+
//cycle_lux();
198198

199199
//Wire.beginTransmission(address);
200200
//Wire.send(REGISTER_CONFIG);
@@ -222,13 +222,13 @@ void loop()
222222
need to a second or so wait after changing the gain
223223
see http://talk.jeelabs.net/topic/608
224224
*/
225-
if (lux_value < 1000) {
226-
highGain = 1;
227-
}
228-
else {
229-
highGain = 0;
230-
}
231-
lux.setGain(highGain);
225+
// if (lux_value < 1000) {
226+
// highGain = 1;
227+
// }
228+
// else {
229+
// highGain = 0;
230+
// }
231+
// lux.setGain(highGain);
232232

233233
delay(1000);
234234
}

Prototype/AtmegaEEPROM/AtmegaEEPROM.ino

+147-47
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
/*
22
Atmega EEPROM routines */
3-
#include <OneWire.h>
4-
#include <DotmpeLib.h>
5-
#include <EEPROM.h>
63

74

85
/* *** Globals and sketch configuration *** */
9-
#define DEBUG 1 /* Enable trace statements */
106
#define SERIAL 1 /* Enable serial */
7+
#define DEBUG 1 /* Enable trace statements */
118

129
#define MAXLENLINE 79
1310

11+
#include <OneWire.h>
12+
#include <DotmpeLib.h>
13+
#include <EEPROM.h>
14+
15+
1416

1517
const String sketch = "X-AtmegaEEPROM";
1618
const int version = 0;
@@ -19,15 +21,33 @@ char node[] = "nx";
1921
// determined upon handshake
2022
char node_id[7];
2123

22-
23-
static int tick = 0;
24-
static int pos = 0;
24+
/* IO pins */
25+
// RXD 0
26+
// TXD 1
27+
// INT0 2
28+
// MOSI 11
29+
// MISO 12
30+
//# define _DBG_LED 13 // SCK
2531

2632

2733
MpeSerial mpeser (57600);
2834

35+
/* *** InputParser *** {{{ */
36+
2937
extern InputParser::Commands cmdTab[] PROGMEM;
30-
InputParser parser (50, cmdTab);
38+
byte* buffer = (byte*) malloc(50);
39+
InputParser parser (buffer, 50, cmdTab);
40+
41+
42+
/* *** /InputParser }}} *** */
43+
44+
/* *** Report variables *** {{{ */
45+
46+
/* *** /Report variables }}} *** */
47+
48+
/* *** Scheduled tasks *** {{{ */
49+
50+
/* *** /Scheduled tasks }}} *** */
3151

3252
/* *** EEPROM config *** {{{ */
3353

@@ -90,16 +110,99 @@ void writeConfig(Config &c)
90110
}
91111
}
92112

93-
/* }}} *** */
94113

114+
/* *** /EEPROM config }}} *** */
95115

116+
/* *** Peripheral devices *** {{{ */
96117

118+
#if LDR_PORT
119+
#endif
97120

98-
/* }}} *** */
121+
#if _DHT
122+
#endif // DHT
123+
124+
#if _LCD84x48
125+
#endif // LCD84x48
126+
127+
#if _DS
128+
#endif // DS
129+
130+
#if _NRF24
131+
/* nRF24L01+: nordic 2.4Ghz digital radio */
132+
133+
#endif // NRF24
134+
135+
#if _RTC
136+
#endif //_RTC
137+
138+
#if _HMC5883L
139+
/* Digital magnetometer I2C module */
140+
141+
#endif // HMC5883L
142+
143+
144+
/* *** /Peripheral devices }}} *** */
145+
146+
/* *** UI *** {{{ */
147+
148+
149+
150+
151+
152+
153+
/* *** /UI }}} *** */
99154

100155
/* *** Peripheral hardware routines *** {{{ */
101156

102-
/* }}} *** */
157+
#if LDR_PORT
158+
#endif
159+
160+
/* *** PIR support *** {{{ */
161+
#if PIR_PORT
162+
#endif
163+
/* *** /PIR support *** }}} */
164+
165+
166+
#if _DHT
167+
/* DHT temp/rh sensor
168+
- AdafruitDHT
169+
*/
170+
171+
#endif // DHT
172+
173+
#if _RFM12B
174+
/* HopeRF RFM12B 868Mhz digital radio */
175+
176+
#endif //_RFM12B
177+
178+
#if _LCD84x48
179+
180+
181+
#endif // LCD84x48
182+
183+
#if _DS
184+
/* Dallas DS18B20 thermometer routines */
185+
186+
187+
#endif // DS
188+
189+
#if _NRF24
190+
/* Nordic nRF24L01+ radio routines */
191+
192+
193+
#endif // NRF24 funcs
194+
195+
#if _RTC
196+
#endif //_RTC
197+
198+
#if _HMC5883L
199+
/* Digital magnetometer I2C routines */
200+
201+
202+
#endif // HMC5883L
203+
204+
205+
/* *** /Peripheral hardware routines }}} *** */
103206

104207
/* *** Initialization routines *** {{{ */
105208

@@ -116,51 +219,24 @@ void initLibs()
116219
}
117220

118221

119-
/* }}} *** */
120-
121-
/* Initialization routines *** {{{ */
122-
123-
124-
void helpCmd() {
125-
Serial.println("Help!");
126-
}
127-
128-
void handshakeCmd() {
129-
int v;
130-
char buf[7];
131-
node.toCharArray(buf, 7);
132-
parser >> v;
133-
sprintf(node_id, "%s%i", buf, v);
134-
Serial.print("handshakeCmd:");
135-
Serial.println(node_id);
136-
serialFlush();
137-
}
138-
139-
InputParser::Commands cmdTab[] = {
140-
{ 'h', 0, helpCmd },
141-
{ 'A', 0, handshakeCmd }
142-
};
143-
144-
145-
146-
/* }}} *** */
222+
/* *** /Initialization routines *** }}} */
147223

148224
/* *** Run-time handlers *** {{{ */
149225

150-
151226
void doReset(void)
152227
{
153-
tick = 0;
154-
155228
doConfig();
156229

230+
tick = 0;
231+
157232
}
158233

159234
bool doAnnounce()
160235
{
161236
/* see CarrierCase */
162237
#if SERIAL && DEBUG
163238
#endif // SERIAL && DEBUG
239+
return false;
164240
}
165241

166242
// readout all the sensors and other values
@@ -174,12 +250,33 @@ void runScheduler(char task)
174250
}
175251
}
176252

177-
/* }}} *** */
178253

179-
/* InputParser handlers {{{ */
254+
/* *** /Run-time handlers }}} *** */
180255

256+
/* *** InputParser handlers *** {{{ */
181257

182-
/* }}} *** */
258+
void helpCmd() {
259+
Serial.println("Help!");
260+
}
261+
262+
void handshakeCmd() {
263+
int v;
264+
char buf[7];
265+
node.toCharArray(buf, 7);
266+
parser >> v;
267+
sprintf(node_id, "%s%i", buf, v);
268+
Serial.print("handshakeCmd:");
269+
Serial.println(node_id);
270+
serialFlush();
271+
}
272+
273+
InputParser::Commands cmdTab[] = {
274+
{ 'h', 0, helpCmd },
275+
{ 'A', 0, handshakeCmd }
276+
};
277+
278+
279+
/* *** /InputParser handlers }}} *** */
183280

184281
/* *** Main *** {{{ */
185282

@@ -188,7 +285,11 @@ void setup(void)
188285
{
189286
#if SERIAL
190287
mpeser.begin();
191-
mpeser.startAnnounce(sketch, String(version));
288+
mpeser.startAnnounce(sketch, version);
289+
#if DEBUG || _MEM
290+
Serial.print("Free RAM: ");
291+
Serial.println(freeRam());
292+
#endif
192293
serialFlush();
193294
#endif
194295

@@ -204,6 +305,5 @@ void loop(void)
204305
//runScheduler(task);
205306
}
206307

207-
208308
/* }}} *** */
209309

Prototype/AtmegaSRAM/AtmegaSRAM.ino

+2-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
/* AtmegaSRAM - measure memory usage */
22

33
/** Globals and sketch configuration */
4-
#define DEBUG 1 /* Enable trace statements */
4+
/* *** Globals and sketch configuration *** */
55
#define SERIAL 1 /* Enable serial */
6+
#define DEBUG 1 /* Enable trace statements */
67

78
#define DEBUG_MEASURE 1
89

0 commit comments

Comments
 (0)