Skip to content

adding uf2 flash support for blackpill 401 #13968

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

Merged
merged 6 commits into from
Aug 23, 2021
Merged
Show file tree
Hide file tree
Changes from 2 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: 1 addition & 1 deletion docs/flashing.md
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ Flashing sequence:

## tinyuf2

Keyboards may opt into supporting the tinyuf2 bootloader. This is currently only supported on the F411 blackpill.
Keyboards may opt into supporting the tinyuf2 bootloader. This is currently only supported on the F401/F411 blackpill.

The `rules.mk` setting for this bootloader is `tinyuf2`, and can be specified at the keymap or user level.

Expand Down
35 changes: 35 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/4x6_blackpill.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
#include "4x6_blackpill.h"

void keyboard_pre_init_kb(void) {
keyboard_pre_init_user();
}

#ifdef SSD1306OLED
void led_set_kb(uint8_t usb_led) {
// put your keyboard LED indicator (ex: Caps Lock LED) toggling code here
led_set_user(usb_led);
}
#endif

void matrix_init_kb(void) {
matrix_init_user();
};

#ifdef RGB_MATRIX_ENABLE
led_config_t g_led_config = { {
//Key Matrix to LED Indexccxxz
{0, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED },
{NO_LED, NO_LED, NO_LED,NO_LED,NO_LED,NO_LED }
}, {
//LED Index to Physical Positon
{0, 0}
}, {
4
} };
#endif
44 changes: 44 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/4x6_blackpill.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/* Copyright 2021 pathnirvana ([email protected])
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#pragma once

#include "dactyl_manuform.h"
#include "quantum.h"

#ifdef USE_I2C
#include <stddef.h>
#endif

#define LAYOUT_4x6(\
L00, L01, L02, L03, L04, L05, R00, R01, R02, R03, R04, R05, \
L10, L11, L12, L13, L14, L15, R10, R11, R12, R13, R14, R15, \
L20, L21, L22, L23, L24, L25, R20, R21, R22, R23, R24, R25, \
L32, L33, R32, R33, \
L34, L35, R30, R31, \
L44, L45, R40, R41) \
/* matrix positions */\
{ \
{ L00, L01, L02, L03, L04, L05 }, \
{ L10, L11, L12, L13, L14, L15 }, \
{ L20, L21, L22, L23, L24, L25 }, \
{ L32, L33, L34, L35, L44, L45 }, \
\
{ R00, R01, R02, R03, R04, R05 }, \
{ R10, R11, R12, R13, R14, R15 }, \
{ R20, R21, R22, R23, R24, R25 }, \
{ R32, R33, R30, R31, R40, R41 } \
}

68 changes: 68 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#pragma once

#include "config_common.h"

/* USB Device descriptor parameter */
#define PRODUCT_ID 0x0048
#define DEVICE_VER 0x0001
#undef MANUFACTURER
#define MANUFACTURER Path Nirvana
#define PRODUCT Dactyl-Manuform (4x6) blackpill

/* key matrix size */
#define MATRIX_ROWS 8 // Rows are doubled-up
#define MATRIX_COLS 12

#define MATRIX_ROWS_PER_SIDE (MATRIX_ROWS / 2)
#define MATRIX_COLS_PER_SIDE (MATRIX_COLS / 2)
/*
* Keyboard Matrix Assignments
*
* Change this to how you wired your keyboard
* COLS: AVR pins used for columns, left to right
* ROWS: AVR pins used for rows, top to bottom
* DIODE_DIRECTION: COL2ROW = COL = Anode (+), ROW = Cathode (-, marked on diode)
* ROW2COL = ROW = Anode (+), COL = Cathode (-, marked on diode)
*
*/
#define DIODE_DIRECTION COL2ROW

// wiring
#define MATRIX_COL_PINS_MCU \
{ B3, B4, B8, B9, A6, A7 } // orig from ferris { B8, B4, B3, A15, A14 }
#define MATRIX_ROW_PINS_MCU \
{ A1, A2, A3, A5 } // orig from ferris B7, B6, B5, A2
#define MATRIX_COL_PINS_MCP \
{ A0, A1, A2, A3, A4, A5 } // pins on the mcp23017
#define MATRIX_ROW_PINS_MCP \
{ B0, B1, B2, B3 } // pins on the mcp23017

//#define MATRIX_IO_DELAY 5 // default is 30, reducing this to 5 just increases the matrix scan rate from 1015 to 1063. not worth it

/* i2c settings check docs/i2c_driver.md for details */
#define I2C_DRIVER I2CD1
#define I2C1_SCL_BANK GPIOB // B6 and B7 used
#define I2C1_SCL 6
#define I2C1_SDA_BANK GPIOB
#define I2C1_SDA 7

#define I2C1_CLOCK_SPEED 400000
#define I2C1_DUTY_CYCLE FAST_DUTY_CYCLE_2


#define RGB_DI_PIN B1
#define RGBLED_NUM 48
#define DRIVER_LED_TOTAL 10
#define RGB_DISABLE_WHEN_USB_SUSPENDED false // for measure current
#define RGB_MATRIX_MAXIMUM_BRIGHTNESS 220

#define WS2812_PWM_DRIVER PWMD3
#define WS2812_PWM_CHANNEL 4
#define WS2812_PWM_PAL_MODE 2
#define WS2812_DMA_STREAM STM32_DMA1_STREAM2
#define WS2812_DMA_CHANNEL 5

/* Debounce reduces chatter (unintended double-presses) - set 0 if debouncing is not needed */
#define DEBOUNCE 5

// #define DEBUG_MATRIX_SCAN_RATE // useful for debugging with hid_listen
33 changes: 33 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/f401/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* This file was auto-generated by:
* `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f401/halconf.h -r platforms/chibios/common/configs/halconf.h`
*/

#pragma once

#define HAL_USE_I2C TRUE

#define HAL_USE_PWM TRUE

//#define HAL_USE_SERIAL TRUE

//#define SERIAL_USB_BUFFERS_SIZE 256

#include_next <halconf.h>

34 changes: 34 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/f401/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* This file was auto-generated by:
* `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f401/mcuconf.h -r platforms/chibios/BLACKPILL_STM32_F401/configs/mcuconf.h`
*/

#pragma once

#include_next <mcuconf.h>

#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE

#undef STM32_I2C_USE_DMA
#define STM32_I2C_USE_DMA FALSE // was false in ferris

#undef STM32_PWM_USE_TIM3
#define STM32_PWM_USE_TIM3 TRUE

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# MCU name
MCU = STM32F401

# Address of the bootloader in system memory
#STM32_BOOTLOADER_ADDRESS = 0x8000000
BOOTLOADER = tinyuf2
33 changes: 33 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/f411/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

/*
* This file was auto-generated by:
* `qmk chibios-confmigrate -i keyboards/zvecr/zv48/f411/halconf.h -r platforms/chibios/common/configs/halconf.h`
*/

#pragma once

#define HAL_USE_I2C TRUE

#define HAL_USE_PWM TRUE

//#define HAL_USE_SERIAL TRUE

//#define SERIAL_USB_BUFFERS_SIZE 256

#include_next <halconf.h>

32 changes: 32 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/f411/mcuconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
/* Copyright 2020 QMK
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#pragma once

#include_next <mcuconf.h>

#undef STM32_I2C_USE_I2C1
#define STM32_I2C_USE_I2C1 TRUE

#undef STM32_I2C_USE_DMA
#define STM32_I2C_USE_DMA FALSE // was false in ferris

#undef STM32_PWM_USE_TIM3
#define STM32_PWM_USE_TIM3 TRUE

// #undef STM32_SERIAL_USE_USART1
// #define STM32_SERIAL_USE_USART1 TRUE

Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# MCU name
MCU = STM32F411

# Address of the bootloader in system memory
#STM32_BOOTLOADER_ADDRESS = 0x080000000

BOOTLOADER = tinyuf2
# double tap the reset button on the board and copy the uf2 file to the drive created
61 changes: 61 additions & 0 deletions keyboards/handwired/dactyl_manuform/4x6_blackpill/info.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"keyboard_name": "Dactyl Manuform 4x6",
"url": "",
"maintainer": "qmk",
"width": 17,
"height": 7,
"layouts": {
"LAYOUT": {
"layout": [
{"label":"L00", "x":0, "y":0},
{"label":"L01", "x":1, "y":0},
{"label":"L02", "x":2, "y":0},
{"label":"L03", "x":3, "y":0},
{"label":"L04", "x":4, "y":0},
{"label":"L05", "x":5, "y":0},
{"label":"R00", "x":11, "y":0},
{"label":"R01", "x":12, "y":0},
{"label":"R02", "x":13, "y":0},
{"label":"R03", "x":14, "y":0},
{"label":"R04", "x":15, "y":0},
{"label":"R05", "x":16, "y":0},
{"label":"L10", "x":0, "y":1},
{"label":"L11", "x":1, "y":1},
{"label":"L12", "x":2, "y":1},
{"label":"L13", "x":3, "y":1},
{"label":"L14", "x":4, "y":1},
{"label":"L15", "x":5, "y":1},
{"label":"R10", "x":11, "y":1},
{"label":"R11", "x":12, "y":1},
{"label":"R12", "x":13, "y":1},
{"label":"R13", "x":14, "y":1},
{"label":"R14", "x":15, "y":1},
{"label":"R15", "x":16, "y":1},
{"label":"L20", "x":0, "y":2},
{"label":"L21", "x":1, "y":2},
{"label":"L22", "x":2, "y":2},
{"label":"L23", "x":3, "y":2},
{"label":"L24", "x":4, "y":2},
{"label":"L25", "x":5, "y":2},
{"label":"R20", "x":11, "y":2},
{"label":"R21", "x":12, "y":2},
{"label":"R22", "x":13, "y":2},
{"label":"R23", "x":14, "y":2},
{"label":"R24", "x":15, "y":2},
{"label":"R25", "x":16, "y":2},
{"label":"L32", "x":2, "y":3},
{"label":"L33", "x":3, "y":3},
{"label":"R32", "x":13, "y":3},
{"label":"R33", "x":14, "y":3},
{"label":"L34", "x":4, "y":4},
{"label":"L35", "x":5, "y":4},
{"label":"R30", "x":11, "y":4},
{"label":"R31", "x":12, "y":4},
{"label":"L44", "x":6, "y":5},
{"label":"L45", "x":7, "y":5},
{"label":"L42", "x":6, "y":6},
{"label":"L43", "x":7, "y":6}
]
}
}
}
Loading