Skip to content

Commit

Permalink
feat(boards): Add rotr board.
Browse files Browse the repository at this point in the history
  • Loading branch information
petejohanson committed Dec 2, 2021
1 parent 8530b67 commit c1c9d29
Show file tree
Hide file tree
Showing 10 changed files with 303 additions and 0 deletions.
8 changes: 8 additions & 0 deletions app/boards/arm/rotr/CMakeLists.txt
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/rotr/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_ROTR
8 changes: 8 additions & 0 deletions app/boards/arm/rotr/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# ROTR board configuration

# Copyright (c) 2021 Polarity Works
# SPDX-License-Identifier: MIT

config BOARD_ROTR
bool "ROTR"
depends on SOC_NRF52840_QIAA
36 changes: 36 additions & 0 deletions app/boards/arm/rotr/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# ROTR board configuration

# Copyright (c) 2021 Polarity Works
# SPDX-License-Identifier: MIT

if BOARD_ROTR

config BOARD
default "rotr"

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_BATTERY_VOLTAGE_DIVIDER
default y

config ZMK_KEYBOARD_NAME
default "ROTR"

endif # BOARD_ROTR
5 changes: 5 additions & 0 deletions app/boards/arm/rotr/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)
174 changes: 174 additions & 0 deletions app/boards/arm/rotr/rotr.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,174 @@
/*
* Copyright (c) 2021 Polarity Works
*
* SPDX-License-Identifier: MIT
*/

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

/ {
model = "ROTR";
compatible = "rotr";

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

kscan0: kscan {
compatible = "zmk,kscan-gpio-matrix";
label = "KSCAN";
diode-direction = "col2row";

row-gpios = <&gpio1 13 (GPIO_ACTIVE_HIGH | GPIO_PULL_DOWN)>;
col-gpios
= <&gpio0 2 GPIO_ACTIVE_HIGH>
, <&gpio0 3 GPIO_ACTIVE_HIGH>
, <&gpio1 15 GPIO_ACTIVE_HIGH>
;
};

ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio1 11 GPIO_ACTIVE_HIGH>;
};

sensors {
compatible = "zmk,keymap-sensors";
sensors = <&encoder0>;
};

vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <2000000>;
full-ohms = <(2000000 + 806000)>;
};
};

&adc {
status = "okay";
};

&gpiote {
status = "okay";
};

&gpio0 {
status = "okay";
};

&gpio1 {
status = "okay";
};

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

&uart0 {
compatible = "nordic,nrf-uarte";
tx-pin = <6>;
rx-pin = <8>;
};

&usbd {
status = "okay";
};

&spi1 {
status = "okay";

compatible = "nordic,nrf-spim";
mosi-pin = <24>;
sck-pin = <21>;
miso-pin = <19>;

cs-gpios = <&gpio0 10 GPIO_ACTIVE_LOW>;

encoder0: encoder@0 {
compatible = "magalpha,ma730";
label = "KNOB";

a-gpios = <&gpio1 6 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;
b-gpios = <&gpio1 0 (GPIO_ACTIVE_HIGH | GPIO_PULL_UP)>;

reg = <0>;
spi-max-frequency = <25000000>;

resolution = <8>; //degrees per keypress
};
};


&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>;

sd_partition: partition@0 {
label = "softdevice";
reg = <0x00000000 0x00026000>;
};
code_partition: partition@26000 {
label = "code_partition";
reg = <0x00026000 0x000c6000>;
};

/*
* The flash starting at 0x000ec000 and ending at
* 0x000f3fff is reserved for use by the application.
*/

/*
* Storage partition will be used by FCB/LittleFS/NVS
* if enabled.
*/
storage_partition: partition@ec000 {
label = "storage";
reg = <0x000ec000 0x00008000>;
};

boot_partition: partition@f4000 {
label = "adafruit_boot";
reg = <0x000f4000 0x0000c000>;
};
};
};


&spi2 {
compatible = "nordic,nrf-spim";
status = "okay";
mosi-pin = <5>;
// 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>;
spi-max-frequency = <4000000>;

/* WS2812 */
chain-length = <3>; /* number of LEDs */
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};
19 changes: 19 additions & 0 deletions app/boards/arm/rotr/rotr.keymap
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include <behaviors.dtsi>
#include <dt-bindings/zmk/keys.h>
#include <dt-bindings/zmk/rgb.h>

&inc_dec_cp {
triggers-per-rotation = <4>;
};

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

default_layer {
//PREV | PLAY/PAUSE | NEXT
bindings = <&bootloader &rgb_ug RGB_TOG &kp C_VOL_DN>;
sensor-bindings = <&inc_dec_kp C_VOL_UP C_VOL_DN>;
};
};
};
15 changes: 15 additions & 0 deletions app/boards/arm/rotr/rotr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
identifier: rotr
name: ROTR
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog
29 changes: 29 additions & 0 deletions app/boards/arm/rotr/rotr_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# SPDX-License-Identifier: MIT

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_ROTR=y

# Enable MPU
CONFIG_ARM_MPU=y

# enable GPIO
CONFIG_GPIO=y

CONFIG_MA730=y
CONFIG_MA730_TRIGGER_GLOBAL_THREAD=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_ZMK_RGB_UNDERGLOW=y
# Use the STRIP config specific to the LEDs you're using
CONFIG_WS2812_STRIP=y
CONFIG_ZMK_RGB_UNDERGLOW_SAT_START=50
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y
2 changes: 2 additions & 0 deletions app/prj.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Turn on logging, and set ZMK logging to debug output
CONFIG_ZMK_USB_LOGGING=y

0 comments on commit c1c9d29

Please sign in to comment.