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: 6bb6ee16498fe63690e699e041a3c39360bc03b4 (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
47
#ifndef CM3CPP_ADC_DMA_H_
#define CM3CPP_ADC_DMA_H_

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

#include "private/assert.h"
#include "cm3cpp_adc.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_ */