Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cm3cpp_adc_dma.h - github.com/thirdpin/libopencm3_cpp_extensions.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 68565cdefd311eafd1f2afe3559e66a256ae2704 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#ifndef CM3CPP_ADC_DMA_H_
#define CM3CPP_ADC_DMA_H_

#include <cstring>
#include <libopencm3/stm32/dma.h>

#include "cm3cpp_adc.h"
#include "private/assert.h"

namespace cm3cpp {

namespace adc {

class AdcDma
{
 public:
    struct DmaConf
    {
        uint32_t number;
        uint32_t stream;
        uint32_t channel;
    };

    struct AdcConf
    {
        Adc::Number number;
        Adc::Channel* channels;
        uint8_t channels_count;
    };

    AdcDma(DmaConf dma, AdcConf adc, bool is_temp_sensor);

    CM3CPP_EXPLISIT_DESTRUCTOR(AdcDma)

    uint16_t get_value(uint8_t index);

 private:
    Adc* _adc;
    uint16_t* _data;
};

}  // namespace adc

}  // namespace cm3cpp

#endif /* CM3CPP_ADC_DMA_H_ */