libyggdrasil
v1.0.0
adc.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
ADC_HandleTypeDef *
interface
;
35
u8
channel
;
36
37
u16
offset
;
38
u16
maxValue
;
39
}
adc_t
;
40
47
C_LINKAGE
bool
yggdrasil_ADC_Init
(
adc_t
adc);
48
55
C_LINKAGE
bool
yggdrasil_ADC_Deinit
(
adc_t
adc);
56
63
C_LINKAGE
float
yggdrasil_ADC_Read
(
adc_t
adc);
types.h
Commonly used type definitions and helper templates.
u16
uint16_t u16
Definition:
types.h:37
yggdrasil_ADC_Read
C_LINKAGE float yggdrasil_ADC_Read(adc_t adc)
Get the adc value from the channel specified in the ADC handle.
Definition:
adc.cpp:71
u8
uint8_t u8
Unsigned integer definitions.
Definition:
types.h:36
yggdrasil_ADC_Init
C_LINKAGE bool yggdrasil_ADC_Init(adc_t adc)
ADC init function.
Definition:
adc.cpp:38
adc_t::offset
u16 offset
Definition:
adc.h:37
adc_t
ADC handle type.
Definition:
adc.h:33
adc_t::maxValue
u16 maxValue
Definition:
adc.h:38
adc_t::channel
u8 channel
Definition:
adc.h:35
yggdrasil_ADC_Deinit
C_LINKAGE bool yggdrasil_ADC_Deinit(adc_t adc)
ADC deinit function.
Definition:
adc.cpp:42
C_LINKAGE
#define C_LINKAGE
Definition:
attributes.h:43
adc_t::interface
ADC_HandleTypeDef * interface
Definition:
adc.h:34
Inc
c
midgard
driver
adc.h
Generated by
1.8.20