Test program done

This commit is contained in:
Luca Lizaranzu
2026-03-20 11:41:44 -07:00
parent 303a554595
commit 1b29371fff
20 changed files with 1037 additions and 114 deletions

View File

@@ -16,19 +16,21 @@ class SHAL_ADC {
public:
SHAL_Result init(ADC_Key key);
SHAL_Result init(ADC_Key key, SHAL_ADC_Sample_Mode mode);
SHAL_Result calibrate();
SHAL_Result calibrate(SHAL_ADC_Sample_Mode sampleMode) const;
SHAL_Result configureResolution(SHAL_ADC_Resolution resolution);
SHAL_Result configureResolution(SHAL_ADC_Resolution resolution) const;
SHAL_Result configureAlignment(SHAL_ADC_Alignment alignment);
SHAL_Result configureAlignment(SHAL_ADC_Alignment alignment) const;
SHAL_Result preselectChannel(SHAL_ADC_Channel channel) const;
/// Performs analog to digital conversion on a single channel, one time
/// \param channel Channel to be converted
/// \param time SHAL_ADC_SampleTime - amount of clock cycles per conversion
/// \return resulting value
uint16_t singleConvertSingle(SHAL_ADC_Channel channel, SHAL_ADC_SampleTime time = SHAL_ADC_SampleTime::C8);
uint32_t singleConvertSingle(SHAL_ADC_Channel channel, SHAL_ADC_SampleTime time = SHAL_ADC_SampleTime::C8) const;
/// Performs analog to digital conversion on multiple channels, one time
/// \param channels Pointer to an array of channels to convert
@@ -46,29 +48,29 @@ private:
ADC_Key m_ADCKey = ADC_Key::INVALID;
//Checks to see if instance is initialized with a proper ADC peripheral tag
bool isValid();
bool isValid() const;
//Enabled peripheral
SHAL_Result enable();
SHAL_Result enable() const;
//Disables peripheral
SHAL_Result disable();
SHAL_Result disable() const;
//Wake up ADC from initial deep sleep state
SHAL_Result wakeFromDeepSleep();
SHAL_Result wakeFromDeepSleep() const;
SHAL_Result startConversion();
SHAL_Result startConversion() const;
/// Adds an ADC channel to the conversion sequence
/// \param channel Channel to add
/// \param index Index to add channel to (ADC channel will be the nth channel to convert
/// \param conversionNumber Index to add channel to (ADC channel will be the nth channel to convert
/// \return Result
SHAL_Result addADCChannelToSequence(SHAL_ADC_Channel channel, uint32_t index);
SHAL_Result addADCChannelToSequence(SHAL_ADC_Channel channel, uint32_t conversionNumber) const;
/// Sets the amount of ADC channels to convert
/// \param amount Number of channels to convert
/// \return
SHAL_Result setADCSequenceAmount(uint32_t amount);
SHAL_Result setADCSequenceAmount(uint32_t amount) const;
};
@@ -83,7 +85,6 @@ public:
static SHAL_ADC& getByIndex(int index);
ADCManager() = delete;
private: