Tympan / Tympan_Sandbox

Working Files
2 stars 2 forks source link

nRF52840 Firmware: add ability to query which pin is the "connected" #8

Open chipaudette opened 2 months ago

chipaudette commented 2 months ago

Problem: Currently, I have to hard-code which Teensy pin # is being used by the nRF unit to communicate the "isConnected" state.

Option 1: Since I need to know the Teensy pin number, and since the Teensy pin number is defined by the Tympan hardware design, this piece of information would normally be placed in the TympanPins class for the RevF variant.

Option 2: The Tympan RevF has many GPIO lines connecting between the Teensy and the nRF52840 bluetooth module. It's the nRF firmware that (currently, V0.2.4) chooses which of these pins is used to convey the isConnected() state. Since it is set by the nRF firmware, it seems like the Teensy ought to be able to query the nRF to ask it which pin to use. The nRF would then tell the Teensy which of its pins to use to read isConnected().

Option 3: Clearly, both the Tympan hardware design and the nRF firmware affect which Teensy pin is being used. Therefore, the most robust, general solution would be for the nRF firmware to report some sort of name for the connection that it has selected for conveying isConnected(). Then, the TympanPins class would hold a mapping between all of the GPIO names and the Teensy pin #. This is a lot of work, though, with lots of options for failing.

Because of the risk of introducing more problems than I'm fixing, I think that I will not start with Option 3 and simply stick with Option 2.

biomurph commented 2 months ago

Interesting problem. I would offer another option Option 4: The Tympan RefF can tell the nRF radio which pin to use for isConnected. This would give the most control over the pins, I think?