Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reimplement ADC HAL #163

Merged
merged 6 commits into from
Mar 13, 2021
Merged

Reimplement ADC HAL #163

merged 6 commits into from
Mar 13, 2021

Commits on Mar 13, 2021

  1. generic: adc: Refactor ADC HAL

    Reimplement the ADC HAL with a design similar to the other new
    implementations.  This means we have a common `Adc<...>` type defined in
    avr-hal-generic which internally uses a concrete ADC peripheral which
    implements the `AdcOps` trait.
    
    Additionally, an `AdcChannel` trait is used to mark channels which can
    be used with a certain ADC.
    Rahix committed Mar 13, 2021
    Configuration menu
    Copy the full SHA
    60f66a1 View commit details
    Browse the repository at this point in the history
  2. generic: port: Implement ADC pins

    Add necessary plumbing to use IO pins as ADC channels.  This consists
    of:
    
     - The `into_analog_input()` method to "convert" an IO pin into an ADC
       channel.  Under the hood, this sets the "DIDR" (Digital Input
       Disable) bit.
    
     - The `analog_read()` method for ADC pins.  This is sugar for calling
       `adc.read_blocking(&pin)`, to provide an API that's close the the one
       commonly used in the Arduino world.
    Rahix committed Mar 13, 2021
    Configuration menu
    Copy the full SHA
    aa754e2 View commit details
    Browse the repository at this point in the history
  3. atmega-hal: Add ADC support

    Implement ADC support for all currently supported ATmega
    microcontrollers.
    Rahix committed Mar 13, 2021
    Configuration menu
    Copy the full SHA
    e638e68 View commit details
    Browse the repository at this point in the history
  4. arduino-hal: Reexport ADC types and module

    Reexport the `adc` module from the HAL crate to make the ADC easily
    usable.
    Rahix committed Mar 13, 2021
    Configuration menu
    Copy the full SHA
    631f2d4 View commit details
    Browse the repository at this point in the history
  5. adc: Add "dynamic" Channel type

    Add a type that can represent any channel for e.g. storing a list of
    channels in an array.
    
    Ref: #33
    Rahix committed Mar 13, 2021
    Configuration menu
    Copy the full SHA
    749dcc5 View commit details
    Browse the repository at this point in the history
  6. examples: Add ADC examples

    Add ADC examples for all boards to demonstrate how to read from the
    analog pins.
    Rahix committed Mar 13, 2021
    Configuration menu
    Copy the full SHA
    af926bd View commit details
    Browse the repository at this point in the history