libyggdrasil  v1.0.0
adc.hpp
Go to the documentation of this file.
1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * _____.___. .___ .__.__ *
3  * \__ | | ____ ____ __| _/___________ _____|__| | *
4  * / | |/ ___\ / ___\ / __ |\_ __ \__ \ / ___/ | | *
5  * \____ / /_/ > /_/ > /_/ | | | \// __ \_\___ \| | |__ *
6  * / ______\___ /\___ /\____ | |__| (____ /____ >__|____/ *
7  * \/ /_____//_____/ \/ \/ \/ *
8  * - Common - *
9  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
10  * This software can be used by students and other personal of the *
11  * Bern University of Applied Sciences under the terms of the MIT *
12  * license. *
13  * For other persons this software is under the terms of the GNU *
14  * General Public License version 2. *
15  * *
16  * Copyright © 2021, Bern University of Applied Sciences. *
17  * All rights reserved. *
18  * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
26 #pragma once
27 
28 #include <cpp/common/registers.hpp>
30 
31 namespace bsp::drv {
32 
38  template<auto Context, template<auto, u8, u32, u32> typename ADCChannelImpl>
39  struct ADConverter {
40  ADConverter() = delete;
41  ADConverter(const ADConverter&) = delete;
42  ADConverter(ADConverter &&) = delete;
43 
50  template<u8 Index, u32 Offset = 0, u32 MaxValue = (1 << 12) - 1>
51  static inline auto Channel = ADCChannelImpl<Context, Index, Offset, MaxValue>();
52  };
53 
54 }
u8
uint8_t u8
Unsigned integer definitions.
Definition: types.h:36
bsp::drv::ADConverter::Channel
static auto Channel
Channel implementation.
Definition: adc.hpp:51
u32
uint32_t u32
Definition: types.h:38
bsp::drv::ADConverter
Base class for ADC abstraction.
Definition: adc.hpp:39
registers.hpp
Zero-cost abstraction for accessing registers and bits/bitfields within them.
attributes.hpp
Commonly used C++ and GNU attributes.
bsp::drv
Definition: display.hpp:37
bsp::drv::ADConverter::ADConverter
ADConverter(const ADConverter &)=delete
bsp::drv::ADConverter::ADConverter
ADConverter()=delete
bsp::drv::ADConverter::ADConverter
ADConverter(ADConverter &&)=delete