Compare commits
No commits in common. "5f80150894130d33507bc2b09ef89600d152ff21" and "4363aa7af72afb069392aa031cc5b25c117e93a9" have entirely different histories.
5f80150894
...
4363aa7af7
|
@ -1,14 +1,7 @@
|
|||
#
|
||||
# Copyright (c) 2020 The ZMK Contributors
|
||||
# SPDX-License-Identifier: MIT
|
||||
#
|
||||
|
||||
target_sources(app PRIVATE mdk_dongle_power_led.c)
|
||||
|
||||
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
|
||||
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py
|
||||
-c
|
||||
-b 0x1000
|
||||
-b 0x26000
|
||||
-f 0xADA52840
|
||||
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2
|
||||
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
|
||||
|
|
|
@ -1,23 +0,0 @@
|
|||
# nRF52840 MDK USB Dongle
|
||||
|
||||
A basic USB stick that contains the nRF52840 chip from Nordic and has 12 GPIOs available.
|
||||
|
||||
Additional detail: https://wiki.makerdiary.com/nrf52840-mdk-usb-dongle/
|
||||
|
||||
## Hardware Features
|
||||
|
||||
* Nordic nRF52840 System-on-Chip
|
||||
* ARM® Cortex®-M4F processor optimized for ultra-low power operation
|
||||
* Combining Bluetooth 5, Bluetooth Mesh, Thread, IEEE 802.15.4, ANT and 2.4GHz proprietary
|
||||
* On-chip NFC-A tag
|
||||
* On-chip USB 2.0 (Full speed) controller
|
||||
* ARM TrustZone® Cryptocell 310 security subsystem
|
||||
* 1 MB FLASH and 256 kB RAM
|
||||
* Up to 12 GPIOs available via headers
|
||||
* User programmable Button and RGB LED
|
||||
* On-board 2.4G chip antenna
|
||||
* 3.3V regulator with 1A peak current output
|
||||
* VBUS & VIN Power-Path Management
|
||||
* Convenient USB dongle form factor
|
||||
* Breadboard-friendly with dual 10-Pin headers
|
||||
* Measures 1.65" x 0.7" x 0.16" (42mm x 18mm x 4mm) without headers soldered in
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
* Copyright (c) 2016 Intel Corporation
|
||||
* Copyright (c) 2020 The ZMK Contributors
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
* SPDX-License-Identifier: MIT
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
|
@ -9,30 +9,26 @@
|
|||
#include <devicetree.h>
|
||||
#include <drivers/gpio.h>
|
||||
|
||||
/* The devicetree node identifier for the "led0" alias. */
|
||||
#define LED_NODE DT_ALIAS(ledblue)
|
||||
#define POWER_LED_NODE DT_ALIAS(led1_red)
|
||||
|
||||
#if DT_NODE_HAS_STATUS(LED_NODE, okay)
|
||||
#define LED DT_GPIO_LABEL(LED_NODE, gpios)
|
||||
#define PIN DT_GPIO_PIN(LED_NODE, gpios)
|
||||
#define FLAGS DT_GPIO_FLAGS(LED_NODE, gpios)
|
||||
#if DT_NODE_HAS_STATUS(POWER_LED_NODE, okay)
|
||||
#define POWER_LED DT_GPIO_LABEL(POWER_LED_NODE, gpios)
|
||||
#define PIN DT_GPIO_PIN(POWER_LED_NODE, gpios)
|
||||
#define FLAGS DT_GPIO_FLAGS(POWER_LED_NODE, gpios)
|
||||
#else
|
||||
/* A build error here means your board isn't set up to blink an LED. */
|
||||
#error "Unsupported board: led devicetree alias is not defined"
|
||||
#define LED0 ""
|
||||
#error "Unsupported board: power led devicetree alias is not defined"
|
||||
#define POWER_LED ""
|
||||
#define PIN 0
|
||||
#define FLAGS 0
|
||||
#endif
|
||||
|
||||
static int pwr_led_init(const struct device *dev) {
|
||||
int ret;
|
||||
|
||||
dev = device_get_binding(LED);
|
||||
dev = device_get_binding(POWER_LED);
|
||||
if (dev == NULL) {
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT | FLAGS);
|
||||
int ret = gpio_pin_configure(dev, PIN, GPIO_OUTPUT_ACTIVE | FLAGS);
|
||||
if (ret < 0) {
|
||||
return -EIO;
|
||||
}
|
||||
|
|
|
@ -11,66 +11,66 @@
|
|||
compatible = "makerdiary,nrf52840_mdk_dongle";
|
||||
|
||||
chosen {
|
||||
zephyr,code-partition = &code_partition;
|
||||
zephyr,sram = &sram0;
|
||||
zephyr,flash = &flash0;
|
||||
zephyr,code-partition = &slot0_partition;
|
||||
};
|
||||
|
||||
leds {
|
||||
compatible = "gpio-leds";
|
||||
led_0: led_green {
|
||||
led0_green: led_0 {
|
||||
gpios = <&gpio0 22 GPIO_ACTIVE_LOW>;
|
||||
label = "Green LED";
|
||||
status = "okay";
|
||||
label = "Green LED 0";
|
||||
};
|
||||
led_1: led_red {
|
||||
led1_red: led_1 {
|
||||
gpios = <&gpio0 23 GPIO_ACTIVE_LOW>;
|
||||
label = "Red LED";
|
||||
status = "okay";
|
||||
label = "Red LED 1";
|
||||
};
|
||||
led_2: led_blue {
|
||||
led2_blue: led_2 {
|
||||
gpios = <&gpio0 24 GPIO_ACTIVE_LOW>;
|
||||
label = "Blue LED";
|
||||
status = "okay";
|
||||
label = "Blue LED 2";
|
||||
};
|
||||
};
|
||||
|
||||
pwmleds {
|
||||
compatible = "pwm-leds";
|
||||
pwm_led_0: pwm_led_green {
|
||||
pwm_led0_green: pwm_led_0 {
|
||||
pwms = <&pwm0 22>;
|
||||
label = "Green PWM LED";
|
||||
status = "okay";
|
||||
label = "Green PWM LED 0";
|
||||
};
|
||||
pwm_led_1: pwm_led_red {
|
||||
pwm_led1_red: pwm_led_1 {
|
||||
pwms = <&pwm0 23>;
|
||||
label = "Red PWM LED";
|
||||
status = "okay";
|
||||
label = "Red PWM LED 1";
|
||||
};
|
||||
pwm_led_2: pwm_led_blue {
|
||||
pwm_led2_blue: pwm_led_2 {
|
||||
pwms = <&pwm0 24>;
|
||||
label = "Blue PWM LED";
|
||||
status = "okay";
|
||||
label = "Blue PWM LED 2";
|
||||
};
|
||||
};
|
||||
|
||||
buttons {
|
||||
compatible = "gpio-keys";
|
||||
button0: button0 {
|
||||
button0: button_0 {
|
||||
gpios = <&gpio0 18 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
|
||||
label = "Push button 0";
|
||||
status = "okay";
|
||||
label = "Push button switch 0";
|
||||
};
|
||||
};
|
||||
|
||||
/* These aliases are provided for compatibility with samples */
|
||||
aliases {
|
||||
ledgreen = &led_0;
|
||||
ledred = &led_1;
|
||||
ledblue = &led_2;
|
||||
pwmledgreen = &pwm_led_0;
|
||||
pwmledred = &pwm_led_1;
|
||||
pwmledblue = &pwm_led_2;
|
||||
sw0 = &button0;
|
||||
led0 = &led0_green;
|
||||
led1 = &led1_red;
|
||||
led2 = &led2_blue;
|
||||
led0-green = &led0_green;
|
||||
led1-red = &led1_red;
|
||||
led1-blue = &led2_blue;
|
||||
pwm-led0 = &pwm_led0_green;
|
||||
pwm-led1 = &pwm_led1_red;
|
||||
pwm-led2 = &pwm_led2_blue;
|
||||
green-pwm-led = &pwm_led0_green;
|
||||
red-pwm-led = &pwm_led1_red;
|
||||
blue-pwm-led = &pwm_led2_blue;
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -78,10 +78,6 @@
|
|||
status = "okay";
|
||||
};
|
||||
|
||||
&gpiote {
|
||||
status = "okay";
|
||||
};
|
||||
|
||||
&gpio0 {
|
||||
status = "okay";
|
||||
};
|
||||
|
@ -93,39 +89,42 @@
|
|||
&flash0 {
|
||||
/*
|
||||
* For more information, see:
|
||||
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
|
||||
* https://docs.zephyrproject.org/latest/guides/dts/legacy-macros.html#legacy-flash-partitions
|
||||
*/
|
||||
partitions {
|
||||
compatible = "fixed-partitions";
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
sd_partition: partition@0 {
|
||||
label = "mbr";
|
||||
reg = <0x00000000 0x00001000>;
|
||||
boot_partition: partition@0 {
|
||||
label = "mcuboot";
|
||||
reg = <0x000000000 0x0000C000>;
|
||||
};
|
||||
code_partition: partition@1000 {
|
||||
label = "code_partition";
|
||||
reg = <0x00001000 0x000d3000>;
|
||||
slot0_partition: partition@c000 {
|
||||
label = "image-0";
|
||||
reg = <0x0000C000 0x00067000>;
|
||||
};
|
||||
slot1_partition: partition@73000 {
|
||||
label = "image-1";
|
||||
reg = <0x00073000 0x00067000>;
|
||||
};
|
||||
scratch_partition: partition@da000 {
|
||||
label = "image-scratch";
|
||||
reg = <0x000da000 0x0001e000>;
|
||||
};
|
||||
|
||||
/*
|
||||
* The flash starting at 0x000d4000 and ending at
|
||||
* 0x000f3fff is reserved for use by the application.
|
||||
* The flash starting at 0x000f8000 and ending at
|
||||
* 0x000fffff is reserved for use by the application.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Storage partition will be used by FCB/LittleFS/NVS
|
||||
* if enabled.
|
||||
*/
|
||||
storage_partition: partition@d4000 {
|
||||
storage_partition: partition@f8000 {
|
||||
label = "storage";
|
||||
reg = <0x000d4000 0x00020000>;
|
||||
};
|
||||
|
||||
boot_partition: partition@f4000 {
|
||||
label = "adafruit_boot";
|
||||
reg = <0x000f4000 0x0000c000>;
|
||||
reg = <0x000f8000 0x00008000>;
|
||||
};
|
||||
};
|
||||
};
|
|
@ -7,9 +7,7 @@ toolchain:
|
|||
- gnuarmemb
|
||||
- xtools
|
||||
supported:
|
||||
- adc
|
||||
- usb_device
|
||||
- ble
|
||||
- ieee802154
|
||||
- pwm
|
||||
- watchdog
|
||||
|
|
|
@ -15,12 +15,3 @@ CONFIG_GPIO=y
|
|||
|
||||
# additional board options
|
||||
CONFIG_GPIO_AS_PINRESET=n
|
||||
|
||||
CONFIG_USE_DT_CODE_PARTITION=y
|
||||
|
||||
CONFIG_MPU_ALLOW_FLASH_WRITE=y
|
||||
CONFIG_NVS=y
|
||||
#CONFIG_SETTINGS_NVS=y
|
||||
CONFIG_FLASH=y
|
||||
CONFIG_FLASH_PAGE_LAYOUT=y
|
||||
CONFIG_FLASH_MAP=y
|
Loading…
Reference in a new issue