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

Method constructor

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

Source from the content-addressed store, hash-verified

27
28class TMP102 extends SMBus {
29 constructor(dictionary) {
30 super(Object.assign({address: 0x48}, dictionary));
31 super.writeBlock(3, 0x7f, 0xf8); // disable alert
32 // Configuration register is 0xA060 on reset as per data sheet
33 const config = super.readWord(1);
34 if (!(0x1000 & config)) {
35 super.writeWord(1, super.readWord(1) | 0x1000); // turn on 13-bit range (Extended Mode - EM bit)
36 Timer.delay(250); // wait for a new reading to be available, so it is at the correct resolution
37 }
38 }
39
40 configure(dictionary) {
41 if (dictionary.alert) {

Callers

nothing calls this directly

Calls 4

delayMethod · 0.80
writeBlockMethod · 0.45
readWordMethod · 0.45
writeWordMethod · 0.45

Tested by

no test coverage detected