Skip to content
Open
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
16 changes: 13 additions & 3 deletions boards/ugl/uhk-80/Kconfig.defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -23,20 +23,33 @@ if BT_DIS && BT_DIS_PNP
endif # BT_DIS && BT_DIS_PNP

if BOARD_UHK_80_LEFT
config HAS_PM
default y
config HW_STACK_PROTECTION
default ARCH_HAS_STACK_PROTECTION

config USB_DEVICE_PRODUCT
default "UHK 80 left half bootloader" if MCUBOOT
config USB_DEVICE_PID
default 0x0006 if MCUBOOT
endif # BOARD_UHK_80_LEFT

if BOARD_UHK_80_RIGHT
config HAS_PM
default y
config HW_STACK_PROTECTION
default ARCH_HAS_STACK_PROTECTION

config USB_DEVICE_PRODUCT
default "UHK 80 right half bootloader" if MCUBOOT
config USB_DEVICE_PID
default 0x0008 if MCUBOOT
endif # BOARD_UHK_80_RIGHT

if BOARD_UHK_DONGLE
config HW_STACK_PROTECTION
default ARCH_HAS_STACK_PROTECTION

config USB_DEVICE_PRODUCT
default "UHK dongle bootloader" if MCUBOOT
config USB_DEVICE_PID
Expand All @@ -59,6 +72,3 @@ if BT
config BT_DEVICE_APPEARANCE
default 961
endif # BT

config BT_CTLR
default BT
13 changes: 13 additions & 0 deletions boards/ugl/uhk-80/board.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,19 @@

#include <zephyr/init.h>
#include <hal/nrf_power.h>
#include <zephyr/pm/pm.h>

__weak void pm_state_exit_post_ops(enum pm_state state, uint8_t substate_id)
{
ARG_UNUSED(state);
ARG_UNUSED(substate_id);
}

__weak void pm_state_set(enum pm_state state, uint8_t substate_id)
{
ARG_UNUSED(state);
ARG_UNUSED(substate_id);
}

#ifdef CONFIG_BOARD_UHK_DONGLE_NRF52840
static int board_uhk_dongle_nrf52840_init(void)
Expand Down
2 changes: 1 addition & 1 deletion boards/ugl/uhk-80/board.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

board_runner_args(jlink "--device=nRF52840_xxAA" "--speed=4000")
board_runner_args(pyocd "--target=nrf52840" "--frequency=4000000")
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfutil.board.cmake)
include(${ZEPHYR_BASE}/boards/common/nrfjprog.board.cmake)
include(${ZEPHYR_BASE}/boards/common/jlink.board.cmake)
include(${ZEPHYR_BASE}/boards/common/pyocd.board.cmake)
include(${ZEPHYR_BASE}/boards/common/openocd-nrf5.board.cmake)
1 change: 1 addition & 0 deletions device/prj.conf.overlays/ble_hid.conf
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ CONFIG_BT_MAX_PAIRED=20

# use BLE HID over GATT from c2usb
CONFIG_C2USB_BLUETOOTH=y
CONFIG_C2USB_HOGP_LOG_LEVEL_DBG=y
# battery status to generic client
CONFIG_BT_BAS=y
# device information to generic client
Expand Down
4 changes: 1 addition & 3 deletions device/prj.conf.overlays/c2usb.conf
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ CONFIG_NEWLIB_LIBC_NANO=y
# CONFIG_WARN_EXPERIMENTAL=y
#
CONFIG_UDC_DRIVER_LOG_LEVEL_DBG=y
CONFIG_C2USB_HOGP_LOG_LEVEL_DBG=y
CONFIG_C2USB_UDC_MAC_LOG_LEVEL_DBG=y

CONFIG_WARN_EXPERIMENTAL=n
Expand All @@ -18,5 +17,4 @@ CONFIG_C2USB_UDC_MAC=y
CONFIG_C2USB_UDC_MAC_THREAD_STACK_SIZE=2048

# needed as at suspend the msgq is flooded otherwise
CONFIG_C2USB_UDC_MAC_MSGQ_SIZE=32

CONFIG_C2USB_UDC_MAC_MSGQ_SIZE=24
4 changes: 3 additions & 1 deletion device/prj.conf.overlays/nrf_shared.conf
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ CONFIG_BT_ATT_TX_COUNT=10
CONFIG_BT_CONN_TX_MAX=6
CONFIG_BT_L2CAP_TX_BUF_COUNT=12

CONFIG_BT_USER_DATA_LEN_UPDATE=n
# negotiate larger MTU for NUS
CONFIG_BT_USER_DATA_LEN_UPDATE=y
CONFIG_BT_BUF_ACL_RX_SIZE=251
CONFIG_BT_BUF_ACL_TX_SIZE=251
CONFIG_BT_L2CAP_TX_MTU=247
Expand Down Expand Up @@ -99,3 +99,5 @@ CONFIG_SPEED_OPTIMIZATIONS=y
# macro evaluation can take some depth...
CONFIG_MAIN_STACK_SIZE=4096

# we are out of RAM, limit required heap to minimum
CONFIG_NEWLIB_LIBC_MIN_REQUIRED_HEAP_SIZE=0
20 changes: 7 additions & 13 deletions device/src/bt_advertise.c
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ uint8_t BtAdvertise_Start(adv_config_t advConfig)
case ADVERTISE_NUS | ADVERTISE_HID:
LOG_DBG("Adv: advertise nus+hid.");
/* our devices don't check service uuids, so hid advertisement effectively advertises nus too */
advParam = *BT_LE_ADV_CONN_ONE_TIME;
advParam = *BT_LE_ADV_CONN_FAST_1;
err = BT_LE_ADV_START(&advParam, adHid, sdHid);

break;
Expand All @@ -152,13 +152,13 @@ uint8_t BtAdvertise_Start(adv_config_t advConfig)
LOG_DBG("Adv: advertise nus, with allow list.");
setFilters(advConfig);

advParam = *BT_LE_ADV_CONN_ONE_TIME;
advParam.options = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_FILTER_CONN | BT_LE_ADV_OPT_USE_IDENTITY;
advParam = *BT_LE_ADV_CONN_FAST_1;
advParam.options = BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_FILTER_CONN | BT_LE_ADV_OPT_USE_IDENTITY;

err = BT_LE_ADV_START(&advParam, BY_SIDE(adNusLeft, adNusRight), sdNus);
} else {
LOG_DBG("Adv: advertise nus, without allow list.");
advParam = *BT_LE_ADV_CONN_ONE_TIME;
advParam = *BT_LE_ADV_CONN_FAST_1;
err = BT_LE_ADV_START(&advParam, BY_SIDE(adNusLeft, adNusRight), sdNus);
}
break;
Expand All @@ -167,21 +167,15 @@ uint8_t BtAdvertise_Start(adv_config_t advConfig)
LOG_DBG("Adv: direct advertise nus, with allow list.");
setFilters(advConfig);

advParam = *BT_LE_ADV_CONN_ONE_TIME;
advParam.options = BT_LE_ADV_OPT_CONNECTABLE | BT_LE_ADV_OPT_ONE_TIME | BT_LE_ADV_OPT_FILTER_CONN | BT_LE_ADV_OPT_USE_IDENTITY;
advParam = *BT_LE_ADV_CONN_FAST_1;
advParam.options = BT_LE_ADV_OPT_CONN | BT_LE_ADV_OPT_FILTER_CONN | BT_LE_ADV_OPT_USE_IDENTITY;

err = BT_LE_ADV_START(&advParam, BY_SIDE(adNusLeft, adNusRight), sdNus);
} else {
LOG_DBG("Adv: direct advertise nus, without allow list.");
advParam = *BT_LE_ADV_CONN_ONE_TIME;
advParam = *BT_LE_ADV_CONN_FAST_1;
err = BT_LE_ADV_START(&advParam, BY_SIDE(adNusLeft, adNusRight), sdNus);
}

//// TODO: fix and reenable this?
// printk("Advertising against %s", GetAddrString(advConfig.addr));
// advParam = *BT_LE_ADV_CONN_DIR_LOW_DUTY(advConfig.addr);
// advParam.options |= BT_LE_ADV_OPT_DIR_ADDR_RPA;
// err = BT_LE_ADV_START(&advParam, BY_SIDE(adNusLeft, adNusRight), sdNus);
break;
default:
LOG_INF("Adv: Attempted to start advertising without any type! Ignoring.");
Expand Down
5 changes: 4 additions & 1 deletion device/src/bt_conn.c
Original file line number Diff line number Diff line change
Expand Up @@ -265,12 +265,16 @@ char *GetPeerStringByConnId(uint8_t connectionId) {
static struct bt_conn_le_data_len_param *data_len;

static void enableDataLengthExtension(struct bt_conn *conn) {
#if CONFIG_BT_USER_DATA_LEN_UPDATE
data_len = BT_LE_DATA_LEN_PARAM_MAX;

int err = bt_conn_le_data_len_update(conn, data_len);
if (err) {
LOG_INF("LE data length update failed: %d", err);
}
#else
(void)conn;
#endif
}

#if DEVICE_IS_UHK80_RIGHT
Expand Down Expand Up @@ -624,7 +628,6 @@ static void connected(struct bt_conn *conn, uint8_t err) {

// Without this, linux pairing fails, because tiny 27 byte packets
// exhaust acl buffers easily
enableDataLengthExtension(conn);
if (!DEBUG_STRESS_GATT) {
requestMtuExchange(conn);
}
Expand Down
1 change: 0 additions & 1 deletion device/src/keyboard/charger.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
#include "charger.h"
#include "battery_window_calculator.h"
#include "keyboard/charger.h"
#include "nrf52840.h"
#include "oled/screens/notification_screen.h"
#include "power_mode.h"
#include "shell.h"
Expand Down
1 change: 1 addition & 0 deletions device/sysbuild.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
SB_CONFIG_BOOTLOADER_MCUBOOT=y
SB_CONFIG_PARTITION_MANAGER=y
SB_CONFIG_MCUBOOT_MODE_SINGLE_APP=y
SB_CONFIG_MCUBOOT_APP_SYNC_UPDATEABLE_IMAGES=n
40 changes: 0 additions & 40 deletions patches/core/0003-cmake-add-ihex-binary-output-option.patch

This file was deleted.

This file was deleted.

30 changes: 0 additions & 30 deletions patches/sdk-nrf/0001-Remove-mcuboot-build-warnings.patch

This file was deleted.

Loading
Loading