aboutsummaryrefslogtreecommitdiffstats
path: root/source/adc.hpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2021-01-23 09:59:11 -0500
committerClyne Sullivan <clyne@bitgloo.com>2021-01-23 09:59:11 -0500
commit564e20975b670d4bee1de525e9a25c33730fd7c2 (patch)
tree52a61fc5cc67334e8fe257ddc375d78f3e3dfc77 /source/adc.hpp
parent74abc8d4b3ebabfac286cccc27ced565330eac4f (diff)
untested port cleanup; add sclock; up cpu to 480M
Diffstat (limited to 'source/adc.hpp')
-rw-r--r--source/adc.hpp23
1 files changed, 4 insertions, 19 deletions
diff --git a/source/adc.hpp b/source/adc.hpp
index 5f9dc23..96fe506 100644
--- a/source/adc.hpp
+++ b/source/adc.hpp
@@ -13,6 +13,7 @@
#define STMDSP_ADC_HPP_
#include "hal.h"
+#include "sclock.hpp"
#include <array>
@@ -21,42 +22,26 @@ class ADC
public:
using Operation = void (*)(adcsample_t *buffer, size_t count);
- enum class Rate : int {
- R8K = 0,
- R16K,
- R20K,
- R32K,
- R48K,
- R96K
- };
-
static void begin();
static void start(adcsample_t *buffer, size_t count, Operation operation);
static void stop();
- static void setRate(Rate rate);
+ static void setRate(SClock::Rate rate);
static void setOperation(Operation operation);
- static int getRate();
- static unsigned int getTimerDivisor();
-
private:
static ADCDriver *m_driver;
- static GPTDriver *m_timer;
static const ADCConfig m_config;
- static /*const*/ ADCConversionGroup m_group_config;
- static const GPTConfig m_timer_config;
+ static const ADCConversionGroup m_group_config;
- static std::array<std::array<uint32_t, 4>, 6> m_rate_presets;
+ static std::array<std::array<uint32_t, 2>, 6> m_rate_presets;
static adcsample_t *m_current_buffer;
static size_t m_current_buffer_size;
static Operation m_operation;
- static unsigned int m_timer_divisor;
-
static void conversionCallback(ADCDriver *);
};