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

Add Bonsai C4 as a platform board file #18901

Merged
merged 5 commits into from
Nov 13, 2022
Merged
Show file tree
Hide file tree
Changes from 4 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 data/mappings/defaults.hjson
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
"bonsai_c4": {
"processor": "STM32F411",
"bootloader": "stm32-dfu",
"board": "GENERIC_STM32_F411XE",
"board": "BONSAI_C4",
"pin_compatible": "promicro"
}
}
Expand Down
2 changes: 0 additions & 2 deletions docs/feature_converters.md
Original file line number Diff line number Diff line change
Expand Up @@ -157,8 +157,6 @@ The Bonsai C4 only has one on-board LED (B2), and by default, both the Pro Micro
#define B0 PAL_LINE(GPIOA, 9)
```

No peripherals are enabled by default at this time, but example code to enable SPI, I2C, PWM, and Serial communications can be found [here](/keyboards/custommk/bonsai_c4_template).

## Elite-C

If a board currently supported in QMK uses an [Elite-C](https://keeb.io/products/elite-c-low-profile-version-usb-c-pro-micro-replacement-atmega32u4), the supported alternative controllers are:
Expand Down
23 changes: 0 additions & 23 deletions keyboards/custommk/bonsai_c4_template/bonsai_c4_template.c

This file was deleted.

79 changes: 0 additions & 79 deletions keyboards/custommk/bonsai_c4_template/config.h

This file was deleted.

35 changes: 0 additions & 35 deletions keyboards/custommk/bonsai_c4_template/halconf.h

This file was deleted.

35 changes: 0 additions & 35 deletions keyboards/custommk/bonsai_c4_template/mcuconf.h

This file was deleted.

10 changes: 0 additions & 10 deletions keyboards/custommk/bonsai_c4_template/readme.md

This file was deleted.

9 changes: 9 additions & 0 deletions platforms/chibios/boards/BONSAI_C4/board/board.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# List of all the board related files.
BOARDSRC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE/board.c

# Required include directories
BOARDINC = $(CHIBIOS)/os/hal/boards/ST_NUCLEO64_F411RE

# Shared variables
ALLCSRC += $(BOARDSRC)
ALLINC += $(BOARDINC)
20 changes: 20 additions & 0 deletions platforms/chibios/boards/BONSAI_C4/configs/board.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
/* Copyright 2020 Nick Brassel (tzarc)
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
#pragma once

#include_next "board.h"

#undef STM32_HSE_BYPASS
92 changes: 92 additions & 0 deletions platforms/chibios/boards/BONSAI_C4/configs/config.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
/* Copyright 2022 David Hoelscher, customMK
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
#pragma once

// Bonsai C4 includes Vbus sensing; derived designs that use PA9 for other purposes
// may disable Vbus sensing with #define BOARD_OTG_NOVBUSSENS 1

#ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP
# define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE
#endif

// FRAM configuration
#ifndef EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN
# define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOA, 0)
# define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // 96MHz / 8 = 12MHz; max supported by MB85R64 is 20MHz
# define EXTERNAL_EEPROM_BYTE_COUNT 8192
# define EXTERNAL_EEPROM_PAGE_SIZE 64 // does not matter for FRAM, just sets the RAM buffer size in STM32F chip
# define DYNAMIC_KEYMAP_EEPROM_MAX_ADDR 8191
#endif

// External flash configuration
#ifndef EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN
# define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOB, 12)
# define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 1 // 96MHz; max supported by W25Q128JV is 133MHz
infinityis marked this conversation as resolved.
Show resolved Hide resolved
# define EXTERNAL_FLASH_BYTE_COUNT (16 * 1024 * 1024) //128Mbit or 16MByte
# define EXTERNAL_FLASH_PAGE_SIZE 256
# define EXTERNAL_FLASH_SPI_TIMEOUT 200000 //datasheet max is 200 seconds for flash chip erase
#endif

// SPI Configuration (needed for FRAM and FLASH)
#ifndef SPI_DRIVER
# define SPI_DRIVER SPID1
#endif
#ifndef SPI_SCK_PIN
# define SPI_SCK_PIN PAL_LINE(GPIOB, 3)
#endif
#ifndef SPI_MOSI_PIN
# define SPI_MOSI_PIN PAL_LINE(GPIOB, 5)
#endif
#ifndef SPI_MISO_PIN
# define SPI_MISO_PIN PAL_LINE(GPIOB, 4)
#endif


// I2C Configuration
#ifdef CONVERT_TO_BONSAI_C4
# ifndef I2C1_SCL_PIN
# define I2C1_SCL_PIN PAL_LINE(GPIOB, 6)
# endif
# ifndef I2C1_SDA_PIN
# define I2C1_SDA_PIN PAL_LINE(GPIOB, 9)
# endif
#endif

// WS2812-style LED control on pin A10
#ifdef WS2812_DRIVER_PWM
# ifndef RGB_DI_PIN
# define RGB_DI_PIN PAL_LINE(GPIOA, 10)
# endif
# ifndef WS2812_PWM_DRIVER
# define WS2812_PWM_DRIVER PWMD1
# endif
# ifndef WS2812_PWM_CHANNEL
# define WS2812_PWM_CHANNEL 3
# endif
# ifndef WS2812_PWM_PAL_MODE
# define WS2812_PWM_PAL_MODE 1
# endif
# ifndef WS2812_DMA_STREAM
# define WS2812_DMA_STREAM STM32_DMA2_STREAM5
# endif
# ifndef WS2812_DMA_CHANNEL
# define WS2812_DMA_CHANNEL 6
# endif
#endif

#ifndef USB_VBUS_PIN
# define USB_VBUS_PIN PAL_LINE(GPIOA, 9)
#endif
49 changes: 49 additions & 0 deletions platforms/chibios/boards/BONSAI_C4/configs/halconf.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* Copyright 2022 David Hoelscher, customMK
*
* 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 3 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 <https://www.gnu.org/licenses/>.
*/
#pragma once

#ifndef HAL_USE_SPI
# define HAL_USE_SPI TRUE
#endif

#ifndef HAL_USE_I2C
# define HAL_USE_I2C TRUE
#endif

#ifdef SPLIT_KEYBOARD
# ifndef HAL_USE_SERIAL
# define HAL_USE_SERIAL TRUE
# endif
# ifndef SERIAL_BUFFERS_SIZE
# define SERIAL_BUFFERS_SIZE 256
# endif
#endif

#ifdef WS2812_DRIVER_PWM
# ifndef HAL_USE_PWM
# define HAL_USE_PWM TRUE
# endif
#endif

#ifndef SPI_SELECT_MODE
# define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
#endif

#ifndef SPI_USE_WAIT
# define SPI_USE_WAIT TRUE
#endif

#include_next <halconf.h>
Loading