Skip to content

Commit

Permalink
Add board definitions for Glove80
Browse files Browse the repository at this point in the history
  • Loading branch information
chrisandreae committed May 29, 2022
1 parent a481855 commit fe3612a
Show file tree
Hide file tree
Showing 13 changed files with 442 additions and 0 deletions.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ This is a CDC/DFU/UF2 bootloader for nRF52 boards. It is further enhanced by [Mo
- Particle Boron
- Particle Xenon
- [SparkFun MicroMod nRF52840](https://www.sparkfun.com/products/16984)
- [Glove80 v1 Left Hand](https://www.moergo.com)
- [Glove80 v1 Right Hand](https://www.moergo.com)
- [Glove80 v2 Left Hand](https://www.moergo.com)
- [Glove80 v2 Right Hand](https://www.moergo.com)

UF2 is an easy-to-use bootloader that appears as a flash drive. You can just copy `.uf2`-format
application images to the flash drive to load new firmware. See https://github.com/Microsoft/uf2 and https://github.com/adafruit/uf2-samdx1 for more information.
Expand Down
90 changes: 90 additions & 0 deletions src/boards/glove80_v1_lh/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022 Stephen Cheng for Innaworks Development Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef _GLOVE80_V1_LH_H
#define _GLOVE80_V1_LH_H

#define _PINNUM(port, pin) ((port)*32 + (pin))

/*------------------------------------------------------------------*/
/* Power Management
*------------------------------------------------------------------*/
// Enable DCDC for both REG0 and REG1 - see https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&resultof=%22%44%43%44%43%45%4e%30%22%20%22%64%63%64%63%65%6e%30%22%20&anchor=unique_1227442007
#define ENABLE_DCDC_0 1
#define ENABLE_DCDC_1 1

// Set the RegOut0 voltage to be 2.4V
#define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_2V4

/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 10)
#define LED_STATE_ON 1

/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(1, 11) // SW3 CFG_FIRMWARE_UNLOCKED
#define BUTTON_2 _PINNUM(0, 10) // Not connected
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP

//--------------------------------------------------------------------+
// BLE OTA
//--------------------------------------------------------------------+
#define BLEDIS_MANUFACTURER "MoErgo"
#define BLEDIS_MODEL "Glove80 LH"

//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x002A

//--------------------------------------------------------------------+
// KEY MATRIX
//--------------------------------------------------------------------+
#define ENABLE_KEY_MATRIX 1
#define KM_SCAN_DIR 0 // 1 = Scan with col pins, and read with row pins. 0 = Scan with row pins, and read with col pins
#define KM_COL_COUNT 7
#define KM_COL_PINS { _PINNUM(0, 2), _PINNUM(1, 4), _PINNUM(1, 6), _PINNUM(1, 7), _PINNUM(1, 5), _PINNUM(1, 3), _PINNUM(1, 1) }
#define KM_ROW_COUNT 6
#define KM_ROW_PINS { _PINNUM(0, 26), _PINNUM(0, 5), _PINNUM(0, 7), _PINNUM(1, 8), _PINNUM(0, 11), _PINNUM(0, 12) }
#define _KEYID(col_id, row_id) (col_id*KM_ROW_COUNT + row_id)
#define KM_COMBO_DFU {_KEYID(6, 6-1), _KEYID(3, 3-1)} // C6R6 + C3R3
#define KM_COMBO_WIPE_CONFIG {_KEYID(6, 6-1), _KEYID(3, 2-1)} // C6R6 + C3R2
#define KM_COMBO_COUNT 2
#define KM_COMBOS {KM_COMBO_DFU, KM_COMBO_WIPE_CONFIG}


//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Glove80 v1 LH"
#define UF2_VOLUME_LABEL "FTHR840BOOT"
#define UF2_BOARD_ID "nRF52840-Glove80-LH-revA"
#define UF2_INDEX_URL "https://www.moergo.com"

#endif // _GLOVE80_V1_LH_H
1 change: 1 addition & 0 deletions src/boards/glove80_v1_lh/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840
19 changes: 19 additions & 0 deletions src/boards/glove80_v1_lh/pinconfig.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "boards.h"
#include "uf2/configkeys.h"

__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] =
{
/* CF2 START */
CFG_MAGIC0, CFG_MAGIC1, // magic
5, 100, // used entries, total entries

204, 0x100000, // FLASH_BYTES = 0x100000
205, 0x40000, // RAM_BYTES = 0x40000
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
209, 0xada52840, // UF2_FAMILY = 0xada52840
210, 0x20, // PINS_PORT_SIZE = PA_32

0, 0, 0, 0, 0, 0, 0, 0
/* CF2 END */
};
89 changes: 89 additions & 0 deletions src/boards/glove80_v1_rh/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022 Stephen Cheng for Innaworks Development Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef _GLOVE80_V1_RH_H
#define _GLOVE80_V1_RH_H

#define _PINNUM(port, pin) ((port)*32 + (pin))

/*------------------------------------------------------------------*/
/* Power Management
*------------------------------------------------------------------*/
// Enable DCDC for both REG0 and REG1 - see https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&resultof=%22%44%43%44%43%45%4e%30%22%20%22%64%63%64%63%65%6e%30%22%20&anchor=unique_1227442007
#define ENABLE_DCDC_0 1
#define ENABLE_DCDC_1 1

// Set the RegOut0 voltage to be 2.4V
#define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_2V4

/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(0, 20)
#define LED_STATE_ON 1

/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(0, 15) // SW3 CFG_FIRMWARE_UNLOCKED
#define BUTTON_2 _PINNUM(0, 16) // Not connected
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP

//--------------------------------------------------------------------+
// BLE OTA
//--------------------------------------------------------------------+
#define BLEDIS_MANUFACTURER "MoErgo"
#define BLEDIS_MODEL "Glove80 RH"

//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x002A

//--------------------------------------------------------------------+
// KEY MATRIX
//--------------------------------------------------------------------+
#define ENABLE_KEY_MATRIX 1
#define KM_SCAN_DIR 0 // 1 = Scan with col pins, and read with row pins. 0 = Scan with row pins, and read with col pins
#define KM_COL_COUNT 7
#define KM_COL_PINS {_PINNUM(0, 2),_PINNUM(1, 4),_PINNUM(1, 6),_PINNUM(1, 7),_PINNUM(1, 5),_PINNUM(1, 3),_PINNUM(1, 1)}
#define KM_ROW_COUNT 6
#define KM_ROW_PINS {_PINNUM(0, 26),_PINNUM(0, 5),_PINNUM(0, 7),_PINNUM(1, 8),_PINNUM(0, 11),_PINNUM(0, 12)}
#define _KEYID(col_id, row_id) (col_id*KM_ROW_COUNT + row_id)
#define KM_COMBO_DFU {_KEYID(6, 6-1), _KEYID(3, 3-1)} // C6R6 + C3R3
#define KM_COMBO_WIPE_CONFIG {_KEYID(6, 6-1), _KEYID(3, 2-1)} // C6R6 + C3R2
#define KM_COMBO_COUNT 2
#define KM_COMBOS {KM_COMBO_DFU, KM_COMBO_WIPE_CONFIG}

//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Glove80 v1 RH"
#define UF2_VOLUME_LABEL "FTHR840BOOT"
#define UF2_BOARD_ID "nRF52840-Glove80-RH-revA"
#define UF2_INDEX_URL "https://www.moergo.com"

#endif // _GLOVE80_V1_RH_H
1 change: 1 addition & 0 deletions src/boards/glove80_v1_rh/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840
19 changes: 19 additions & 0 deletions src/boards/glove80_v1_rh/pinconfig.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "boards.h"
#include "uf2/configkeys.h"

__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] =
{
/* CF2 START */
CFG_MAGIC0, CFG_MAGIC1, // magic
5, 100, // used entries, total entries

204, 0x100000, // FLASH_BYTES = 0x100000
205, 0x40000, // RAM_BYTES = 0x40000
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
209, 0xada52840, // UF2_FAMILY = 0xada52840
210, 0x20, // PINS_PORT_SIZE = PA_32

0, 0, 0, 0, 0, 0, 0, 0
/* CF2 END */
};
90 changes: 90 additions & 0 deletions src/boards/glove80_v2_lh/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2022 Stephen Cheng for Innaworks Development Limited
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

#ifndef _GLOVE80_V2_LH_H
#define _GLOVE80_V2_LH_H

#define _PINNUM(port, pin) ((port)*32 + (pin))

/*------------------------------------------------------------------*/
/* Power Management
*------------------------------------------------------------------*/
// Enable DCDC for both REG0 and REG1 - see https://infocenter.nordicsemi.com/index.jsp?topic=%2Fps_nrf52840%2Fpower.html&resultof=%22%44%43%44%43%45%4e%30%22%20%22%64%63%64%63%65%6e%30%22%20&anchor=unique_1227442007
#define ENABLE_DCDC_0 1
#define ENABLE_DCDC_1 1

// Set the RegOut0 voltage to be 2.4V
#define UICR_REGOUT0_VALUE UICR_REGOUT0_VOUT_2V4

/*------------------------------------------------------------------*/
/* LED
*------------------------------------------------------------------*/
#define LEDS_NUMBER 1
#define LED_PRIMARY_PIN _PINNUM(1, 15)
#define LED_STATE_ON 1

/*------------------------------------------------------------------*/
/* BUTTON
*------------------------------------------------------------------*/
#define BUTTONS_NUMBER 2
#define BUTTON_1 _PINNUM(0, 9) // Not connected
#define BUTTON_2 _PINNUM(0, 10) // Not connected
#define BUTTON_PULL NRF_GPIO_PIN_PULLUP

//--------------------------------------------------------------------+
// BLE OTA
//--------------------------------------------------------------------+
#define BLEDIS_MANUFACTURER "MoErgo"
#define BLEDIS_MODEL "Glove80 LH"

//--------------------------------------------------------------------+
// USB
//--------------------------------------------------------------------+
#define USB_DESC_VID 0x239A
#define USB_DESC_UF2_PID 0x0029
#define USB_DESC_CDC_ONLY_PID 0x002A

//--------------------------------------------------------------------+
// KEY MATRIX
//--------------------------------------------------------------------+
#define ENABLE_KEY_MATRIX 1
#define KM_SCAN_DIR 1 // 1 = Scan with col pins, and read with row pins. 0 = Scan with row pins, and read with col pins
#define KM_COL_COUNT 7
#define KM_COL_PINS {_PINNUM(1, 1),_PINNUM(1, 3),_PINNUM(1, 5),_PINNUM(1, 7),_PINNUM(1, 6),_PINNUM(1, 4),_PINNUM(1, 8)}
#define KM_ROW_COUNT 6
#define KM_ROW_PINS {_PINNUM(0, 26),_PINNUM(0, 5),_PINNUM(0, 6),_PINNUM(0, 8),_PINNUM(0, 7),_PINNUM(1, 9)}
#define _KEYID(col_id, row_id) (col_id*KM_ROW_COUNT + row_id)
#define KM_COMBO_DFU {_KEYID(6, 6-1), _KEYID(3, 3-1)} // C6R6 + C3R3
#define KM_COMBO_WIPE_CONFIG {_KEYID(6, 6-1), _KEYID(3, 2-1)} // C6R6 + C3R2
#define KM_COMBO_COUNT 2
#define KM_COMBOS {KM_COMBO_DFU, KM_COMBO_WIPE_CONFIG}


//------------- UF2 -------------//
#define UF2_PRODUCT_NAME "Glove80 v2 LH"
#define UF2_VOLUME_LABEL "GLV80LHBOOT"
#define UF2_BOARD_ID "Glove80-LH-revH"
#define UF2_INDEX_URL "https://www.moergo.com"

#endif // _GLOVE80_V2_LH_H
1 change: 1 addition & 0 deletions src/boards/glove80_v2_lh/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
MCU_SUB_VARIANT = nrf52840
19 changes: 19 additions & 0 deletions src/boards/glove80_v2_lh/pinconfig.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#include "boards.h"
#include "uf2/configkeys.h"

__attribute__((used, section(".bootloaderConfig")))
const uint32_t bootloaderConfig[] =
{
/* CF2 START */
CFG_MAGIC0, CFG_MAGIC1, // magic
5, 100, // used entries, total entries

204, 0x100000, // FLASH_BYTES = 0x100000
205, 0x40000, // RAM_BYTES = 0x40000
208, (USB_DESC_VID << 16) | USB_DESC_UF2_PID, // BOOTLOADER_BOARD_ID = USB VID+PID, used for verification when updating bootloader via uf2
209, 0xada52840, // UF2_FAMILY = 0xada52840
210, 0x20, // PINS_PORT_SIZE = PA_32

0, 0, 0, 0, 0, 0, 0, 0
/* CF2 END */
};
Loading

0 comments on commit fe3612a

Please sign in to comment.