Skip to content

Commit e34b183

Browse files
committed
Fix support for M60 keyboard
- Change BUTTON_2 to ESC and setup related pins properly - Always enable the battery
1 parent 188e259 commit e34b183

File tree

2 files changed

+44
-1
lines changed

2 files changed

+44
-1
lines changed

src/boards/m60_keyboard/board.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,9 +43,14 @@
4343
*------------------------------------------------------------------*/
4444
#define BUTTONS_NUMBER 2
4545
#define BUTTON_1 _PINNUM(0, 27)
46-
#define BUTTON_2 _PINNUM(1, 7)
46+
#define BUTTON_2 _PINNUM(0, 19) // ESC
4747
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP
4848

49+
/*------------------------------------------------------------------*/
50+
/* On board regulator control
51+
*------------------------------------------------------------------*/
52+
#define LDO_CONTROL_PIN _PINNUM(0, 28) // Enables external pwr
53+
4954
//--------------------------------------------------------------------+
5055
// BLE OTA
5156
//--------------------------------------------------------------------+

src/boards/m60_keyboard/pinconfig.c

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#include "boards.h"
2+
#include "board.h"
23
#include "uf2/configkeys.h"
34

45
__attribute__((used, section(".bootloaderConfig")))
@@ -17,3 +18,40 @@ const uint32_t bootloaderConfig[] =
1718
0, 0, 0, 0, 0, 0, 0, 0
1819
/* CF2 END */
1920
};
21+
22+
static void power_on(void)
23+
{
24+
// Turn on the regulator
25+
nrf_gpio_cfg_output(LDO_CONTROL_PIN);
26+
nrf_gpio_pin_write(LDO_CONTROL_PIN, 1);
27+
}
28+
29+
void board_init2(void)
30+
{
31+
power_on();
32+
33+
// configure P0.05 for ESC/BUTTON_2
34+
// P0.05 --- |<- --- / --- P0.19
35+
// diode sw(esc)
36+
// mode: output, push-pull, low
37+
nrf_gpio_cfg(
38+
_PINNUM(0, 5),
39+
NRF_GPIO_PIN_DIR_OUTPUT,
40+
NRF_GPIO_PIN_INPUT_DISCONNECT,
41+
NRF_GPIO_PIN_NOPULL,
42+
NRF_GPIO_PIN_H0D1,
43+
NRF_GPIO_PIN_NOSENSE
44+
);
45+
nrf_gpio_pin_write(_PINNUM(0, 5), 0);
46+
47+
// Wait the buttons stable.
48+
// This is mandatory, or the keyboard will enter bootloader whenever
49+
// booted by pressing the button at back (same with BUTTON_1)
50+
NRFX_DELAY_MS(300);
51+
}
52+
53+
void board_teardown2(void)
54+
{
55+
// re-enable the battery
56+
power_on();
57+
}

0 commit comments

Comments
 (0)