()
| 168 | return (val > 32768) ? -(65535 - val + 1) : val; |
| 169 | } |
| 170 | sample() { |
| 171 | const io = this.#io; |
| 172 | let conf = io.readUint16(Register.TMP117_CONF, true); |
| 173 | if ((conf & ConfigMask.MODE) == SHUTDOWN_MODE) { |
| 174 | conf |= ONE_SHOT; |
| 175 | io.writeUint16(Register.TMP117_CONF, conf, true); |
| 176 | Timer.delay(ONE_SHOT_DELAY[(conf & ConfigMask.AVE) >> 5]); |
| 177 | conf &= ~ConfigMask.MODE; |
| 178 | io.writeUint16(Register.TMP117_CONF, conf | SHUTDOWN_MODE, true); |
| 179 | } |
| 180 | |
| 181 | let value = this.#twoC16(io.readUint16(Register.TMP117_TEMP, true)) * 0.0078125; |
| 182 | |
| 183 | conf = io.readUint16(Register.TMP117_CONF, true); |
| 184 | let alert = 0; |
| 185 | if (conf & HIGH_ALERT) |
| 186 | alert |= 0b01; |
| 187 | if (conf & LOW_ALERT) |
| 188 | alert |= 0b10; |
| 189 | |
| 190 | return { temperature: value, alert }; |
| 191 | } |
| 192 | |
| 193 | static { |
| 194 | this.prototype[Symbol.dispose] = this.prototype.close; |
nothing calls this directly
no test coverage detected