aboutsummaryrefslogtreecommitdiffstats
path: root/source/adc.hpp
diff options
context:
space:
mode:
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 *);
};