Skip to content

ADC1? #684

ADC1? #684
Apr 9, 2022 · 3 comments · 5 replies
Discussion options

You must be logged in to vote

Well, you would probably start with analogRead()....

  int analogRead(uint8_t pin) {

    check_valid_analog_pin(pin); //This would have to go because it has a different set of pins
    if (pin < 0x80) {
      // If high bit set, it's a channel, otherwise it's a digital pin so we look it up..
      pin = digitalPinToAnalogInput(pin); //Uhoh! We can't use a pin number here, because it will look up the pin for ADC0
    }

// this check isn't very important
    #if (PROGMEM_SIZE > 4096)
      // don't waste flash on smallest parts.
      if ((pin & 0x7F) > 0x1F) { // highest valid mux value for any 0 or 1-series part.
        return ADC_ERROR_BAD_PIN_OR_CHANNEL;
      }
    #endif
// End of …

Replies: 3 comments 5 replies

Comment options

You must be logged in to vote
1 reply
@SpenceKonde
Comment options

Answer selected by mechatroniks-git
Comment options

You must be logged in to vote
3 replies
@SpenceKonde
Comment options

@mechatroniks-git
Comment options

@SpenceKonde
Comment options

Comment options

You must be logged in to vote
1 reply
@SpenceKonde
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants