Skip to content

Commit

Permalink
slicemk: serial split: setup Raytac MDBT50-DB-33 for development
Browse files Browse the repository at this point in the history
  • Loading branch information
xudongzheng committed Sep 27, 2023
1 parent cd9c580 commit 1fe242a
Show file tree
Hide file tree
Showing 6 changed files with 112 additions and 8 deletions.
5 changes: 5 additions & 0 deletions app/boards/arm/raytac_mdbt50q_rx_green/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,9 @@ endif # USB
config BT_CTLR
default BT

# Use maximum Bluetooth transmit power.
choice BT_CTLR_TX_PWR
default BT_CTLR_TX_PWR_PLUS_8
endchoice

endif # BOARD_RAYTAC_MDBT50Q_RX_GREEN
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,15 @@ CONFIG_GPIO=y
# Use NVS for settings.
CONFIG_MPU_ALLOW_FLASH_WRITE=y
CONFIG_NVS=y
CONFIG_SETTINGS=y
CONFIG_SETTINGS_NVS=y
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_FLASH_MAP=y

# TODO TODO TODO serial shouldn't be enabled in main production build
CONFIG_SERIAL=y
CONFIG_PINCTRL=y

# The Adafruit bootloader allocates 7 pages for user data on nRF52833.
CONFIG_SETTINGS_NVS_SECTOR_COUNT=7

# Use maximum Bluetooth transmit power.
CONFIG_BT_CTLR_TX_PWR_PLUS_8=y

# Include support for Coded PHY.
CONFIG_BT_CTLR_PHY_CODED=y
16 changes: 16 additions & 0 deletions app/boards/shields/slicemk_ergodox/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,19 @@ config ZMK_SPLIT_BLE_PREF_TIMEOUT
default 900

endif

if SHIELD_SLICEMK_ERGODOX_UART

config ZMK_USB
default y

config ZMK_SPLIT
default y

config ZMK_SPLIT_ROLE_CENTRAL
default y

config ZMK_KEYBOARD_NAME
default "SliceMK ErgoDox"

endif
4 changes: 4 additions & 0 deletions app/boards/shields/slicemk_ergodox/Kconfig.shield
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,7 @@ config SHIELD_SLICEMK_ERGODOX_LEFTSINGLE

config SHIELD_SLICEMK_ERGODOX_RIGHTSINGLE
def_bool $(shields_list_contains,slicemk_ergodox_rightsingle)

# TODO TODO TODO think about naming "uart" vs "converter"
config SHIELD_SLICEMK_ERGODOX_UART
def_bool $(shields_list_contains,slicemk_ergodox_uart)
80 changes: 80 additions & 0 deletions app/boards/shields/slicemk_ergodox/slicemk_ergodox_uart.overlay
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
#include <dt-bindings/led/led.h>

#include <dt-bindings/zmk/matrix_transform.h>

/ {
chosen {
zmk,kscan = &kscan0;
zmk,matrix_transform = &default_transform;

zmk,split-serial = &uart0;
zmk,underglow = &led_strip;
};

// TODO TODO TODO placeholder button, currently just an unused pin. probably
// abstract to &button or something as the actual pin would differ from
// board to board. maybe p0.15 since that's used on raytac dongle
kscan0: kscan {
compatible = "zmk,kscan-gpio-direct";
label = "KSCAN";
input-gpios = <&gpio0 6 (GPIO_ACTIVE_LOW | GPIO_PULL_UP)>;
};

default_transform: keymap_transform_0 {
compatible = "zmk,matrix-transform";
columns = <15>;
rows = <7>;
map = <
RC(0,0)
RC(0,1) RC(0,2) RC(0,3) RC(0,4) RC(0,5) RC(0,6) RC(0,7) RC(0,8) RC(0,9) RC(0,10) RC(0,11) RC(0,12) RC(0,13) RC(0,14)
RC(1,1) RC(1,2) RC(1,3) RC(1,4) RC(1,5) RC(1,6) RC(1,7) RC(1,8) RC(1,9) RC(1,10) RC(1,11) RC(1,12) RC(1,13) RC(1,14)
RC(2,1) RC(2,2) RC(2,3) RC(2,4) RC(2,5) RC(2,6) RC(2,9) RC(2,10) RC(2,11) RC(2,12) RC(2,13) RC(2,14)
RC(3,1) RC(3,2) RC(3,3) RC(3,4) RC(3,5) RC(3,6) RC(3,7) RC(3,8) RC(3,9) RC(3,10) RC(3,11) RC(3,12) RC(3,13) RC(3,14)
RC(4,1) RC(4,2) RC(4,3) RC(4,4) RC(4,5) RC(4,10) RC(4,11) RC(4,12) RC(4,13) RC(4,14)
RC(5,7) RC(5,6) RC(5,9) RC(5,8)
RC(5,5) RC(5,4) RC(5,3) RC(5,12) RC(5,11) RC(5,10)
RC(5,2) RC(5,13)
>;
};
};

&pinctrl {
uart0_default: uart0_default {
group1 {
psels = <NRF_PSEL(UART_TX, 1, 9)>;
};
group2 {
psels = <NRF_PSEL(UART_RX, 0, 11)>;
bias-pull-up;
};
};

spi3_default: spi3_default {
group1 {
psels = <NRF_PSEL(SPIM_MOSI, 0, 5)>;
};
};
};

&uart0 {
status = "okay";
current-speed = <115200>;
pinctrl-0 = <&uart0_default>;
pinctrl-names = "default";
};

// Define LED strip.
&spi3 {
status = "okay";
pinctrl-0 = <&spi3_default>;
pinctrl-names = "default";
led_strip: ws2812@0 {
compatible = "worldsemi,ws2812-spi";
reg = <0>;
spi-max-frequency = <4000000>;
chain-length = <256>;
color-mapping = <LED_COLOR_ID_GREEN LED_COLOR_ID_RED LED_COLOR_ID_BLUE>;
spi-one-frame = <0x70>;
spi-zero-frame = <0x40>;
};
};
4 changes: 2 additions & 2 deletions app/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ CONFIG_ZMK_BEHAVIORS_QUEUE_SIZE=512
# Increase stacks to reduce possibility of an overflow.
CONFIG_MAIN_STACK_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_ZMK_BLE_THREAD_STACK_SIZE=2048
CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE=2048
# CONFIG_ZMK_BLE_THREAD_STACK_SIZE=2048
# CONFIG_ZMK_SPLIT_BLE_CENTRAL_SPLIT_RUN_STACK_SIZE=2048
CONFIG_ISR_STACK_SIZE=2048

0 comments on commit 1fe242a

Please sign in to comment.