- Edited
Here's some questions related to the Switch and LED on the nRF9160 Feather. See my answers inline:
So, I generally understand that led_0 in the code is D7 because of the following entry in circuitdojo_feather_nrf9160_common.dts which I think is setting led0 to gpio pin P.0.03.
leds { compatible = "gpio-leds"; blue_led: led_0 { gpios = <&gpio0 3 GPIO_ACTIVE_LOW>; label = "Blue LED (D7)";
Why do you label it D7 on your feather? How are other gpios mapped to the feather pins? Am I missing where that documentation is?
D7 = Digital Input/Output 7. Similar concept to an Arduino whereas the LED is shared with D13 (from what I remember)
The pins that being with A are Analog pins that you can use the ADC with.
So the Switch 1 button is the Mode button. Is it attached to gpio P0.12 but no feather pins?
It's actually attached to the MD pin. In future versions the raw switch output will be connected to the MD pin (right now it's the digital 3.3V max version).
How do the following gpios map to the feather pins and what do the following mappings mean?
/* Used for accessing other pins */ feather_header: feather_connector { compatible = "adafruit-feather-header"; #gpio-cells = <2>; gpio-map-mask = <0xffffffff 0xffffffc0>; gpio-map-pass-thru = <0 0x3f>; gpio-map = <12 0 &gpio0 26 0>, /* SDA */ <13 0 &gpio0 27 0>, /* SCL */ <14 0 &gpio0 29 0>, /* PWM3 */ <15 0 &gpio0 30 0>, /* PWM3 */ <16 0 &gpio0 0 0>, /* PWM1 */ <17 0 &gpio0 1 0>, /* PWM1 */ <18 0 &gpio0 2 0>, /* PWM1 */ <19 0 &gpio0 3 0>, /* PWM0 */ <20 0 &gpio0 4 0>, /* PWM1 */ /* 11 not connected */ <10 0 &gpio0 24 0>, /* TX */ <9 0 &gpio0 23 0>, /* RX */ <8 0 &gpio0 22 0>, /* MISO */ <7 0 &gpio0 21 0>, /* MOSI */ <6 0 &gpio0 19 0>, /* SCK */ <5 0 &gpio0 18 0>, /* SS */ <4 0 &gpio0 17 0>, /* ADC4 = AIN6 */ <3 0 &gpio0 16 0>, /* ADC3 = AIN5 */ <2 0 &gpio0 15 0>, /* ADC2 = AIN4 */ <1 0 &gpio0 14 0>, /* ADC1 = AIN2 */ <0 0 &gpio0 13 0>; /* ADC0 = AIN1 */
I've yet to utilize this definition. I saw it in the Zephyr library and thought it would be a good idea to implement it for other folks. It's a similar concept to the switch and LED though where it abstracts the PIN numbers to something more human friendly to interact with inside of code. More to come if more folks are interested.