periph 1.3.3 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/examples/adc_dac/es8311/complete.js +80 -0
- package/examples/adc_dac/es8311/demo.js +59 -0
- package/examples/adc_dac/es8311/minimal.js +18 -0
- package/examples/adc_dac/mcp4xxx/complete.js +97 -0
- package/examples/adc_dac/mcp4xxx/demo.js +76 -0
- package/examples/adc_dac/mcp4xxx/minimal.js +22 -0
- package/examples/imu/qmi8658a/complete.js +134 -0
- package/examples/imu/qmi8658a/demo.js +81 -0
- package/examples/imu/qmi8658a/minimal.js +22 -0
- package/examples/motor/tmc2130/complete.js +138 -0
- package/examples/motor/tmc2130/demo.js +96 -0
- package/examples/motor/tmc2130/minimal.js +30 -0
- package/examples/motor/tmc2208/complete.js +92 -0
- package/examples/motor/tmc2208/demo.js +85 -0
- package/examples/motor/tmc2208/minimal.js +25 -0
- package/examples/motor/tmc2209/complete.js +106 -0
- package/examples/motor/tmc2209/demo.js +97 -0
- package/examples/motor/tmc2209/minimal.js +25 -0
- package/examples/motor/tmc5160/complete.js +205 -0
- package/examples/motor/tmc5160/demo.js +104 -0
- package/examples/motor/tmc5160/minimal.js +35 -0
- package/examples/power/axp2101/complete.js +135 -0
- package/examples/power/axp2101/demo.js +68 -0
- package/examples/power/axp2101/minimal.js +24 -0
- package/examples/rtc/pcf85063a/complete.js +68 -0
- package/examples/rtc/pcf85063a/demo.js +76 -0
- package/examples/rtc/pcf85063a/minimal.js +20 -0
- package/package.json +1 -1
- package/src/chips/adc_dac/es8311.js +621 -0
- package/src/chips/adc_dac/mcp4xxx.js +982 -0
- package/src/chips/imu/qmi8658a.js +1011 -0
- package/src/chips/motor/tmc2130.js +537 -0
- package/src/chips/motor/tmc2208.js +490 -0
- package/src/chips/motor/tmc2209.js +565 -0
- package/src/chips/motor/tmc5160.js +900 -0
- package/src/chips/power/axp2101.js +968 -0
- package/src/chips/rtc/pcf85063a.js +482 -0
- package/src/connection/uart.js +9 -0
- package/src/connection/uart_mock.js +65 -0
- package/src/discovery/registry.js +25 -0
|
@@ -0,0 +1,482 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const _REG_CONTROL_1 = 0x00;
|
|
4
|
+
const _REG_CONTROL_2 = 0x01;
|
|
5
|
+
const _REG_OFFSET = 0x02;
|
|
6
|
+
const _REG_RAM = 0x03;
|
|
7
|
+
const _REG_SECONDS = 0x04;
|
|
8
|
+
const _REG_SECOND_ALARM = 0x0B;
|
|
9
|
+
const _REG_TIMER_VALUE = 0x10;
|
|
10
|
+
const _REG_TIMER_MODE = 0x11;
|
|
11
|
+
|
|
12
|
+
// Control_1 (0x00) bits.
|
|
13
|
+
const _C1_STOP = 0x20;
|
|
14
|
+
const _C1_SR = 0x10;
|
|
15
|
+
const _C1_CIE = 0x04;
|
|
16
|
+
const _C1_12_24 = 0x02;
|
|
17
|
+
const _C1_CAP_SEL = 0x01;
|
|
18
|
+
|
|
19
|
+
// Control_2 (0x01) bits.
|
|
20
|
+
const _C2_AIE = 0x80;
|
|
21
|
+
const _C2_AF = 0x40;
|
|
22
|
+
const _C2_MI = 0x20;
|
|
23
|
+
const _C2_HMI = 0x10;
|
|
24
|
+
const _C2_TF = 0x08;
|
|
25
|
+
const _C2_COF = 0x07;
|
|
26
|
+
const _C2_FLAGS = 0x48; // AF|TF: write 0 clears, 1 keeps
|
|
27
|
+
|
|
28
|
+
// Timer_mode (0x11) bits.
|
|
29
|
+
const _TM_TCF_MASK = 0x18;
|
|
30
|
+
const _TM_TE = 0x04;
|
|
31
|
+
const _TM_TIE = 0x02;
|
|
32
|
+
const _TM_TI_TP = 0x01;
|
|
33
|
+
|
|
34
|
+
const _SECONDS_OS = 0x80;
|
|
35
|
+
|
|
36
|
+
const _SOURCE_CLOCKS = { '4096hz': 0x00, '64hz': 0x01, '1hz': 0x02, '1_60hz': 0x03 };
|
|
37
|
+
|
|
38
|
+
const _CLKOUT_COF = { 32768: 0, 16384: 1, 8192: 2, 4096: 3, 2048: 4, 1024: 5, 1: 6 };
|
|
39
|
+
|
|
40
|
+
function _bcdToInt(b) {
|
|
41
|
+
return ((b >> 4) & 0x0F) * 10 + (b & 0x0F);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function _intToBcd(v) {
|
|
45
|
+
return (Math.floor(v / 10) << 4) | (v % 10);
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* PCF85063A low-power I²C real-time clock and calendar (NXP) — minimal
|
|
50
|
+
* interface.
|
|
51
|
+
*
|
|
52
|
+
* Reads/writes the calendar clock with no configuration beyond the
|
|
53
|
+
* connection. `init()` forces 24-hour mode with the clock running (STOP=0);
|
|
54
|
+
* it writes no time register and does not reset the chip. Fixed I²C address
|
|
55
|
+
* 0x51. There is no battery switch-over — the chip is fed from a single VDD
|
|
56
|
+
* supply.
|
|
57
|
+
*
|
|
58
|
+
* `weekday` follows the datasheet's suggested assignment, 0=Sunday ..
|
|
59
|
+
* 6=Saturday — the Weekdays register has no hardware-enforced meaning.
|
|
60
|
+
*/
|
|
61
|
+
class PCF85063AMinimal {
|
|
62
|
+
/**
|
|
63
|
+
* @param {import('../../connection/register_connection').RegisterConnection} connection - I²C or SMBus register connection at address 0x51.
|
|
64
|
+
*/
|
|
65
|
+
constructor(connection) {
|
|
66
|
+
this._conn = connection;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
async _writeReg(reg, value) {
|
|
70
|
+
await this._conn.writeReg(reg & 0xFF, value & 0xFF);
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
async _readReg(reg) {
|
|
74
|
+
return (await this._conn.readReg(reg & 0xFF, 1))[0];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
async _readRegs(reg, n) {
|
|
78
|
+
return this._conn.readReg(reg & 0xFF, n);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
async _readControl1() {
|
|
82
|
+
// SR always reads 0; mask it so a read-modify-write never resets.
|
|
83
|
+
return (await this._readReg(_REG_CONTROL_1)) & ~_C1_SR & 0xFF;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Confirm the device answers on the bus (plain Control_1 read — the
|
|
88
|
+
* PCF85063A has no identity register) and force 24-hour mode with
|
|
89
|
+
* STOP=0.
|
|
90
|
+
* @returns {Promise<void>}
|
|
91
|
+
*/
|
|
92
|
+
async init() {
|
|
93
|
+
await this._readReg(_REG_CONTROL_1);
|
|
94
|
+
const ctrl1 = await this._readControl1();
|
|
95
|
+
await this._writeReg(_REG_CONTROL_1, ctrl1 & ~(_C1_STOP | _C1_12_24) & 0xFF);
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* Read the calendar clock (one 7-byte burst).
|
|
100
|
+
* @returns {Promise<{year: number, month: number, day: number, weekday: number, hour: number, minute: number, second: number}>}
|
|
101
|
+
* `year` is 2000-2099, `hour` is 0-23, `weekday` is 0=Sunday..6=Saturday.
|
|
102
|
+
*/
|
|
103
|
+
async getDatetime() {
|
|
104
|
+
const raw = await this._readRegs(_REG_SECONDS, 7);
|
|
105
|
+
return {
|
|
106
|
+
year: 2000 + _bcdToInt(raw[6]),
|
|
107
|
+
month: _bcdToInt(raw[5] & 0x1F),
|
|
108
|
+
day: _bcdToInt(raw[3] & 0x3F),
|
|
109
|
+
weekday: raw[4] & 0x07,
|
|
110
|
+
hour: _bcdToInt(raw[2] & 0x3F),
|
|
111
|
+
minute: _bcdToInt(raw[1] & 0x7F),
|
|
112
|
+
second: _bcdToInt(raw[0] & 0x7F),
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Set the calendar clock using the STOP-bit precision start: freeze the
|
|
118
|
+
* divider chain (STOP=1), write all seven time/date registers in one
|
|
119
|
+
* transaction, then release STOP. Forces 24-hour mode and clears the OS
|
|
120
|
+
* flag (the time is now known-good).
|
|
121
|
+
* @param {number} year - 2000-2099 (a RangeError is thrown otherwise).
|
|
122
|
+
* @param {number} month - 1-12.
|
|
123
|
+
* @param {number} day - 1-31.
|
|
124
|
+
* @param {number} weekday - 0=Sunday..6=Saturday.
|
|
125
|
+
* @param {number} hour - 0-23.
|
|
126
|
+
* @param {number} minute - 0-59.
|
|
127
|
+
* @param {number} second - 0-59.
|
|
128
|
+
* @returns {Promise<void>}
|
|
129
|
+
*/
|
|
130
|
+
async setDatetime(year, month, day, weekday, hour, minute, second) {
|
|
131
|
+
if (year < 2000 || year > 2099) throw new RangeError('year must be 2000-2099');
|
|
132
|
+
const ctrl1 = (await this._readControl1()) & ~_C1_12_24 & 0xFF;
|
|
133
|
+
await this._writeReg(_REG_CONTROL_1, ctrl1 | _C1_STOP);
|
|
134
|
+
await this._conn.writeReg(_REG_SECONDS, Buffer.from([_intToBcd(second) & 0x7F, // OS = 0
|
|
135
|
+
_intToBcd(minute),
|
|
136
|
+
_intToBcd(hour) & 0x3F,
|
|
137
|
+
_intToBcd(day),
|
|
138
|
+
weekday & 0x07,
|
|
139
|
+
_intToBcd(month),
|
|
140
|
+
_intToBcd(year - 2000),]));
|
|
141
|
+
await this._writeReg(_REG_CONTROL_1, ctrl1 & ~_C1_STOP & 0xFF);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
/**
|
|
146
|
+
* PCF85063A full interface — extends Minimal with the five-field alarm, the
|
|
147
|
+
* countdown timer, minute / half-minute interrupts, programmable CLKOUT,
|
|
148
|
+
* offset calibration, oscillator-load selection, oscillator-stop detection,
|
|
149
|
+
* clock stop/start, the free RAM byte, software reset and the interrupt API.
|
|
150
|
+
*
|
|
151
|
+
* The INT pin is open-drain and active-low; CLKOUT is a separate pin.
|
|
152
|
+
*/
|
|
153
|
+
class PCF85063AFull extends PCF85063AMinimal {
|
|
154
|
+
constructor(connection) {
|
|
155
|
+
super(connection);
|
|
156
|
+
this._callback = null;
|
|
157
|
+
this._edgeHandler = null;
|
|
158
|
+
this._pollTimer = null;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
async _updateControl1(clearMask, setBits) {
|
|
162
|
+
const ctrl1 = await this._readControl1();
|
|
163
|
+
await this._writeReg(_REG_CONTROL_1, (ctrl1 & ~clearMask) | setBits);
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
async _updateControl2(clearMask, setBits) {
|
|
167
|
+
// AF and TF are written 1 (unchanged) unless explicitly cleared
|
|
168
|
+
// through clearMask (AND semantics: write 0 clears, 1 keeps).
|
|
169
|
+
const reg = await this._readReg(_REG_CONTROL_2);
|
|
170
|
+
await this._writeReg(_REG_CONTROL_2, ((reg & ~clearMask) | setBits | (_C2_FLAGS & ~clearMask)) & 0xFF);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
async _updateTimerMode(clearMask, setBits) {
|
|
174
|
+
const reg = await this._readReg(_REG_TIMER_MODE);
|
|
175
|
+
await this._writeReg(_REG_TIMER_MODE, ((reg & ~clearMask) | setBits) & 0x1F);
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// -- Oscillator / clock control ---------------------------------------
|
|
179
|
+
|
|
180
|
+
/**
|
|
181
|
+
* @returns {Promise<boolean>} OS flag (bit 7 of Seconds) — the time may be
|
|
182
|
+
* invalid; cleared by `setDatetime()` or `clearOscillatorStop()`.
|
|
183
|
+
*/
|
|
184
|
+
async oscillatorStopped() {
|
|
185
|
+
return ((await this._readReg(_REG_SECONDS)) & _SECONDS_OS) !== 0;
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* Clear OS, keeping the current seconds value. If `oscillatorStopped()`
|
|
190
|
+
* is still true afterwards the oscillator is not running.
|
|
191
|
+
* @returns {Promise<void>}
|
|
192
|
+
*/
|
|
193
|
+
async clearOscillatorStop() {
|
|
194
|
+
const sec = await this._readReg(_REG_SECONDS);
|
|
195
|
+
await this._writeReg(_REG_SECONDS, sec & 0x7F);
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
/**
|
|
199
|
+
* Freeze the clock (STOP=1); the divider chain is held in reset.
|
|
200
|
+
* @returns {Promise<void>}
|
|
201
|
+
*/
|
|
202
|
+
async stopClock() {
|
|
203
|
+
await this._updateControl1(0, _C1_STOP);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Release the clock (STOP=0).
|
|
208
|
+
* @returns {Promise<void>}
|
|
209
|
+
*/
|
|
210
|
+
async startClock() {
|
|
211
|
+
await this._updateControl1(_C1_STOP, 0);
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// -- Alarm ------------------------------------------------------------
|
|
215
|
+
|
|
216
|
+
/**
|
|
217
|
+
* Decode the alarm registers (0x0B-0x0F).
|
|
218
|
+
* @returns {Promise<{second: ?number, minute: ?number, hour: ?number, day: ?number, weekday: ?number}>}
|
|
219
|
+
* Each field is `null` when disabled (AEN_x=1).
|
|
220
|
+
*/
|
|
221
|
+
async getAlarm() {
|
|
222
|
+
const raw = await this._readRegs(_REG_SECOND_ALARM, 5);
|
|
223
|
+
return {
|
|
224
|
+
second: raw[0] & 0x80 ? null : _bcdToInt(raw[0] & 0x7F),
|
|
225
|
+
minute: raw[1] & 0x80 ? null : _bcdToInt(raw[1] & 0x7F),
|
|
226
|
+
hour: raw[2] & 0x80 ? null : _bcdToInt(raw[2] & 0x3F),
|
|
227
|
+
day: raw[3] & 0x80 ? null : _bcdToInt(raw[3] & 0x3F),
|
|
228
|
+
weekday: raw[4] & 0x80 ? null : raw[4] & 0x07,
|
|
229
|
+
};
|
|
230
|
+
}
|
|
231
|
+
|
|
232
|
+
/**
|
|
233
|
+
* Write the alarm registers (0x0B-0x0F) and clear AF. A field left
|
|
234
|
+
* `null`/undefined is disabled; the alarm fires when every enabled field
|
|
235
|
+
* matches.
|
|
236
|
+
* @param {{second?: ?number, minute?: ?number, hour?: ?number, day?: ?number, weekday?: ?number}} [alarm={}]
|
|
237
|
+
* `weekday` is 0=Sunday..6=Saturday.
|
|
238
|
+
* @returns {Promise<void>}
|
|
239
|
+
*/
|
|
240
|
+
async setAlarm({ second = null, minute = null, hour = null, day = null, weekday = null } = {}) {
|
|
241
|
+
await this._conn.writeReg(_REG_SECOND_ALARM, Buffer.from([second == null ? 0x80 : _intToBcd(second) & 0x7F,
|
|
242
|
+
minute == null ? 0x80 : _intToBcd(minute) & 0x7F,
|
|
243
|
+
hour == null ? 0x80 : _intToBcd(hour) & 0x3F,
|
|
244
|
+
day == null ? 0x80 : _intToBcd(day) & 0x3F,
|
|
245
|
+
weekday == null ? 0x80 : weekday & 0x07,]));
|
|
246
|
+
await this._updateControl2(_C2_AF, 0);
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
// -- Countdown timer --------------------------------------------------
|
|
250
|
+
|
|
251
|
+
/**
|
|
252
|
+
* Configure and start the countdown timer. Disables the timer first so
|
|
253
|
+
* `Timer_value` can be changed safely. Does not set TIE — call
|
|
254
|
+
* `enableInterrupt(SOURCE_TIMER)` to route it to INT.
|
|
255
|
+
* @param {number} value - Countdown value, 1-255.
|
|
256
|
+
* @param {'4096hz'|'64hz'|'1hz'|'1_60hz'} sourceClock
|
|
257
|
+
* @param {boolean} [pulsed=false] - Pulsed (true) or level (false, INT follows TF) interrupt.
|
|
258
|
+
* @returns {Promise<void>}
|
|
259
|
+
*/
|
|
260
|
+
async configureTimer(value, sourceClock, pulsed = false) {
|
|
261
|
+
await this._updateTimerMode(_TM_TE, 0);
|
|
262
|
+
await this._writeReg(_REG_TIMER_VALUE, value);
|
|
263
|
+
await this._updateTimerMode(_TM_TCF_MASK | _TM_TI_TP,
|
|
264
|
+
(_SOURCE_CLOCKS[sourceClock] << 3) | (pulsed ? _TM_TI_TP : 0) | _TM_TE);
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
/**
|
|
268
|
+
* Stop the timer (TE=0, TIE=0) and select the 1/60 Hz clock for power saving.
|
|
269
|
+
* @returns {Promise<void>}
|
|
270
|
+
*/
|
|
271
|
+
async disableTimer() {
|
|
272
|
+
await this._updateTimerMode(_TM_TE | _TM_TIE | _TM_TCF_MASK, _TM_TCF_MASK);
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
/**
|
|
276
|
+
* Read the live countdown value; reads until two consecutive reads agree.
|
|
277
|
+
* @returns {Promise<number>} Current counter value, 0-255 (not the loaded one).
|
|
278
|
+
*/
|
|
279
|
+
async readTimer() {
|
|
280
|
+
let prev = await this._readReg(_REG_TIMER_VALUE);
|
|
281
|
+
for (;;) {
|
|
282
|
+
const cur = await this._readReg(_REG_TIMER_VALUE);
|
|
283
|
+
if (cur === prev) return cur;
|
|
284
|
+
prev = cur;
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
/**
|
|
289
|
+
* Select the minute / half-minute interrupt (requires offset mode `normal`).
|
|
290
|
+
* @param {'off'|'minute'|'half_minute'} mode
|
|
291
|
+
* @returns {Promise<void>}
|
|
292
|
+
*/
|
|
293
|
+
async setMinuteInterrupt(mode) {
|
|
294
|
+
const bits = mode === 'minute' ? _C2_MI : mode === 'half_minute' ? _C2_HMI : 0;
|
|
295
|
+
await this._updateControl2(_C2_MI | _C2_HMI, bits);
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
// -- CLKOUT -----------------------------------------------------------
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Drive CLKOUT.
|
|
302
|
+
* @param {number} frequencyHz - One of 32768, 16384, 8192, 4096, 2048, 1024, 1.
|
|
303
|
+
* @returns {Promise<void>}
|
|
304
|
+
*/
|
|
305
|
+
async setClockOutput(frequencyHz) {
|
|
306
|
+
const cof = frequencyHz in _CLKOUT_COF ? _CLKOUT_COF[frequencyHz] : 7;
|
|
307
|
+
await this._updateControl2(_C2_COF, cof);
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Disable CLKOUT (COF=111, pin low) to save power.
|
|
312
|
+
* @returns {Promise<void>}
|
|
313
|
+
*/
|
|
314
|
+
async disableClockOutput() {
|
|
315
|
+
await this._updateControl2(_C2_COF, _C2_COF);
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
// -- Offset -----------------------------------------------------------
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Read the clock-offset calibration register.
|
|
322
|
+
* @returns {Promise<{offset: number, mode: 'normal'|'course'}>}
|
|
323
|
+
* `offset` is -64..+63 LSB (4.34 ppm/LSB normal, 4.069 ppm/LSB course).
|
|
324
|
+
*/
|
|
325
|
+
async getOffset() {
|
|
326
|
+
const raw = await this._readReg(_REG_OFFSET);
|
|
327
|
+
let offset = raw & 0x7F;
|
|
328
|
+
if (offset & 0x40) offset -= 128;
|
|
329
|
+
return { offset, mode: raw & 0x80 ? 'course' : 'normal' };
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
/**
|
|
333
|
+
* Write the clock-offset calibration register.
|
|
334
|
+
* @param {number} offset - Two's-complement correction, -64 to 63 LSB.
|
|
335
|
+
* @param {'normal'|'course'} [mode='normal'] - Correction every two hours / every four minutes.
|
|
336
|
+
* @returns {Promise<void>}
|
|
337
|
+
*/
|
|
338
|
+
async setOffset(offset, mode = 'normal') {
|
|
339
|
+
await this._writeReg(_REG_OFFSET, (mode === 'course' ? 0x80 : 0) | (offset & 0x7F));
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Select the oscillator load capacitance (CAP_SEL).
|
|
344
|
+
* @param {number} picofarads - 7 or 12.5; match the crystal's specified load.
|
|
345
|
+
* @returns {Promise<void>}
|
|
346
|
+
*/
|
|
347
|
+
async setOscillatorLoad(picofarads) {
|
|
348
|
+
if (picofarads !== 7 && picofarads !== 12.5) throw new RangeError('picofarads must be 7 or 12.5');
|
|
349
|
+
await this._updateControl1(_C1_CAP_SEL, picofarads === 12.5 ? _C1_CAP_SEL : 0);
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// -- RAM / reset ------------------------------------------------------
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* @returns {Promise<number>} The free general-purpose RAM byte, 0-255.
|
|
356
|
+
*/
|
|
357
|
+
async readRam() {
|
|
358
|
+
return this._readReg(_REG_RAM);
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* Write the free general-purpose RAM byte.
|
|
363
|
+
* @param {number} value - 0-255.
|
|
364
|
+
* @returns {Promise<void>}
|
|
365
|
+
*/
|
|
366
|
+
async writeRam(value) {
|
|
367
|
+
await this._writeReg(_REG_RAM, value);
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* Send the software-reset sequence (0x58 to Control_1). Resets ALL
|
|
372
|
+
* registers including the time (2000-01-01 00:00:00, OS=1) — run it
|
|
373
|
+
* before `setDatetime()`, never as a routine.
|
|
374
|
+
* @returns {Promise<void>}
|
|
375
|
+
*/
|
|
376
|
+
async softwareReset() {
|
|
377
|
+
await this._writeReg(_REG_CONTROL_1, 0x58);
|
|
378
|
+
}
|
|
379
|
+
|
|
380
|
+
// -- Interrupt API ----------------------------------------------------
|
|
381
|
+
|
|
382
|
+
/**
|
|
383
|
+
* Read Control_2, clear the set AF/TF flags (enable bits and COF
|
|
384
|
+
* preserved), and return the pre-clear status mask — `SOURCE_ALARM`
|
|
385
|
+
* and/or `SOURCE_TIMER` (timer, minute and half-minute all report as
|
|
386
|
+
* `SOURCE_TIMER`).
|
|
387
|
+
* @returns {Promise<number>}
|
|
388
|
+
*/
|
|
389
|
+
async pollInterrupt() {
|
|
390
|
+
const ctrl2 = await this._readReg(_REG_CONTROL_2);
|
|
391
|
+
let status = 0;
|
|
392
|
+
if (ctrl2 & _C2_AF) status |= PCF85063AFull.SOURCE_ALARM;
|
|
393
|
+
if (ctrl2 & _C2_TF) status |= PCF85063AFull.SOURCE_TIMER;
|
|
394
|
+
if (status) {
|
|
395
|
+
// Write 0 only to the flags seen set, 1 to the others, so a flag
|
|
396
|
+
// that sets between the read and this write is not lost.
|
|
397
|
+
await this._writeReg(_REG_CONTROL_2, (ctrl2 & ~_C2_FLAGS) | (_C2_FLAGS & ~ctrl2));
|
|
398
|
+
}
|
|
399
|
+
return status;
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Enable one or more interrupt sources (AIE, TIE, MI, HMI, CIE).
|
|
404
|
+
* @param {number} source - Bitwise OR of `PCF85063AFull.SOURCE_*`.
|
|
405
|
+
* @returns {Promise<void>}
|
|
406
|
+
*/
|
|
407
|
+
async enableInterrupt(source) {
|
|
408
|
+
await this._setInterruptEnables(source, true);
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
/**
|
|
412
|
+
* Disable one or more interrupt sources.
|
|
413
|
+
* @param {number} source - Bitwise OR of `PCF85063AFull.SOURCE_*`.
|
|
414
|
+
* @returns {Promise<void>}
|
|
415
|
+
*/
|
|
416
|
+
async disableInterrupt(source) {
|
|
417
|
+
await this._setInterruptEnables(source, false);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
async _setInterruptEnables(source, enable) {
|
|
421
|
+
const S = PCF85063AFull;
|
|
422
|
+
const bits2 = (source & S.SOURCE_ALARM ? _C2_AIE : 0)
|
|
423
|
+
| (source & S.SOURCE_MINUTE ? _C2_MI : 0)
|
|
424
|
+
| (source & S.SOURCE_HALF_MINUTE ? _C2_HMI : 0);
|
|
425
|
+
if (bits2) await this._updateControl2(enable ? 0 : bits2, enable ? bits2 : 0);
|
|
426
|
+
if (source & S.SOURCE_TIMER) await this._updateTimerMode(enable ? 0 : _TM_TIE, enable ? _TM_TIE : 0);
|
|
427
|
+
if (source & S.SOURCE_CORRECTION) await this._updateControl1(enable ? 0 : _C1_CIE, enable ? _C1_CIE : 0);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/**
|
|
431
|
+
* Subscribe to interrupts. Uses `connection.intPin.onEdge()` when an
|
|
432
|
+
* INT-line InputPin is wired; falls back to a 5 ms polling loop
|
|
433
|
+
* otherwise.
|
|
434
|
+
* @param {function(number): void} callback - Called with the status mask (SOURCE_ALARM / SOURCE_TIMER).
|
|
435
|
+
* @returns {Promise<void>}
|
|
436
|
+
*/
|
|
437
|
+
async onInterrupt(callback) {
|
|
438
|
+
this._callback = callback;
|
|
439
|
+
const dispatch = async () => {
|
|
440
|
+
const status = await this.pollInterrupt();
|
|
441
|
+
if (status && this._callback) this._callback(status);
|
|
442
|
+
};
|
|
443
|
+
if (this._conn.intPin) {
|
|
444
|
+
this._edgeHandler = dispatch;
|
|
445
|
+
await this._conn.intPin.onEdge(this._edgeHandler, 'falling');
|
|
446
|
+
} else {
|
|
447
|
+
this._pollTimer = setInterval(dispatch, 5);
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
/**
|
|
452
|
+
* Unsubscribe from interrupts.
|
|
453
|
+
* @returns {Promise<void>}
|
|
454
|
+
*/
|
|
455
|
+
async offInterrupt() {
|
|
456
|
+
if (this._conn.intPin && this._edgeHandler) {
|
|
457
|
+
await this._conn.intPin.offEdge(this._edgeHandler);
|
|
458
|
+
this._edgeHandler = null;
|
|
459
|
+
}
|
|
460
|
+
if (this._pollTimer) {
|
|
461
|
+
clearInterval(this._pollTimer);
|
|
462
|
+
this._pollTimer = null;
|
|
463
|
+
}
|
|
464
|
+
this._callback = null;
|
|
465
|
+
}
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
/** Alarm matched (AF). */
|
|
469
|
+
PCF85063AFull.SOURCE_ALARM = 0x01;
|
|
470
|
+
/** Countdown timer expired (TF). */
|
|
471
|
+
PCF85063AFull.SOURCE_TIMER = 0x02;
|
|
472
|
+
/** Minute interrupt (enable only; reported as SOURCE_TIMER). */
|
|
473
|
+
PCF85063AFull.SOURCE_MINUTE = 0x04;
|
|
474
|
+
/** Half-minute interrupt (enable only; reported as SOURCE_TIMER). */
|
|
475
|
+
PCF85063AFull.SOURCE_HALF_MINUTE = 0x08;
|
|
476
|
+
/** Offset-correction pulse (enable only, no flag). */
|
|
477
|
+
PCF85063AFull.SOURCE_CORRECTION = 0x10;
|
|
478
|
+
|
|
479
|
+
/** Fixed 7-bit I²C address. */
|
|
480
|
+
PCF85063AMinimal.I2C_ADDRESS = 0x51;
|
|
481
|
+
|
|
482
|
+
module.exports = { PCF85063AMinimal, PCF85063AFull };
|
package/src/connection/uart.js
CHANGED
|
@@ -134,6 +134,15 @@ class UARTConnection extends Connection {
|
|
|
134
134
|
return this._read(n);
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
+
/**
|
|
138
|
+
* Discard any bytes received but not yet read. Chip drivers call this
|
|
139
|
+
* after a framing error before retrying a transaction.
|
|
140
|
+
* @returns {Promise<void>}
|
|
141
|
+
*/
|
|
142
|
+
async flush() {
|
|
143
|
+
this._rxBuf = Buffer.alloc(0);
|
|
144
|
+
}
|
|
145
|
+
|
|
137
146
|
/**
|
|
138
147
|
* Close the serial port and release the DE GPIO if applicable.
|
|
139
148
|
* @returns {Promise<void>}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
const { crc8 } = require('../chips/motor/tmc2208');
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Scripted TMC2208-style UART chip simulator for unit tests — no hardware.
|
|
7
|
+
*
|
|
8
|
+
* Behaves like a Trinamic single-wire UART slave: `write()` accepts 8-byte
|
|
9
|
+
* write datagrams (stores the register, bumps IFCNT) and 4-byte read requests
|
|
10
|
+
* (queues the reply from `regs`). With `echo` every transmitted byte is also
|
|
11
|
+
* queued back, as on the shared PDN_UART wire. All datagrams are kept in
|
|
12
|
+
* `datagrams`; register writes in `writes`.
|
|
13
|
+
*/
|
|
14
|
+
class UARTConnectionMock {
|
|
15
|
+
constructor(echo = true) {
|
|
16
|
+
this.echo = echo;
|
|
17
|
+
this.regs = new Map([[0x06, 0x21000100], [0x02, 0]]);
|
|
18
|
+
this.datagrams = [];
|
|
19
|
+
this.writes = [];
|
|
20
|
+
this.corruptNextReply = false;
|
|
21
|
+
this._rx = Buffer.alloc(0);
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
async write(data) {
|
|
25
|
+
const d = Buffer.from(data);
|
|
26
|
+
this.datagrams.push(d);
|
|
27
|
+
if (this.echo) this._rx = Buffer.concat([this._rx, d]);
|
|
28
|
+
if (d.length === 8 && (d[2] & 0x80)) {
|
|
29
|
+
const reg = d[2] & 0x7F;
|
|
30
|
+
const value = d.readUInt32BE(3);
|
|
31
|
+
this.regs.set(reg, value);
|
|
32
|
+
this.writes.push([reg, value]);
|
|
33
|
+
this.regs.set(0x02, (this.regs.get(0x02) + 1) & 0xFF);
|
|
34
|
+
} else if (d.length === 4) {
|
|
35
|
+
const reg = d[2] & 0x7F;
|
|
36
|
+
const body = Buffer.alloc(7);
|
|
37
|
+
body[0] = 0x05; body[1] = 0xFF; body[2] = reg;
|
|
38
|
+
body.writeUInt32BE((this.regs.get(reg) ?? 0) >>> 0, 3);
|
|
39
|
+
let crc = crc8(body);
|
|
40
|
+
if (this.corruptNextReply) { crc ^= 0xFF; this.corruptNextReply = false; }
|
|
41
|
+
this._rx = Buffer.concat([this._rx, body, Buffer.from([crc])]);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
async read(n) {
|
|
46
|
+
const out = Buffer.from(this._rx.subarray(0, n));
|
|
47
|
+
this._rx = this._rx.subarray(out.length);
|
|
48
|
+
return out;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async writeRead(data, n) {
|
|
52
|
+
await this.write(data);
|
|
53
|
+
return this.read(n);
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
async flush() { this._rx = Buffer.alloc(0); }
|
|
57
|
+
|
|
58
|
+
/** Last value written to a register, or undefined. */
|
|
59
|
+
lastWrite(reg) {
|
|
60
|
+
const w = this.writes.filter((x) => x[0] === reg);
|
|
61
|
+
return w.length ? w[w.length - 1][1] : undefined;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
module.exports = { UARTConnectionMock };
|
|
@@ -15,6 +15,7 @@ const CHIPS = [
|
|
|
15
15
|
{"id":"mma8451q","driver":"mma8451q","writeSensitive":false,"aliased":false,"addresses":[28,29],"probe":{"register":13,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[26]}},
|
|
16
16
|
{"id":"ad5243","driver":"ad5243","writeSensitive":true,"aliased":false,"addresses":[47],"probe":null},
|
|
17
17
|
{"id":"ad5248","driver":"ad5248","writeSensitive":true,"aliased":false,"addresses":[44,45,46,47],"probe":null},
|
|
18
|
+
{"id":"ds3502","driver":null,"writeSensitive":false,"aliased":false,"addresses":[40,41,42,43],"probe":null},
|
|
18
19
|
{"id":"cat5171","driver":null,"writeSensitive":true,"aliased":false,"addresses":[44,45],"probe":null},
|
|
19
20
|
{"id":"ds1881","driver":null,"writeSensitive":true,"aliased":false,"addresses":[40,41,42,43,44,45,46,47],"probe":null},
|
|
20
21
|
{"id":"cs43l22","driver":null,"writeSensitive":false,"aliased":false,"addresses":[74,75],"probe":{"register":1,"regBytes":1,"length":1,"order":"big","mask":248,"expected":[224]}},
|
|
@@ -27,13 +28,31 @@ const CHIPS = [
|
|
|
27
28
|
{"id":"ads7828","driver":null,"writeSensitive":true,"aliased":false,"addresses":[72,73,74,75],"probe":null},
|
|
28
29
|
{"id":"mcp4725","driver":"mcp4725","writeSensitive":true,"aliased":false,"addresses":[96,97],"probe":null},
|
|
29
30
|
{"id":"mcp4728","driver":"mcp4728","writeSensitive":true,"aliased":false,"addresses":[96,97,98,99,100,101,102,103],"probe":null},
|
|
31
|
+
{"id":"mcp4531","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[46,47],"probe":null},
|
|
32
|
+
{"id":"mcp4532","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
33
|
+
{"id":"mcp4551","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[46,47],"probe":null},
|
|
34
|
+
{"id":"mcp4552","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
35
|
+
{"id":"mcp4631","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[40,41,42,43,44,45,46,47],"probe":null},
|
|
36
|
+
{"id":"mcp4632","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
37
|
+
{"id":"mcp4651","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[40,41,42,43,44,45,46,47],"probe":null},
|
|
38
|
+
{"id":"mcp4652","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
39
|
+
{"id":"mcp4541","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[46,47],"probe":null},
|
|
40
|
+
{"id":"mcp4542","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
41
|
+
{"id":"mcp4561","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[46,47],"probe":null},
|
|
42
|
+
{"id":"mcp4562","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
43
|
+
{"id":"mcp4641","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[40,41,42,43,44,45,46,47],"probe":null},
|
|
44
|
+
{"id":"mcp4642","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
45
|
+
{"id":"mcp4661","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[40,41,42,43,44,45,46,47],"probe":null},
|
|
46
|
+
{"id":"mcp4662","driver":"mcp4xxx","writeSensitive":true,"aliased":false,"addresses":[88,89,90,91],"probe":null},
|
|
30
47
|
{"id":"pcf8591","driver":"pcf8591","writeSensitive":true,"aliased":false,"addresses":[72,73,74,75,76,77,78,79],"probe":null},
|
|
48
|
+
{"id":"es8311","driver":"es8311","writeSensitive":false,"aliased":false,"addresses":[24,25],"probe":null},
|
|
31
49
|
{"id":"rda5807m","driver":"rda5807m","writeSensitive":true,"aliased":false,"addresses":[16],"probe":null},
|
|
32
50
|
{"id":"pcf8576","driver":"pcf8576","writeSensitive":true,"aliased":false,"addresses":[56,57],"probe":null},
|
|
33
51
|
{"id":"pcf8578","driver":"pcf8578","writeSensitive":true,"aliased":false,"addresses":[60,61],"probe":null},
|
|
34
52
|
{"id":"pcf8579","driver":"pcf8579","writeSensitive":true,"aliased":false,"addresses":[60,61],"probe":null},
|
|
35
53
|
{"id":"sh1106","driver":null,"writeSensitive":true,"aliased":false,"addresses":[60,61],"probe":null},
|
|
36
54
|
{"id":"ssd1305","driver":null,"writeSensitive":true,"aliased":false,"addresses":[60,61],"probe":null},
|
|
55
|
+
{"id":"ssd1306","driver":null,"writeSensitive":true,"aliased":false,"addresses":[60,61],"probe":null},
|
|
37
56
|
{"id":"uc1611s","driver":"uc1611s","writeSensitive":true,"aliased":false,"addresses":[56,57,58,59,60,61,62,63],"probe":null},
|
|
38
57
|
{"id":"aht21","driver":"aht21","writeSensitive":true,"aliased":false,"addresses":[56],"probe":null},
|
|
39
58
|
{"id":"bme280","driver":"bme280","writeSensitive":false,"aliased":false,"addresses":[118,119],"probe":{"register":208,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[96]}},
|
|
@@ -44,16 +63,19 @@ const CHIPS = [
|
|
|
44
63
|
{"id":"l3gd20h","driver":"l3gd20h","writeSensitive":false,"aliased":false,"addresses":[106,107],"probe":{"register":15,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[212,215]}},
|
|
45
64
|
{"id":"mpu6050","driver":"mpu6050","writeSensitive":false,"aliased":false,"addresses":[104,105],"probe":{"register":117,"regBytes":1,"length":1,"order":"big","mask":126,"expected":[104]}},
|
|
46
65
|
{"id":"icm20948","driver":"icm20948","writeSensitive":false,"aliased":false,"addresses":[104,105],"probe":{"register":0,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[234]}},
|
|
66
|
+
{"id":"qmi8658a","driver":"qmi8658a","writeSensitive":false,"aliased":false,"addresses":[106,107],"probe":{"register":0,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[5]}},
|
|
47
67
|
{"id":"mpu9250","driver":"mpu9250","writeSensitive":false,"aliased":false,"addresses":[104,105],"probe":{"register":117,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[113]}},
|
|
48
68
|
{"id":"mpu9255","driver":"mpu9255","writeSensitive":false,"aliased":false,"addresses":[104,105],"probe":{"register":117,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[115]}},
|
|
49
69
|
{"id":"mcp23008","driver":"mcp23008","writeSensitive":false,"aliased":false,"addresses":[32,33,34,35,36,37,38,39],"probe":null},
|
|
50
70
|
{"id":"mcp23017","driver":"mcp23017","writeSensitive":false,"aliased":false,"addresses":[32,33,34,35,36,37,38,39],"probe":null},
|
|
51
71
|
{"id":"pca6408a","driver":null,"writeSensitive":false,"aliased":false,"addresses":[32,33],"probe":null},
|
|
52
72
|
{"id":"pca9536","driver":null,"writeSensitive":false,"aliased":false,"addresses":[65],"probe":null},
|
|
73
|
+
{"id":"pca9539","driver":null,"writeSensitive":false,"aliased":false,"addresses":[116,117,118,119],"probe":null},
|
|
53
74
|
{"id":"pcf8574","driver":"pcf8574","writeSensitive":true,"aliased":false,"addresses":[32,33,34,35,36,37,38,39,56,57,58,59,60,61,62,63],"probe":null},
|
|
54
75
|
{"id":"pcf8575","driver":"pcf8575","writeSensitive":true,"aliased":false,"addresses":[32,33,34,35,36,37,38,39],"probe":null},
|
|
55
76
|
{"id":"apds-9930","driver":"apds-9930","writeSensitive":false,"aliased":false,"addresses":[57],"probe":{"register":146,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[57]}},
|
|
56
77
|
{"id":"apds9960","driver":"apds9960","writeSensitive":false,"aliased":false,"addresses":[57],"probe":{"register":146,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[171]}},
|
|
78
|
+
{"id":"max44009","driver":null,"writeSensitive":false,"aliased":false,"addresses":[74,75],"probe":null},
|
|
57
79
|
{"id":"as5600","driver":"as5600","writeSensitive":false,"aliased":false,"addresses":[54],"probe":null},
|
|
58
80
|
{"id":"hmc5883l","driver":"hmc5883l","writeSensitive":false,"aliased":false,"addresses":[30],"probe":{"register":10,"regBytes":1,"length":3,"order":"big","mask":16777215,"expected":[4731955]}},
|
|
59
81
|
{"id":"24aa02uid","driver":"24aa02uid","writeSensitive":false,"aliased":true,"addresses":[80,81,82,83,84,85,86,87],"probe":null},
|
|
@@ -62,7 +84,9 @@ const CHIPS = [
|
|
|
62
84
|
{"id":"drv2605","driver":"drv2605","writeSensitive":false,"aliased":false,"addresses":[90],"probe":{"register":0,"regBytes":1,"length":1,"order":"big","mask":224,"expected":[96]}},
|
|
63
85
|
{"id":"drv8830","driver":"drv8830","writeSensitive":false,"aliased":false,"addresses":[96,97,98,99,100,101,102,103,104],"probe":null},
|
|
64
86
|
{"id":"mpr121","driver":"mpr121","writeSensitive":false,"aliased":false,"addresses":[90,91,92,93],"probe":null},
|
|
87
|
+
{"id":"pca9541","driver":null,"writeSensitive":false,"aliased":false,"addresses":[112,113,114,115,116,117,118,119],"probe":null},
|
|
65
88
|
{"id":"ade7953","driver":"ade7953","writeSensitive":true,"aliased":false,"addresses":[56],"probe":null},
|
|
89
|
+
{"id":"axp2101","driver":"axp2101","writeSensitive":false,"aliased":false,"addresses":[52],"probe":null},
|
|
66
90
|
{"id":"ina219","driver":"ina219","writeSensitive":false,"aliased":false,"addresses":[64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79],"probe":null},
|
|
67
91
|
{"id":"ina226","driver":"ina226","writeSensitive":false,"aliased":false,"addresses":[64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79],"probe":{"register":255,"regBytes":1,"length":2,"order":"big","mask":65535,"expected":[8800]}},
|
|
68
92
|
{"id":"ina3221","driver":"ina3221","writeSensitive":false,"aliased":false,"addresses":[64,65,66,67],"probe":{"register":255,"regBytes":1,"length":2,"order":"big","mask":65535,"expected":[12832]}},
|
|
@@ -77,6 +101,7 @@ const CHIPS = [
|
|
|
77
101
|
{"id":"mfrc522","driver":"mfrc522","writeSensitive":false,"aliased":false,"addresses":[40,41,42,43,44,45,46,47],"probe":{"register":55,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[145,146]}},
|
|
78
102
|
{"id":"ds3231","driver":"ds3231","writeSensitive":false,"aliased":false,"addresses":[104],"probe":null},
|
|
79
103
|
{"id":"pcf8523","driver":"pcf8523","writeSensitive":false,"aliased":false,"addresses":[104],"probe":null},
|
|
104
|
+
{"id":"pcf85063a","driver":"pcf85063a","writeSensitive":false,"aliased":false,"addresses":[81],"probe":null},
|
|
80
105
|
{"id":"mcp9808","driver":"mcp9808","writeSensitive":false,"aliased":false,"addresses":[24,25,26,27,28,29,30,31],"probe":{"register":7,"regBytes":1,"length":2,"order":"big","mask":65280,"expected":[1024]}},
|
|
81
106
|
{"id":"tmp117","driver":"tmp117","writeSensitive":false,"aliased":false,"addresses":[72,73,74,75],"probe":{"register":15,"regBytes":1,"length":2,"order":"big","mask":4095,"expected":[279]}},
|
|
82
107
|
{"id":"vl53l0x","driver":"vl53l0x","writeSensitive":false,"aliased":false,"addresses":[41],"probe":{"register":192,"regBytes":1,"length":1,"order":"big","mask":255,"expected":[238]}},
|