Skip to content

Commit

Permalink
Merge pull request zmkfirmware#4 from zmkfirmware/main
Browse files Browse the repository at this point in the history
make even with main
  • Loading branch information
mubeenkhan94 authored Oct 10, 2020
2 parents d3cc589 + e741768 commit 33d1f30
Show file tree
Hide file tree
Showing 82 changed files with 1,387 additions and 152 deletions.
6 changes: 6 additions & 0 deletions .devcontainer/.bashrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export LS_OPTIONS='-F --color=auto'
eval "`dircolors`"
alias ls='ls $LS_OPTIONS'
if [ -f "$WORKSPACE_DIR/zephyr/zephyr-env.sh" ]; then
source "$WORKSPACE_DIR/zephyr/zephyr-env.sh"
fi
11 changes: 11 additions & 0 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM zmkfirmware/zephyr-west-action-arm

RUN apt-get -y update && \
apt-get -y upgrade && \
apt-get install --no-install-recommends -y \
ssh \
gpg && \
rm -rf /var/lib/apt/lists/*

COPY .bashrc tmp
RUN mv /tmp/.bashrc ~/.bashrc
8 changes: 8 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"name": "ZMK Development",
"dockerFile": "Dockerfile",
"extensions": ["ms-vscode.cpptools"],
"runArgs": ["--security-opt", "label=disable"],
"containerEnv": {"WORKSPACE_DIR": "${containerWorkspaceFolder}"}
}

2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ jobs:
args: 'build "-s app -b ${{ matrix.board }} -- -DSHIELD=${{ matrix.shield }}"'
- name: Archive Build
uses: actions/upload-artifact@v2
if: ${{ matrix.board == 'nice_nano' }}
if: ${{ matrix.board != 'proton_c' }}
with:
name: "${{ matrix.board }}-${{ matrix.shield }}-zmk-uf2"
path: build/zephyr/zmk.uf2
4 changes: 4 additions & 0 deletions .github/workflows/clang-format-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@ on:
- "app/boards/**/*.c"
- "app/include/**/*.h"
- "app/src/**"
- "app/drivers/**/*.c"
- "app/drivers/**/*.h"
pull_request:
paths:
- "app/boards/**/*.c"
- "app/include/**/*.h"
- "app/src/**"
- "app/drivers/**/*.c"
- "app/drivers/**/*.h"

jobs:
build:
Expand Down
4 changes: 3 additions & 1 deletion app/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,15 @@ zephyr_linker_sources(RODATA include/linker/zmk-events.ld)
# Add your source file to the "app" target. This must come after
# find_package(Zephyr) which defines the target.
target_include_directories(app PRIVATE include)
target_sources_ifdef(CONFIG_ZMK_SLEEP app PRIVATE src/power.c)
target_sources(app PRIVATE src/kscan.c)
target_sources(app PRIVATE src/matrix_transform.c)
target_sources(app PRIVATE src/hid.c)
target_sources(app PRIVATE src/sensors.c)
target_sources_ifdef(CONFIG_ZMK_DISPLAY app PRIVATE src/display.c)
target_sources(app PRIVATE src/event_manager.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/ble_unpair_combo.c)
target_sources_ifdef(CONFIG_ZMK_EXT_POWER app PRIVATE src/ext_power_generic.c)
target_sources(app PRIVATE src/events/position_state_changed.c)
target_sources(app PRIVATE src/events/keycode_state_changed.c)
target_sources(app PRIVATE src/events/modifiers_state_changed.c)
Expand All @@ -54,7 +56,7 @@ target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_PERIPHERAL app PRIVATE src/split/
target_sources_ifdef(CONFIG_ZMK_SPLIT_BLE_ROLE_CENTRAL app PRIVATE src/split/bluetooth/central.c)
target_sources_ifdef(CONFIG_ZMK_KSCAN_MOCK_DRIVER app PRIVATE src/kscan_mock.c)
target_sources_ifdef(CONFIG_ZMK_KSCAN_COMPOSITE_DRIVER app PRIVATE src/kscan_composite.c)
target_sources_ifdef(CONFIG_ZMK_USB app PRIVATE src/usb_hid.c)
target_sources_ifdef(CONFIG_USB app PRIVATE src/usb.c)
target_sources_ifdef(CONFIG_ZMK_BLE app PRIVATE src/hog.c)
target_sources_ifdef(CONFIG_ZMK_RGB_UNDERGLOW app PRIVATE src/rgb_underglow.c)
target_sources(app PRIVATE src/endpoints.c)
Expand Down
30 changes: 28 additions & 2 deletions app/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,16 @@ menuconfig ZMK_USB
select USB_DEVICE_STACK
select USB_DEVICE_HID

if ZMK_USB
if USB

config ZMK_USB_INIT_PRIORITY
int "Init Priority"
default 50

endif

if ZMK_USB

config USB_NUMOF_EP_WRITE_RETRIES
default 10

Expand Down Expand Up @@ -72,6 +76,29 @@ endif

endmenu

menuconfig ZMK_SLEEP
bool "Enable deep sleep support"
imply USB

if ZMK_SLEEP

config SYS_POWER_DEEP_SLEEP_STATES
default y

choice SYS_PM_POLICY
default SYS_PM_POLICY_APP
endchoice

config ZMK_IDLE_SLEEP_TIMEOUT
int "Milliseconds to wait to sleep when going idle"
default 900000

endif

config ZMK_EXT_POWER
bool "Enable support to control external power output"
default y

config ZMK_DISPLAY
bool "ZMK display support"
default n
Expand Down Expand Up @@ -108,7 +135,6 @@ config ZMK_SPLIT_BLE_ROLE_CENTRAL

config ZMK_SPLIT_BLE_ROLE_PERIPHERAL
bool "Peripheral"
select BT_KEYS_OVERWRITE_OLDEST

if ZMK_SPLIT_BLE_ROLE_PERIPHERAL

Expand Down
9 changes: 9 additions & 0 deletions app/boards/arm/nice_nano/nice_nano.dts
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,15 @@
};
};

ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
};
};

&gpiote {
status = "okay";
};

&gpio0 {
Expand Down
13 changes: 13 additions & 0 deletions app/boards/arm/nrf52840_m2/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

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
)
10 changes: 10 additions & 0 deletions app/boards/arm/nrf52840_m2/Kconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

config BOARD_ENABLE_DCDC
bool "Enable DCDC mode"
select SOC_DCDC_NRF52X
default y
depends on BOARD_NRF52840_M2
10 changes: 10 additions & 0 deletions app/boards/arm/nrf52840_m2/Kconfig.board
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Maker Diary nrf52840 M.2 board configuration
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

config BOARD_NRF52840_M2
bool "nrf52480_m2"
depends on SOC_NRF52840_QIAA

30 changes: 30 additions & 0 deletions app/boards/arm/nrf52840_m2/Kconfig.defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

if BOARD_NRF52840_M2

config BOARD
default "nrf52480_m2"

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

endif # BOARD_NRF52840_M2
9 changes: 9 additions & 0 deletions app/boards/arm/nrf52840_m2/board.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

board_runner_args(nrfjprog "--nrf-family=NRF52" "--softreset")

include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/blackmagicprobe.board.cmake)
97 changes: 97 additions & 0 deletions app/boards/arm/nrf52840_m2/nrf52840_m2.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,97 @@
/*
* Copyright (c) 2020 The ZMK Contributors
* SPDX-License-Identifier: MIT
*/

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

/ {
model = "Makerdiary nRF52840 M.2 module";
compatible = "makerdiary,nrf52840_m2";

chosen {
zephyr,code-partition = &code_partition;
//zephyr,console = &uart0;
//zephyr,bt-mon-uart = &uart0;
//zephyr,bt-c2h-uart = &uart0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};

leds {
compatible = "gpio-leds";
red_led: led_0 {
gpios = <&gpio0 30 GPIO_ACTIVE_HIGH>;
label = "Red LED";
};
green_led: led_1 {
gpios = <&gpio0 29 GPIO_ACTIVE_HIGH>;
label = "Green LED";
};
blue_led: led_2 {
gpios = <&gpio0 31 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};

};

&gpio0 {
status = "okay";
};

&gpio1 {
status = "okay";
};

&uart0 {
compatible = "nordic,nrf-uart";
status = "okay";
current-speed = <115200>;
tx-pin = <16>;
rx-pin = <15>;
rts-pin = <14>;
cts-pin = <13>;
};

&usbd {
compatible = "nordic,nrf-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>;
};
};
};
15 changes: 15 additions & 0 deletions app/boards/arm/nrf52840_m2/nrf52840_m2.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
identifier: nrf52840_m2
name: Makerdiary nRF52840 M.2 module
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/nrf52840_m2/nrf52840_m2_defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) 2020 The ZMK Contributors
# SPDX-License-Identifier: MIT
#

CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_NRF52840_M2=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
5 changes: 5 additions & 0 deletions app/boards/arm/nrfmicro/nrfmicro_11.dts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
};
};

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

&gpio0 {
Expand Down
5 changes: 5 additions & 0 deletions app/boards/arm/nrfmicro/nrfmicro_11_flipped.dts
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@
};
};

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

&gpio0 {
Expand Down
Loading

0 comments on commit 33d1f30

Please sign in to comment.