31static volatile uint32_t *adc = NULL;
33static const uint32_t twopow16 = 0b10000000000000000;
36 if (channel ==
ADC0) {
39 if (channel ==
ADC1) {
42 if (channel ==
ADC2) {
45 if (channel ==
ADC3) {
48 if (channel ==
ADC4) {
51 if (channel ==
ADC5) {
66 pynq_error(
"The ADC has not been initialized\n");
73 pynq_error(
"Invalid ADC channel %d\n", channel);
92 double value = adc[channel] * (3.23 / twopow16);
104 uint32_t value = adc[channel];
bool invalid_channel_adc(const adc_channel_t channel)
bool check_initialized_adc(void)
bool check_channel_adc(const adc_channel_t channel)
void adc_init(void)
Initialization of the ADC library.
bool initialized_adc(void)
Check if ADC has been initialized.
double adc_read_channel(const adc_channel_t channel)
uint32_t adc_read_channel_raw(adc_channel_t channel)
void adc_destroy(void)
De-initialize the ADC library and free up the used memory in the shared memory space.
adc_channel_t
Enumerate the different available ADC channels.
void arm_shared_close(arm_shared *handle)
void * arm_shared_init(arm_shared *handle, const uint32_t address, const uint32_t length)