Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

canokey-nrf52: enable dumb dongle support for nRF52 targets #12

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ add_definitions(-DMBR_PRESENT)
add_definitions(-DCFG_BOARD=${CANOKEY_BOARD})
add_definitions(-DCFG_TUSB_MCU=OPT_MCU_NRF5X)
add_definitions(-DMBEDTLS_CONFIG_FILE="${BASE_DIR}/config/mbedtls_config.h")
# simulate touching for dumb dongles with no hardware buttons
# add_definitions(-DDUMB_DONGLE)

# nrf5 sdk configs
add_definitions(-DCUSTOM_BOARD_INC=board_selection)
Expand Down
8 changes: 8 additions & 0 deletions src/device.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,14 @@ inline static bool btn_down() {
return bsp_board_button_state_get(BSP_BOARD_BUTTON_0);
}

/* Only works when DUMB_DONGLE macro is enabled. */
int testmode_emulate_user_presence(void) {
if (!device_is_blinking()) return 0; // user only touches while blinking

set_touch_result(TOUCH_SHORT);
return 0;
}

static void (*tim_callback)(void);

// every 10ms
Expand Down