ah- / anne-key

Firmware for Anne Pro Keyboard written in Rust
Apache License 2.0
567 stars 32 forks source link

Implement Bluetooth Setup Mode #28

Open ah- opened 6 years ago

ah- commented 6 years ago

We have a mostly working implementation of bluetooth pairing etc. Talking to the BT controller works, and I have managed to pair with my laptop.

It'd be nice to implement the full workflow, and control the LEDs upon entering BT setup mode, display the BTHostListQuery result, and use the same keymap as the original FW.

hdhoang commented 6 years ago

My pairing experience:

  1. Anne: turn on broadcast
  2. Host: scan and initiate pairing
  3. Anne: leave BT layer to regain normal number keys (I also press Fn once to make sure I'm in BASE layer, but this is possibly a bug in my layout modification)
  4. Anne: punch in the 6-digit code

Without step 3, the keys 1~4 and 0 ends the pairing session, since they invoke other bluetooth actions. It would be best if the MCU can get some indication from BLE chip to switch to BASE and highlight the number keys like stock does.

ah- commented 6 years ago

I think it does get that indication, via BleOp::Pair here: https://github.com/ah-/anne-key/blob/master/src/bluetooth.rs#L177

Not quite sure yet how to best build the pin input mode. Sending the LED update to highlight the num keys should be easy though.

ah- commented 6 years ago

Connection state feedback works now (apart from having to manually press left ctrl sometimes to make it update). Started building the pin entry mode, but it doesn't quite work correctly yet.