WildernessLabs / Documentation

Wilderness Labs Docs
https://developer.wildernesslabs.co/
63 stars 48 forks source link

Questions: interrupt groups, PWM channels, and pin uses #270

Open patridge opened 3 years ago

patridge commented 3 years ago

I had several questions that could be worth addressing in the docs. Even if not, I'd certainly love to learn some more about these concepts.

Relevant pages

If it helps, most of the questions came up from reading these page sections.

I could have very easily missed details elsewhere that could be linked from these sections to help future docs users.

Questions

  1. If I put two digital inputs on the same interrupt group (e.g., button on D05 and button on D07, both interrupt group 07), what are the symptoms? Compiler error (if not, could it be an error/warning)? Does only one input work? If only one input, which one wins, or is it like a ghosting/masking issue where only one works at a time?
    1. Does this all apply to digital outputs on the same interrupt group too?
  2. Similarly, on the PWM groupings, what are the symptoms of putting two PWM inputs/outputs on the same PWM group (e.g., D12 and D13 on PWM group 12)?
  3. Are all analog-capable pins independent?
  4. What are DAC pins compared to the other analog pins?
    1. Could someone use DAC pins to automatically get a more digital (on/off) signal out of an analog joystick, for example?
  5. If MOSI and MISO are also on interrupt groups, can someone use those pins just like any other digital pin [without involving SPI]?
  6. Based on that docs diagram, are D06 and D09 also capable as analog pins?
    1. If so, are there any special considerations when using D06 and D09 as analog pins?
  7. Are these interrupt and PWM groups developer-configurable? Or could they potentially change from one version of Meadow OS to another (or ESP update)?
  8. Are the groups and timer channels correct in the Digital IO docs or the IO basics table? (For example, they appear to differ on pin D10 for PWM.)
ctacke commented 3 years ago

Some of these are better answered by others, or will require digging into the code, but I can answer a few offhand.

  1. Interrupt group is checked at runtime. The compiler has no concept of them. You'll get an InterruptGroupInUseException on attempting to connect the second interrupt that will say something along the lines of "Interrupt Group X is in use". This only affects pins that are configured as inputs, and only when the interrupt mode is != None
  2. PWMs are similar. They are checked at runtime. If you attempt to use a different frequency on two PWMs insid ethe same group, you will get a PortInUseException with text along the lines of "PWM Timer frequency cannot be different between separate channels. PWM Timer X is already set to Y Hz"
  3. I'm not certain, so abstain
  4. I'm not certain, so abstain
  5. yes. If you don't use them for SPI, they can be used as GPIO
  6. I'm not certain, so abstain
  7. No. These are based on the silicon. They could potentially change between processors, but never between OS builds on the same hardware.
  8. I'm not certain, so abstain