3.1.2. analog_input_pin — Analog input pin

Source code: src/drivers/basic/analog_input_pin.h, src/drivers/basic/analog_input_pin.c

Test code: tst/drivers/hardware/basic/analog_input_pin/main.c


Functions

int analog_input_pin_module_init(void)

Initialize the analog input pin module. This function must be called before calling any other function in this module.

The module will only be initialized once even if this function is called multiple times.

Return
zero(0) or negative error code.

int analog_input_pin_init(struct analog_input_pin_t *self_p, struct pin_device_t *dev_p)

Initialize given driver object with given device and mode.

Return
zero(0) or negative error code.
Parameters
  • self_p: Driver object to be initialized.
  • dev_p: Device to use.

int analog_input_pin_read(struct analog_input_pin_t *self_p)

Read the current value of given pin.

Return
Analog pin value, otherwise negative error code.
Parameters
  • self_p: Driver object.

int analog_input_pin_read_isr(struct analog_input_pin_t *self_p)

Read the current value of given pin from an isr or with the system lock taken.

Return
Analog pin value, otherwise negative error code.
Parameters
  • self_p: Driver object.

struct analog_input_pin_t
#include <analog_input_pin.h>

Public Members

struct adc_driver_t adc