Tympan / Tympan_Library

Arduino/Teensy Library for Tympan Open Source Hearing Aid
MIT License
116 stars 31 forks source link

Feature teensy4 sd ble #42

Closed biomurph closed 2 years ago

biomurph commented 2 years ago

Added support for Tympan Rev D board variant used in 9 units of the CCP/Dosimeter production run. This adds checking a pin value to determine target board variant and sets pins accordingly.

  1. Shield AIC reset pin selection
  2. I2C bus selection
  3. littleLED control pin
biomurph commented 2 years ago

I'm resisting hitting the merge button until someone else has a look at the changes. Potential gotcha: The board variant that is being accommodated uses the same pin for nRESET on the main board AIC and the Shield AIC. Depending on the setup of each AIC, there may be an inadvertent reset during setup? Please check

chipaudette commented 2 years ago

Is AICSHIELD_I2C_BUS_SET_INTERNAL being used anywhere? Can it be removed?

chipaudette commented 2 years ago

Also, while I agree with our goal to hide from the user the fact that the RevD is actually a different RevD, the code is really designed so that we should be treating this as a different RevD (like a "D5" or something). Its pins are different so, really, it's a different RevD. The code is totally setup to allow for different pins, if we accept that it's a different RevD. This would allow us to avoid the kuldging that is happening here to autodetect that it is a weirdo RevD.

Unfortunately, I don't know how to have it both be declared as a different RevD while simultaneously hiding that fact from the user. So, we shall kludge!

Regarding this:

Depending on the setup of each AIC, there may be an inadvertent reset during setup? Please check

Have you tried it on your hardware? Does it work on your hardware? Other than it working (or not), what are you suggesting that we check?

biomurph commented 2 years ago

Is AICSHIELD_I2C_BUS_SET_INTERNAL being used anywhere? Can it be removed?

This define is used when the code calls setI2Cbus(int) in controlAIC3206.cpp If that function is disapering, then we can forget it. The other functionalities are all contained in the AICShield.h and AICShield.cpp

biomurph commented 2 years ago

Also, while I agree with our goal to hide from the user the fact that the RevD is actually a different RevD, the code is really designed so that we should be treating this as a different RevD (like a "D5" or something). Its pins are different so, really, it's a different RevD. The code is totally setup to allow for different pins, if we accept that it's a different RevD. This would allow us to avoid the kuldging that is happening here to autodetect that it is a weirdo RevD.

Unfortunately, I don't know how to have it both be declared as a different RevD while simultaneously hiding that fact from the user. So, we shall kludge!

Regarding this:

Depending on the setup of each AIC, there may be an inadvertent reset during setup? Please check

Have you tried it on your hardware? Does it work on your hardware? Other than it working (or not), what are you suggesting that we check?

I think that you are kind of right that it is a different Rev D, however it will only ever be encountered in the 9 Dosimeter units that I am shipping to you this week. That's why I was adding in the kludgey library support. It will only ever be encountered when re-programming Dosimeters.

and regarding the test of AIC reset. I have not tested it. I think the question I have is that if you set the board AIC to do something fun and the Shield AIC to do something different, but also fun, would the reset operation 'erase' the fun thing that you just set up on one of them? Again, this is ONLY going to affect 9 of the Dosimeter units, so if the use case for Dosimeters is not affected then we can let it go.

chipaudette commented 2 years ago

and regarding the test of AIC reset. I have not tested it. I think the question I have is that if you set the board AIC to do something fun and the Shield AIC to do something different, but also fun, would the reset operation 'erase' the fun thing that you just set up on one of them?

To be truthful, I don't really know what the reset pin does. Presumably, it resets the AIC, meaning the AIC will lose all of its settings. Therefore, if you setup the first AIC and then go to setup the second AIC (which, I believe, fires the reset pulses), it will likely clear out the first AIC. This seems bad. This was your fear. I think that I agree with your fear.

It should be tested to see if our concern is real or not.

I myself don't have any dosimeter shields that work. I do have some AIC shields that work, so I can try one of those as a stand-in for the dosimeter shield. It's not something that I can do super-fast, however. Do you have any AIC shields?

chipaudette commented 2 years ago

Oh, but this'll be tricky for me to test since I don't have a modified RevD.

One could test just the reset question, though....does flicking an AICs reset pin after it is set up clear out its settings? That can be tested with any RevD.

biomurph commented 2 years ago

I am packing up the lot of MNoise Dosimeters to ship out to you and Eric today, so you will have them quite soon. I will put a note on the variant units to differentiate them.