Closed CasperBroekhuizen closed 4 years ago
Sounds good! We will need more measurements in the future (like the voltage supply of the watchdog)
Initial version of idea. Only handles the MEM- ADC for the temperature, more measurements should be added in MEM1 -> MEM2 -> etc. in order to do sequential measurements without a gap in the memory configuration. https://github.com/DelfiSpace/DelfiPQcore/commit/920bdc16a30876c8e364a959e0800e18c68e8fbf
I see a potential clash if we port the code to the HPI and want to reuse the HWMonitor, but maybe there could be an easy way out... Maybe we can add an issue on HPI and close this one if we are confident.
I also see float being returned which is scary as the FPU can be turned off (I think this is one possibility) but I do not see any other way for calibrating the temperature sensor.
I agree, there is a clash currently with the HPI measurement function, as it 'takes' the ADC14 module. This is however one of the primary reasons for creating this object. The purpose of wrapping the ADC module is that we can expose it for multiple functions. But indeed, this means the HPI TestService has to be updated to work with this object.
I also don't like the use of the floating point unit, however as you indeed mentioned, it is used to calibrate the temperature sensor values.
The use of floating-point is also recommended in the example applications from TI, so not much else to say. The FPU can be disabled but this is done by the compiler. In case the FPU is disabled, software floating-point calculations will be implemented (see section 2.2.5.7 of the SLAU356F for details).
I will add an issue on the HPI software to merge the HW monitor and the ADC. We can close this issue.
Since more places are integrating the ADC14 Module of the Chip, maybe consider a wrapper object around it.
This object would manage which of the ADC pins are enabled and stores the measurements. That way, when a service or task asks wants to do a measurement it won't disable any other measurements, by reconfiguring the 'global' ADC14 Module