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