feat(board): add puchi_ble_v1 to boards

* feat(board): Add Puchi-BLE v1 board
This commit is contained in:
Ben 2022-09-06 00:15:24 +02:00 committed by GitHub
parent ce7a0e2b6c
commit 41bfc56e13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
11 changed files with 309 additions and 0 deletions

View file

@ -0,0 +1,6 @@
if(CONFIG_PINMUX)
zephyr_library()
zephyr_library_sources(pinmux.c)
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
endif()

View file

@ -0,0 +1,3 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT

View file

@ -0,0 +1,8 @@
# Puchi-BLE board configuration
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
config BOARD_PUCHI_BLE_v1
bool "puchi_ble_v1"
depends on SOC_NRF52840_QIAA

View file

@ -0,0 +1,28 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
if BOARD_PUCHI_BLE_v1
config BOARD
default "puchi_ble"
if USB_DEVICE_STACK
config USB_NRFX
default y
endif # USB_DEVICE_STACK
config BT_CTLR
default BT
config ZMK_BLE
default y
config ZMK_USB
default y
config PINMUX
default y
endif # BOARD_PUCHI_BLE_v1

View file

@ -0,0 +1,59 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/ {
pro_micro: connector {
compatible = "arduino-pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 8 0> /* D0 */
, <1 0 &gpio0 6 0> /* D1 */
, <2 0 &gpio0 15 0> /* D2 */
, <3 0 &gpio0 17 0> /* D3 */
, <4 0 &gpio0 20 0> /* D4/A6 */
, <5 0 &gpio0 13 0> /* D5 */
, <6 0 &gpio0 24 0> /* D6/A7 */
, <7 0 &gpio0 9 0> /* D7 */
, <8 0 &gpio0 10 0> /* D8/A8 */
, <9 0 &gpio1 6 0> /* D9/A9 */
, <10 0 &gpio1 11 0> /* D10/A10 */
, <16 0 &gpio0 28 0> /* D16 */
, <14 0 &gpio0 3 0> /* D14 */
, <15 0 &gpio1 13 0> /* D15 */
, <18 0 &gpio0 2 0> /* D18/A0 */
, <19 0 &gpio0 29 0> /* D19/A1 */
, <20 0 &gpio0 31 0> /* D20/A2 */
, <21 0 &gpio0 30 0> /* D21/A3 */
;
};
pro_micro_a: connector_a {
compatible = "arduino-pro-micro";
#gpio-cells = <2>;
gpio-map-mask = <0xffffffff 0xffffffc0>;
gpio-map-pass-thru = <0 0x3f>;
gpio-map
= <0 0 &gpio0 2 0> /* D18/A0 */
, <1 0 &gpio0 29 0> /* D19/A1 */
, <2 0 &gpio0 31 0> /* D20/A2 */
, <3 0 &gpio0 30 0> /* D21/A3 */
, <6 0 &gpio0 20 0> /* D4/A6 */
, <7 0 &gpio0 24 0> /* D6/A7 */
, <8 0 &gpio0 10 0> /* D8/A8 */
, <9 0 &gpio1 6 0> /* D9/A9 */
, <10 0 &gpio1 11 0> /* D10/A10 */
;
};
};
pro_micro_d: &pro_micro {};
pro_micro_i2c: &i2c0 {};
pro_micro_spi: &spi0 {};
pro_micro_serial: &uart0 {};

View file

@ -0,0 +1,6 @@
# Copyright (c) 2022 The ZMK Contributors
# 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)

View file

@ -0,0 +1,29 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
#include <kernel.h>
#include <device.h>
#include <init.h>
#include <drivers/gpio.h>
#include <sys/sys_io.h>
#include <devicetree.h>
static int pinmux_puchi_ble_init(const struct device *port) {
ARG_UNUSED(port);
#if CONFIG_BOARD_PUCHI_BLE_v1
const struct device *p0 = device_get_binding("GPIO_0");
#if CONFIG_BOARD_PUCHI_BLE_CHARGER
gpio_pin_configure(p0, 5, GPIO_OUTPUT);
gpio_pin_set(p0, 5, 0);
#else
gpio_pin_configure(p0, 5, GPIO_INPUT);
#endif
#endif
return 0;
}
SYS_INIT(pinmux_puchi_ble_init, APPLICATION, CONFIG_APPLICATION_INIT_PRIORITY);

View file

@ -0,0 +1,121 @@
/*
* Copyright (c) 2022 The ZMK Contributors
*
* SPDX-License-Identifier: MIT
*/
/dts-v1/;
#include <nordic/nrf52840_qiaa.dtsi>
#include "arduino_pro_micro_pins.dtsi"
/ {
model = "puchi_ble";
compatible = "puchi_ble";
chosen {
zephyr,code-partition = &code_partition;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
zephyr,console = &cdc_acm_uart;
zmk,battery = &vbatt;
};
leds {
compatible = "gpio-leds";
blue_led: led_0 {
gpios = <&gpio1 10 GPIO_ACTIVE_HIGH>;
label = "Blue LED";
};
};
ext-power {
compatible = "zmk,ext-power-generic";
label = "EXT_POWER";
control-gpios = <&gpio1 9 GPIO_ACTIVE_LOW>;
};
vbatt: vbatt {
compatible = "zmk,battery-voltage-divider";
label = "BATTERY";
io-channels = <&adc 2>;
output-ohms = <2000000>;
full-ohms = <(2000000 + 820000)>;
};
};
&adc {
status = "okay";
};
&gpiote {
status = "okay";
};
&gpio0 {
status = "okay";
};
&gpio1 {
status = "okay";
};
&i2c0 {
compatible = "nordic,nrf-twi";
sda-pin = <15>;
scl-pin = <17>;
};
&uart0 {
compatible = "nordic,nrf-uarte";
tx-pin = <6>;
rx-pin = <8>;
};
&usbd {
status = "okay";
cdc_acm_uart: cdc_acm_uart {
compatible = "zephyr,cdc-acm-uart";
label = "CDC_ACM_0";
};
};
&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>;
};
};
};

View file

@ -0,0 +1,15 @@
identifier: puchi_ble_v1
name: puchi_ble_v1
type: mcu
arch: arm
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- usb_device
- ble
- ieee802154
- pwm
- watchdog

View file

@ -0,0 +1,10 @@
file_format: "1"
id: puchi_ble_v1
name: Puchi-BLE V1
type: board
arch: arm
outputs:
- usb
- ble
url: https://keycapsss.com/keyboard-parts/mcu-controller/202/puchi-ble-wireless-microcontroller
exposes: [pro_micro]

View file

@ -0,0 +1,24 @@
# Copyright (c) 2022 The ZMK Contributors
# SPDX-License-Identifier: MIT
CONFIG_SOC_SERIES_NRF52X=y
CONFIG_SOC_NRF52840_QIAA=y
CONFIG_BOARD_PUCHI_BLE_v1=y
# Enable MPU
CONFIG_ARM_MPU=y
# enable GPIO
CONFIG_GPIO=y
CONFIG_USE_DT_CODE_PARTITION=y
CONFIG_BUILD_OUTPUT_UF2=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