(options)
| 43 | #status = "ready"; |
| 44 | |
| 45 | constructor(options) { |
| 46 | const io = this.#io = new options.sensor.io({ |
| 47 | hz: 400_000, |
| 48 | address: 0x48, |
| 49 | ...options.sensor |
| 50 | }); |
| 51 | |
| 52 | this.#onError = options.onError; |
| 53 | |
| 54 | const {alert, onAlert} = options; |
| 55 | if (alert && onAlert) { |
| 56 | this.#onAlert = options.onAlert; |
| 57 | this.#monitor = new alert.io({ |
| 58 | mode: alert.io.InputPullUp, |
| 59 | ...alert, |
| 60 | edge: alert.io.Falling, |
| 61 | onReadable: () => this.#onAlert() |
| 62 | }); |
| 63 | } |
| 64 | |
| 65 | // reset to default values (7.4.2 of datasheet) |
| 66 | io.writeUint8(Register.LM75_CONF, 0); |
| 67 | |
| 68 | |
| 69 | // Tth(ots) = +80C Thys = +75C (7.9) |
| 70 | this.#TOS = 80; |
| 71 | io.writeUint16(Register.LM75_TOS, 160 << 7, true); // half degrees |
| 72 | this.#THYST = 75; |
| 73 | io.writeUint16(Register.LM75_THYST, 150 << 7, true); // half degrees |
| 74 | } |
| 75 | |
| 76 | configure(options) { |
| 77 | const io = this.#io; |
nothing calls this directly
no test coverage detected