libyggdrasil  v1.0.0
dac.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 
39  template<auto Context, template<auto, u8, u32, u32> typename DACChannelImpl>
40  struct DAConverter {
41  DAConverter() = delete;
42  DAConverter(const DAConverter&) = delete;
43  DAConverter(DAConverter &&) = delete;
44 
52  template<u8 Index, u32 Offset = 0, u32 MaxValue = (1 << 12) - 1>
53  static inline auto Channel = DACChannelImpl<Context, Index, Offset, MaxValue>();
54  };
55 
56 }
u8
uint8_t u8
Unsigned integer definitions.
Definition: types.h:36
u32
uint32_t u32
Definition: types.h:38
bsp::drv::DAConverter::DAConverter
DAConverter(const DAConverter &)=delete
bsp::drv::DAConverter::Channel
static auto Channel
Channel implementation.
Definition: dac.hpp:53
registers.hpp
Zero-cost abstraction for accessing registers and bits/bitfields within them.
bsp::drv::DAConverter::DAConverter
DAConverter()=delete
attributes.hpp
Commonly used C++ and GNU attributes.
bsp::drv
Definition: display.hpp:37
bsp::drv::DAConverter::DAConverter
DAConverter(DAConverter &&)=delete
bsp::drv::DAConverter
Base class for DAC abstraction.
Definition: dac.hpp:40