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

added ADC Module to Lizard #50

Merged
merged 9 commits into from
Jul 10, 2024
Merged

Conversation

JensOgorek
Copy link
Contributor

@JensOgorek JensOgorek commented Jun 28, 2024

Created a module that can read Analogue signals with the ESP32's ADC modules.
Crate ADC with adc = Adc() and read data with adc.read(adc_unit, channel, attenuation). The reading can be stopped with adc.stop() and the interval delay can be changed with adc.set_delay(value in ms) .
The exact GPIO to adc_channel configurations, attenuation levels and other requirements can be found in the ESP documentation.

Stable State:

  • ESP works under the usual conditions
  • ESP continues to work under the usual conditions while reading a signal with the ADC module
  • ESP continues to work under the usual conditions after reading a signal with the ADC module and the module being stopped.
  • ESP continues to work under the usual conditions when the reading of a pin failed (invalid parameters for the read or read_raw method).

Commit Messages:

  • added read with voltage output
  • added read_raw with bit output
  • added set_delay
  • added stop
  • added docs
  • added validation
  • added module in callable modules
  • changed misc

Feature request: #47

added read with voltage output
added read_raw with bit output
added set_delay
added stop
added docs
added validation
added module in callable modules
changed misc
@rodja rodja added the enhancement New feature or request label Jun 30, 2024
Copy link
Collaborator

@falkoschindler falkoschindler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed with @JensOgorek, we'd like to simplify API and implementation like this:

adc = Adc(channel, number[, attenuation])

# or property?
adc.attenuation = 0
adc.attenuation = 2.5
adc.attenuation = 6
adc.attenuation = 11

# or set method?
adc.set_attenuation(11)

# step function writes data to properties:
adc.raw_value: integer
adc.voltage: number

@JensOgorek
Copy link
Contributor Author

Updated to work with properties. The ADC module is now called like adc = Adc(channel, number[, attenuation]) and the values can be accessed with adc.raw_value and adc.voltage

@falkoschindler falkoschindler self-requested a review July 5, 2024 10:05
@JensOgorek
Copy link
Contributor Author

Changed the attenuation level input to match the attenuation db levels: 0, 2.5, 6 & 11

@falkoschindler falkoschindler modified the milestones: 0.1.12, 0.2.0 Jul 8, 2024
@falkoschindler falkoschindler merged commit b170a07 into zauberzeug:main Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants