Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Paw #774

Closed
wants to merge 6 commits into from
Closed

Paw #774

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions app/boards/arm/paw/CMakeLists.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file should be deleted. ZMK now uses Zephyr's UF2 generation as part of the changes made in the move to Zephyr 3.0.

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
set_property(GLOBAL APPEND PROPERTY extra_post_build_commands
COMMAND ${PYTHON_EXECUTABLE} ${ZEPHYR_BASE}/../tools/uf2/utils/uf2conv.py
-c
-b 0x26000
-f 0xADA52840
-o ${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.uf2
${PROJECT_BINARY_DIR}/${CONFIG_KERNEL_BIN_NAME}.bin
)
7 changes: 7 additions & 0 deletions app/boards/arm/paw/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# SPDX-License-Identifier: MIT

config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_PAW
9 changes: 9 additions & 0 deletions app/boards/arm/paw/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Paw board configuration

# Copyright (c) 2020 Taylor Glaeser
# SPDX-License-Identifier: MIT

config BOARD_PAW
bool "Paw"
depends on SOC_NRF52840_QIAA

37 changes: 37 additions & 0 deletions app/boards/arm/paw/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Copyright (c) 2020 Taylor Glaeser
# SPDX-License-Identifier: MIT

if BOARD_PAW

config BOARD
default "paw"

config ZMK_KEYBOARD_NAME
default "Paw"

if USB

config USB_NRFX
default y

config USB_DEVICE_STACK
default y

endif # USB

config BT_CTLR
default BT

config ZMK_BLE
default y

config ZMK_USB
default y

config ZMK_RGB_UNDERGLOW
default y

config WS2812_STRIP
default y

endif # BOARD_PAW
5 changes: 5 additions & 0 deletions app/boards/arm/paw/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# SPDX-License-Identifier: MIT

board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
127 changes: 127 additions & 0 deletions app/boards/arm/paw/paw.dts
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You would also need to migrate the pin details to use the pinctrl subsystem for a chance at acceptance—but that at least does not cause compilation to fail, so I will leave the implementation details to you.

Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
/*
* Copyright (c) 2020 Taylor Glaeser
*
* SPDX-License-Identifier: MIT
*/

/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#include <nordic/nrf52840_qiaa.dtsi>
#include <nordic/nrf52840_qiaa.dtsi>
#include <dt-bindings/led/led.h>

This too is part of the upgrade to Zephyr 3.0.


/ {
model = "Paw";
compatible = "paw";

chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zmk,kscan = &kscan0;
zmk,underglow = &led_strip;
};

kscan0: kscan {
compatible = "zmk,kscan-gpio-direct";
label = "KSCAN";
input-gpios
= <&gpio0 3 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpio0 10 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpio0 24 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
, <&gpio0 13 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>
;
};

leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
};

&spi1 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <22>;
// Unused pins, needed for SPI definition, but not used by the ws2812 driver itself.
sck-pin = <6>;
miso-pin = <7>;

led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
label = "WS2812";

/* SPI */
reg = <0>; /* ignored, but necessary for SPI bindings */
spi-max-frequency = <4000000>;

/* WS2812 */
chain-length = <4>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
spi-zero-frame = <0x40>;
spi-zero-frame = <0x40>;
color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;

See previous comment re: Zephyr 3.0 upgrades.

};
};

&gpio0 {
status = "okay";
};

&gpio1 {
status = "okay";
};

&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <17>;
scl-pin = <20>;
};

&uart0 {
compatible = "nordic,nrf-uarte";
status = "okay";
current-speed = <115200>;
tx-pin = <39>;
rx-pin = <34>;
rts-pin = <33>;
cts-pin = <12>;
};

&usbd {
status = "okay";
};


&flash0 {
/*
* For more information, see:
* http://docs.zephyrproject.org/latest/devices/dts/flash_partitions.html
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "adafruit_boot";
reg = <0x000000000 0x0000C000>;
};
code_partition: partition@26000 {
label = "code_partition";
reg = <0x00026000 0x000d2000>;
};

/*
* 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@f8000 {
label = "storage";
reg = <0x000f8000 0x00008000>;
};
};
};
25 changes: 25 additions & 0 deletions app/boards/arm/paw/paw.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/bt.h>

/ {
keymap {
compatible = "zmk,keymap";

default_layer {
// -----------------------------------------------------------------------------------------
// TODO: Add diagram for keymap
bindings = <
&lt 1 UARW
&kp LARW &kp DARW &kp RARW
>;
};

lower_layer {
bindings = <
&trans
&bt BT_CLR &bt BT_SEL 0 &bt BT_NXT
>;
};
};
};
15 changes: 15 additions & 0 deletions app/boards/arm/paw/paw.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
identifier: paw
name: Paw
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog
23 changes: 23 additions & 0 deletions app/boards/arm/paw/paw_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# SPDX-License-Identifier: MIT

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_PAW=y

# Enable MPU
CONFIG_ARM_MPU=y

# enable GPIO
CONFIG_GPIO=y

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
CONFIG_CLOCK_CONTROL_NRF=y
CONFIG_CLOCK_CONTROL_NRF_K32SRC_RC=y

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
CONFIG_BUILD_OUTPUT_UF2=y

See previous comment re: the move to Zephyr 3.0.