libpynq (release 5EWC0-2023 version 0.2.3 of 2023-10-06 18:15)
Loading...
Searching...
No Matches
adc.h
Go to the documentation of this file.
1/*
2Copyright (c) 2023 Eindhoven University of Technology
3
4Permission is hereby granted, free of charge, to any person obtaining a copy
5of this software and associated documentation files (the "Software"), to deal
6in the Software without restriction, including without limitation the rights
7to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8copies of the Software, and to permit persons to whom the Software is
9furnished to do so, subject to the following conditions:
10
11The above copyright notice and this permission notice shall be included in all
12copies or substantial portions of the Software.
13
14THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
20SOFTWARE.
21*/
22#ifndef ADC_H
23#define ADC_H
24
25#include <stdbool.h>
26#include <stdint.h>
27
43typedef enum {
45 ADC0 = ((0x240 / 4) + 1),
47 ADC1 = ((0x240 / 4) + 9),
49 ADC2 = ((0x240 / 4) + 6),
51 ADC3 = ((0x240 / 4) + 15),
53 ADC4 = ((0x240 / 4) + 5),
55 ADC5 = ((0x240 / 4) + 13),
57
62extern bool initialized_adc(void);
63
67extern void adc_init(void);
68
73extern void adc_destroy(void);
74
82extern double adc_read_channel(adc_channel_t channel);
83
90extern uint32_t adc_read_channel_raw(adc_channel_t channel);
91
96#endif // ADC_H
void adc_init(void)
Initialization of the ADC library.
Definition adc.c:78
bool initialized_adc(void)
Check if ADC has been initialized.
Definition adc.c:57
double adc_read_channel(adc_channel_t channel)
Definition adc.c:87
uint32_t adc_read_channel_raw(adc_channel_t channel)
Definition adc.c:97
void adc_destroy(void)
De-initialize the ADC library and free up the used memory in the shared memory space.
Definition adc.c:80
adc_channel_t
Enumerate the different available ADC channels.
Definition adc.h:43
@ ADC5
Definition adc.h:55
@ ADC2
Definition adc.h:49
@ ADC4
Definition adc.h:53
@ ADC1
Definition adc.h:47
@ ADC3
Definition adc.h:51
@ ADC0
Definition adc.h:45