| 26 | |
| 27 | class MCP9808 extends SMBus { |
| 28 | constructor(dictionary) { |
| 29 | super(Object.assign({address: 0x18}, dictionary)); |
| 30 | |
| 31 | if (0x0054 !== super.readWord(6, true)) |
| 32 | throw new Error("invalid manufacturer id"); |
| 33 | if (0x0400 !== super.readWord(7, true)) |
| 34 | throw new Error("unexpected device id / revision"); |
| 35 | |
| 36 | super.writeWord(4, 0x0FFF, true); // max-out T Crit so it never triggers |
| 37 | super.writeWord(1, 0x0020); // reset configuration register (clear interrupt!) |
| 38 | } |
| 39 | |
| 40 | configure(dictionary) { |
| 41 | if (dictionary.alert) { |