config.h (2918B)
1 /* Copyright 2022 David Hoelscher, customMK 2 * 3 * This program is free software: you can redistribute it and/or modify 4 * it under the terms of the GNU General Public License as published by 5 * the Free Software Foundation, either version 3 of the License, or 6 * (at your option) any later version. 7 * 8 * This program is distributed in the hope that it will be useful, 9 * but WITHOUT ANY WARRANTY; without even the implied warranty of 10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 11 * GNU General Public License for more details. 12 * 13 * You should have received a copy of the GNU General Public License 14 * along with this program. If not, see <https://www.gnu.org/licenses/>. 15 */ 16 #pragma once 17 18 // Bonsai C4 includes Vbus sensing; derived designs that use PA9 for other purposes 19 // may disable Vbus sensing with #define BOARD_OTG_NOVBUSSENS 1 20 21 #ifndef EARLY_INIT_PERFORM_BOOTLOADER_JUMP 22 # define EARLY_INIT_PERFORM_BOOTLOADER_JUMP TRUE 23 #endif 24 25 // FRAM configuration 26 #ifndef EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN 27 # define EEPROM_SPI_MB85RS64V 28 # define EXTERNAL_EEPROM_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOA, 0) 29 # define EXTERNAL_EEPROM_SPI_CLOCK_DIVISOR 8 // 96MHz / 8 = 12MHz; max supported by MB85R64 is 20MHz 30 #endif 31 32 // External flash configuration 33 #ifndef EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN 34 # define EXTERNAL_FLASH_SPI_SLAVE_SELECT_PIN PAL_LINE(GPIOB, 12) 35 # define EXTERNAL_FLASH_SPI_CLOCK_DIVISOR 2 // 48MHz; max supported by W25Q128JV is 133MHz 36 # define EXTERNAL_FLASH_BYTE_COUNT (16 * 1024 * 1024) //128Mbit or 16MByte 37 # define EXTERNAL_FLASH_PAGE_SIZE 256 38 # define EXTERNAL_FLASH_SPI_TIMEOUT 200000 //datasheet max is 200 seconds for flash chip erase 39 #endif 40 41 // SPI Configuration (needed for FRAM and FLASH) 42 #ifndef SPI_DRIVER 43 # define SPI_DRIVER SPID1 44 #endif 45 #ifndef SPI_SCK_PIN 46 # define SPI_SCK_PIN PAL_LINE(GPIOB, 3) 47 #endif 48 #ifndef SPI_MOSI_PIN 49 # define SPI_MOSI_PIN PAL_LINE(GPIOB, 5) 50 #endif 51 #ifndef SPI_MISO_PIN 52 # define SPI_MISO_PIN PAL_LINE(GPIOB, 4) 53 #endif 54 55 56 // I2C Configuration 57 #ifdef CONVERT_TO_BONSAI_C4 58 # ifndef I2C1_SCL_PIN 59 # define I2C1_SCL_PIN PAL_LINE(GPIOB, 6) 60 # endif 61 # ifndef I2C1_SDA_PIN 62 # define I2C1_SDA_PIN PAL_LINE(GPIOB, 9) 63 # endif 64 #endif 65 66 // WS2812-style LED control on pin A10 67 #ifdef WS2812_PWM 68 # ifndef WS2812_DI_PIN 69 # define WS2812_DI_PIN PAL_LINE(GPIOA, 10) 70 # endif 71 # ifndef WS2812_PWM_DRIVER 72 # define WS2812_PWM_DRIVER PWMD1 73 # endif 74 # ifndef WS2812_PWM_CHANNEL 75 # define WS2812_PWM_CHANNEL 3 76 # endif 77 # ifndef WS2812_PWM_PAL_MODE 78 # define WS2812_PWM_PAL_MODE 1 79 # endif 80 # ifndef WS2812_PWM_DMA_STREAM 81 # define WS2812_PWM_DMA_STREAM STM32_DMA2_STREAM5 82 # endif 83 # ifndef WS2812_PWM_DMA_CHANNEL 84 # define WS2812_PWM_DMA_CHANNEL 6 85 # endif 86 #endif 87 88 #ifndef USB_VBUS_PIN 89 # define USB_VBUS_PIN PAL_LINE(GPIOA, 9) 90 #endif