MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / configure

Method configure

modules/drivers/tmp102/tmp102.js:40–62  ·  view source on GitHub ↗
(dictionary)

Source from the content-addressed store, hash-verified

38 }
39
40 configure(dictionary) {
41 if (dictionary.alert) {
42 const alert = dictionary.alert;
43 if (alert.above) {
44 const value = (alert.above / 0.0625) << 3; // 13-bits
45 super.writeBlock(3, value >> 8, value & 0xff); // write Temperature Hi register
46 }
47 else
48 super.writeBlock(3, 0x7f, 0xf8); // write Temperature Hi register (max value)
49 }
50 if (dictionary.hz) {
51 let hz = dictionary.hz;
52 if (hz < 0.5)
53 hz = 0b00;
54 else if (hz < 2)
55 hz = 0b01;
56 else if (hz < 6)
57 hz = 0b10;
58 else
59 hz = 0b11;
60 super.writeWord(1, (super.readWord(1) & ~0xC000) | (hz << 14));
61 }
62 }
63
64 sample() {
65 let value = super.readWord(0); // 13-bits

Callers

nothing calls this directly

Calls 3

writeBlockMethod · 0.45
writeWordMethod · 0.45
readWordMethod · 0.45

Tested by

no test coverage detected