libyggdrasil  v1.0.0
dac.h
Go to the documentation of this file.
1  /* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
2  * _____.___. .___ .__.__ *
3  * \__ | | ____ ____ __| _/___________ _____|__| | *
4  * / | |/ ___\ / ___\ / __ |\_ __ \__ \ / ___/ | | *
5  * \____ / /_/ > /_/ > /_/ | | | \// __ \_\___ \| | |__ *
6  * / ______\___ /\___ /\____ | |__| (____ /____ >__|____/ *
7  * \/ /_____//_____/ \/ \/ \/ *
8  * - Midgard - *
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 #include <c/common/types.h>
27 
28 #include <stm32f7xx_hal.h>
29 
33 typedef struct {
34  DAC_HandleTypeDef *interface;
38 } dac_t;
39 
47 
55 
62 C_LINKAGE void yggdrasil_DAC_Write(dac_t dac, float value);
63 
types.h
Commonly used type definitions and helper templates.
dac_t::interface
DAC_HandleTypeDef * interface
Definition: dac.h:34
u16
uint16_t u16
Definition: types.h:37
u8
uint8_t u8
Unsigned integer definitions.
Definition: types.h:36
dac_t
DAC handle type.
Definition: dac.h:33
yggdrasil_DAC_Read
C_LINKAGE float yggdrasil_DAC_Read(dac_t dac)
Get the dac value from the channel specified in the DAC handle.
Definition: dac.cpp:61
yggdrasil_DAC_Init
C_LINKAGE bool yggdrasil_DAC_Init(dac_t dac)
DAC init function.
Definition: dac.cpp:38
dac_t::channel
u8 channel
Definition: dac.h:35
dac_t::maxValue
u16 maxValue
Definition: dac.h:37
dac_t::offset
u16 offset
Definition: dac.h:36
yggdrasil_DAC_Deinit
C_LINKAGE bool yggdrasil_DAC_Deinit(dac_t dac)
DAC deinit function.
Definition: dac.cpp:42
yggdrasil_DAC_Write
C_LINKAGE void yggdrasil_DAC_Write(dac_t dac, float value)
Set the dac value to the channel specified in the DAC handle.
Definition: dac.cpp:54
C_LINKAGE
#define C_LINKAGE
Definition: attributes.h:43