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

Method sample

modules/drivers/tmp102/tmp102.js:64–73  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

62 }
63
64 sample() {
65 let value = super.readWord(0); // 13-bits
66 value = ((value & 0x00FF) << 5) | ((value & 0xFF00) >> 11);
67 if (value & 0x1000) {
68 value -= 1;
69 value = ~value & 0x1FFF;
70 value = -value;
71 }
72 return {temperature: value * 0.0625};
73 }
74}
75
76export default TMP102;

Callers

nothing calls this directly

Calls 1

readWordMethod · 0.45

Tested by

no test coverage detected