(cmd, request = null, responseLength = 0)
| 175 | |
| 176 | // internal |
| 177 | execute(cmd, request = null, responseLength = 0) { |
| 178 | if (request) |
| 179 | this.write(cmd, request.length, request, request.reduce((a, b) => a ^ b, cmd ^ request.length)); |
| 180 | else |
| 181 | this.write(cmd, 0, cmd); |
| 182 | |
| 183 | // write sets stop bit... could be a problem... but does not appear to be |
| 184 | Timer.delay(10); |
| 185 | |
| 186 | let result = this.read(responseLength + 3); |
| 187 | if (ERROR.NONE !== result[0]) |
| 188 | throw new Error(result[0]); |
| 189 | |
| 190 | if (result.reduce((a, b) => a ^ b)) |
| 191 | throw new Error(ERROR.PARITY); |
| 192 | |
| 193 | return result.slice(2, 2 + responseLength); |
| 194 | } |
| 195 | // offset unimplemented. what does it do? "Time offset in ms" |
| 196 | enqueueTxRaw(channel, type, data) { |
| 197 | let request = new Uint8Array(10); |
no test coverage detected