I have been developing software driver for the analog to digital converter in C++. The a/d converter is primary intended for conversion of the temperature signals. The temperature signals are then used for the algorithms of temperature protections. My goal is to design the driver interface in such a manner that the driver can be used in the RTOS based application and also in the bare metal application.
Based on the above mentioned requirements I have designed the interface of the driver in this manner
So my intention is to use a sort of buffering of the samples of the analog signals in the internal array analog_inputs
. The idea is that the client software calls the initialize
method for initialization of the adc peripheral and then calls the update
method from within a RTOS task or from timer interrupt service routine. The periodic call of the update
method (which basically calls the startConversion
method) results in periodic invoking of the endOfConversionCallback
"behind the scene". Here the analog_inputs
array is filled by the samples. In case the isReady
method returns true the analog_inputs
array contains first samples of all the analog inputs and the client can start to access them via the getRawValue
mehod call.
My question is whether you think that the approach which I have suggested above is suitable for my requirements or whether you see any potential problems in this approach?