libpynq (release 5EWC0-2023 version 0.2.2 of 2023-09-24 22:22)
Loading...
Searching...
No Matches
ADC library

Enumerations

enum  adc_channel_t {
  ADC0 = ((0x240 / 4) + 1) , ADC1 = ((0x240 / 4) + 9) , ADC2 = ((0x240 / 4) + 6) , ADC3 = ((0x240 / 4) + 15) ,
  ADC4 = ((0x240 / 4) + 5) , ADC5 = ((0x240 / 4) + 13)
}
 

Functions

bool initialized_adc (void)
 
void adc_init (void)
 
void adc_destroy (void)
 
double adc_read_channel (adc_channel_t channel)
 
uint32_t adc_read_channel_raw (adc_channel_t channel)
 

Detailed Description

Functions to use the Analog to Digital Conversion (ADC) of analog pins (A0..A5).

Note that GPIO numbering (SWB_A0..SWB_A5) used in gpio.h and pinmap.h is different from A0..A5.

Enumeration Type Documentation

◆ adc_channel_t

Enumerate the different available ADC channels.

Enumerator
ADC0 

ADC channel for pin SWB_A0

ADC1 

ADC channel for pin SWB_A1

ADC2 

ADC channel for pin SWB_A2

ADC3 

ADC channel for pin SWB_A3

ADC4 

ADC channel for pin SWB_A4

ADC5 

ADC channel for pin SWB_A5

Definition at line 43 of file adc.h.

Function Documentation

◆ adc_destroy()

void adc_destroy ( void  )

De-initialize the ADC library and free up the used memory in the shared memory space.

Definition at line 80 of file adc.c.

Here is the call graph for this function:

◆ adc_init()

void adc_init ( void  )

Initialization of the ADC library.

Definition at line 78 of file adc.c.

Here is the call graph for this function:

◆ adc_read_channel()

double adc_read_channel ( adc_channel_t  channel)
Parameters
channelThe channel to read the analog value from. Read ADC channel #channel and return the read out voltage.
Returns
a value between 0.0 and 3.3V.
Warning
Fails with program exit when channel is outside valid range or has not been initialized..

Definition at line 87 of file adc.c.

Here is the call graph for this function:

◆ adc_read_channel_raw()

uint32_t adc_read_channel_raw ( adc_channel_t  channel)
Parameters
channelThe channel to read the analog value from. Read ADC channel #channel and return the raw value.
Returns
a value between 0 and 65535.
Warning
Fails with program exit when channel is outside valid range.

Definition at line 97 of file adc.c.

Here is the call graph for this function:

◆ initialized_adc()

bool initialized_adc ( void  )

Check if ADC has been initialized.

Returns
True when initialized, false otherwise.

Definition at line 57 of file adc.c.

Here is the caller graph for this function: