ADC

ADC(etp)

Methods:

Name Description
ctrl

Control ADC pin.

get_info

Query ADC information.

init

Enable/Disable ADC pins.

read

Read data from ADC pin.

ctrl

ctrl(pin: str, **kwargs) -> int

Control ADC pin.

Parameters:
  • pin (str) –

    ADC pin to control.

  • **kwargs (dict, default: {} ) –

    Keyword arguments.

**kwargs:
  • resolution (int) –

    Resolution of ADC pin. Defaults to self.resolution.

  • reference_mv (int) –

    Reference voltage of ADC pin. Defaults to self.reference_mv.

  • rate (int) –

    Sampling rate of ADC pin. Defaults to 1000.

  • start (int) –

    Start value of ADC pin. Defaults to 0.

Returns:
  • int

    Status code.

get_info

get_info() -> dict

Query ADC information.

Returns:
  • dict( dict ) –

    Dictionary containing ADC information of the following format:

    Key Value Type Description
    num_adc int Number of ADCs
    num_channels int Number of channels
    resolution int Resolution of ADC
    reference int Reference voltage of ADC
    max_rate int Maximum sampling rate of ADC
    port_count int Number of ADC ports
    ports list List of ADC ports and their corresponding pins

init

init(pin_list: dict) -> int

Enable/Disable ADC pins.

Parameters:
  • pin_list (dict) –

    Dictionary of pins to enable/disable.

read

read(pin: str) -> int

Read data from ADC pin.

Parameters:
  • pin (str) –

    ADC pin to read from.

Returns:
  • int

    ADC value read from the pin.