jaredwolff Here's a little snippet from the board.c in the Zephyr defs for the nRF9160 Feather:
This is very helpful. One has to understand how to blink an arbitrary pin before you can do anything else. Using this information, here is a modified version of blinky that can blink an arbitrary gpio pin on the feather. It is actually much simpler than blinky.
/*=======================================
This program is similar to blinky. It is the bare minimum to blink an arbitrary feather pin every 100ms.
This version blink D7, P0.03, which happens to be the Blue LED.
circuitdojo_feather_nrf9160 pin and GPIO mappings:
Feather Pin nrf9160 gpio0
D2 29 // P0.29
D3 30 // P0.30
D4 0 // P0.0
D5 1 // P0.1
D6 2 // P0.2
D7 3 // P0.3
MD 12 // P0.12
Copyright (c) 2016 Intel Corporation
SPDX-License-Identifier: Apache-2.0
*/
#include <zephyr.h>
#include <device.h>
#include <devicetree.h>
#include <drivers/gpio.h>
/* 1000 msec = 1 sec */
#define SLEEP_TIME_MS 100
#define GPIO0 DT_LABEL(DT_NODELABEL(gpio0))
#define PIN 3 // Feather Pin D7 = Blue LED
void main(void)
{
bool led_is_on = true;
// Get the device binding
struct device *gpio = device_get_binding(GPIO0);
// Configure latch pin as output.
gpio_pin_configure(gpio, PIN, GPIO_OUTPUT_ACTIVE);
while (1) {
gpio_pin_set(gpio, PIN, (int)led_is_on);
led_is_on = !led_is_on;
k_msleep(SLEEP_TIME_MS);
}
}
jaredwolff board.c in the Zephyr defs for the nRF9160 Feather
Where did board.c come from and why is it in this folder? Did you create it when you created the circuitdojo_feather_nrf9160 folder.
I have noticed a lot of warnings when I compile blinky or this new blinky file, some referring to board.c. Not that I really need to understand at this point, but I wanted to mention it. I tried pasting it in here, but the formatting becomes a mess. Here is just the beginning of the warnings.
[193/193] Linking C executable zephyr\zephyr.elf
[15/156] Performing build step for 'mcuboot_subimage'
[48/237] Building C object zephyr/boards/boards/arm/circui...s/boards__arm__circuitdojo_feather_nrf9160.dir/board.c.obj
C:/ncs/zephyr/boards/arm/circuitdojo_feather_nrf9160/board.c: In function 'board_circuitdojo_feather_nrf9160_init':
C:/ncs/zephyr/boards/arm/circuitdojo_feather_nrf9160/board.c:24:21: warning: passing argument 1 of 'gpio_pin_configure' discards 'const' qualifier from pointer target type [-Wdiscarded-qualifiers]
24 | gpio_pin_configure(gpio, POWER_LATCH_PIN, GPIO_OUTPUT_HIGH);