PSoC 6 Hardware Abstraction Layer (HAL)

General Description

Functions

cy_rslt_t cyhal_adc_channel_init (cyhal_adc_channel_t *obj, cyhal_adc_t *adc, cyhal_gpio_t pin)
 
void cyhal_adc_channel_free (cyhal_adc_channel_t *obj)
 
uint16_t cyhal_adc_read_u16 (const cyhal_adc_channel_t *obj)
 

Function Documentation

◆ cyhal_adc_channel_init()

cy_rslt_t cyhal_adc_channel_init ( cyhal_adc_channel_t *  obj,
cyhal_adc_t *  adc,
cyhal_gpio_t  pin 
)

Initialize a single-ended ADC channel.

Configures the pin used by ADC.

Parameters
[out]objThe adc channel object to initialize
[in]adcThe adc for which the channel should be initialized
[in]pinThe adc pin name
Returns
The status of the init request

◆ cyhal_adc_channel_free()

void cyhal_adc_channel_free ( cyhal_adc_channel_t *  obj)

Uninitialize the ADC channel and cyhal_adc_channel_t object

Parameters
[in,out]objThe ADC channel object

◆ cyhal_adc_read_u16()

uint16_t cyhal_adc_read_u16 ( const cyhal_adc_channel_t *  obj)

Read the value from ADC pin, represented as an unsigned 16bit value where 0x0000 represents the minimum value in the ADC's range, and 0xFFFF represents the maximum value in the ADC's range.

Parameters
[in]objThe ADC object
Returns
An unsigned 16bit value representing the current input voltage