LukasBombach / de1

JavaScript API for the DE1 Espresso Machine
MIT License
21 stars 0 forks source link

Implement MMR (Memory Mapped Registers) read/write #27

Open oscar-b opened 4 years ago

oscar-b commented 4 years ago

We should implement support for MMR read/write. It's currently used for tank temp and fan temp in DE1 v1.1, and seems like it will be used more and more going forward.

Tcl implements:

proc mmr_read {address length}
proc mmr_write { address length value}

https://github.com/oscar-b/de1-mirror/blob/b492ab564ee7b34744b0a6fc6ac345b2a77594d3/bluetooth.tcl#L653-L687

The read is writing a "read request" and the result is delivered async on the BLE event loop:

https://github.com/oscar-b/de1-mirror/blob/b492ab564ee7b34744b0a6fc6ac345b2a77594d3/bluetooth.tcl#L2084-L2113