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

Method sample

modules/drivers/mcp9808/mcp9808.js:61–71  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 }
60
61 sample() {
62 let config = super.readWord(1, true);
63 if (config & 0x0010)
64 super.writeWord(1, config | 0x0020, true); // clear interrupt
65
66 const value = super.readWord(5, true);
67 let temperature = (value & 0x0FFF) / 16; //@@ not sure about negative... check data sheet
68 if (value & 0x1000)
69 temperature -= 256;
70 return {temperature};
71 }
72}
73
74export default MCP9808;

Callers

nothing calls this directly

Calls 2

readWordMethod · 0.45
writeWordMethod · 0.45

Tested by

no test coverage detected