Finished ADC, updating timer code

This commit is contained in:
Ea-r-th
2025-10-17 00:59:12 -07:00
parent af21480aff
commit 6c8fa459f8
14 changed files with 267 additions and 164 deletions

View File

@@ -81,8 +81,8 @@ SHAL_ADC_Config_Reg getADCConfigReg(ADC_Key key) {
return res;
}
SHAL_ADC_ISR getADCISR(ADC_Key key){
SHAL_ADC_ISR res = {nullptr, ADC_ISR_EOC};
SHAL_ADC_ISR_Reg getADCISRReg(ADC_Key key){
SHAL_ADC_ISR_Reg res = {nullptr, ADC_ISR_EOC, ADC_ISR_EOS, ADC_ISR_ADRDY};
res.reg = &(ADC_TABLE[static_cast<uint8_t>(key)]->ISR);
return res;

View File

@@ -35,7 +35,7 @@ public:
/// \param numChannels Number of channels to convert
/// \param result Pointer to store converted channel results in
/// \param time SHAL_ADC_SampleTime - amount of clock cycles per conversion
void multiConvertSingle(SHAL_ADC_Channel* channels, int numChannels, uint16_t* result, SHAL_ADC_SampleTime time = SHAL_ADC_SampleTime::C8);
SHAL_Result multiConvertSingle(SHAL_ADC_Channel* channels, int numChannels, uint16_t* result, SHAL_ADC_SampleTime time = SHAL_ADC_SampleTime::C8);
@@ -48,9 +48,14 @@ private:
//Checks to see if instance is initialized with a proper ADC peripheral tag
bool isValid();
//Enabled peripheral
SHAL_Result enable();
//Disables peripheral
SHAL_Result disable();
SHAL_Result startConversion();
/// 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

View File

@@ -44,9 +44,11 @@ struct SHAL_ADC_Data_Reg {
};
//Register for the interrupt service routine for ADCs
struct SHAL_ADC_ISR {
struct SHAL_ADC_ISR_Reg {
volatile uint32_t* reg;
uint32_t end_of_conversion_mask;
uint32_t end_of_sequence_mask;
uint32_t ready_mask;
};
//Register controlling the clock source for the ADC