mirror of https://github.com/rusefi/wideband.git
202 lines
7.2 KiB
C
202 lines
7.2 KiB
C
/*
|
|
ChibiOS - Copyright (C) 2006..2018 Giovanni Di Sirio
|
|
|
|
Licensed under the Apache License, Version 2.0 (the "License");
|
|
you may not use this file except in compliance with the License.
|
|
You may obtain a copy of the License at
|
|
|
|
http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
Unless required by applicable law or agreed to in writing, software
|
|
distributed under the License is distributed on an "AS IS" BASIS,
|
|
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
See the License for the specific language governing permissions and
|
|
limitations under the License.
|
|
*/
|
|
|
|
#ifndef _BOARD_H_
|
|
#define _BOARD_H_
|
|
|
|
/*
|
|
* Board identifier.
|
|
*/
|
|
#define BOARD_RUSEFI_WIDEBAND_DUAL
|
|
/*
|
|
* Board identifier.
|
|
*/
|
|
#define BOARD_NAME "rusEfi Wideband Controller Dual"
|
|
|
|
/*
|
|
* Board oscillators-related settings.
|
|
* NOTE: LSE not fitted.
|
|
* NOTE: HSE is 8MHz.
|
|
*/
|
|
#if !defined(STM32_LSECLK)
|
|
#define STM32_LSECLK 0U
|
|
#endif
|
|
|
|
#if !defined(STM32_HSECLK)
|
|
#define STM32_HSECLK 8000000U
|
|
#endif
|
|
|
|
/*
|
|
* MCU type, supported types are defined in ./os/hal/platforms/hal_lld.h.
|
|
*/
|
|
#define STM32F103xE
|
|
// TODO:
|
|
//#define STM32F103xC
|
|
|
|
/*
|
|
* IO pins assignments.
|
|
*/
|
|
|
|
/*
|
|
* I/O ports initial setup, this configuration is established soon after reset
|
|
* in the initialization code.
|
|
*
|
|
* The digits have the following meaning:
|
|
* 0 - Analog input.
|
|
* 1 - Push Pull output 10MHz.
|
|
* 2 - Push Pull output 2MHz.
|
|
* 3 - Push Pull output 50MHz.
|
|
* 4 - Digital input.
|
|
* 5 - Open Drain output 10MHz.
|
|
* 6 - Open Drain output 2MHz.
|
|
* 7 - Open Drain output 50MHz.
|
|
* 8 - Digital input with PullUp or PullDown resistor depending on ODR.
|
|
* 9 - Alternate Push Pull output 10MHz.
|
|
* A - Alternate Push Pull output 2MHz.
|
|
* B - Alternate Push Pull output 50MHz.
|
|
* C - Reserved.
|
|
* D - Alternate Open Drain output 10MHz.
|
|
* E - Alternate Open Drain output 2MHz.
|
|
* F - Alternate Open Drain output 50MHz.
|
|
* Please refer to the STM32 Reference Manual for details.
|
|
*/
|
|
|
|
/*
|
|
* Port A setup.
|
|
* PA0 - R_Ip_sense (analog in)
|
|
* PA1 - R_Un_3x_sense (analog in)
|
|
* PA2 - R_Un_sense (analog in)
|
|
* PA3 - R_Un_3x_sense (analog in)
|
|
* PA4 - R_Ip_dac (analog out)
|
|
* PA5 - L_Ip_dac (analog out)
|
|
* PA6 - R_AUX_ADC (analog in)
|
|
* PA7 - L_AUX_ADC (analog in)
|
|
* PA8 - LED_GREEN (output pushpull, 2 MHz)
|
|
* PA9 - UART_TX (output pushpull, alternate, 10 MHz)
|
|
* PA10 - UART_RX (digital input, alternate)
|
|
* PA11 - CAN_RX (digital input, alternate)
|
|
* PA12 - CAN_TX (output pushpull, alternate, 50 MHz)
|
|
* PA13 - SWDIO (digital input)
|
|
* PA14 - SWCLK (digital input)
|
|
* PA15 - BT_EN (output pushpull, 2 MHz)
|
|
*/
|
|
#define VAL_GPIOACRL 0x00000000 /* PA7...PA0 */
|
|
#define VAL_GPIOACRH 0x288B8892 /* PA15...PA8 */
|
|
#define VAL_GPIOAODR 0x0000FFFF
|
|
|
|
/*
|
|
* Port B setup.
|
|
* PB0 - R_Heater_sense (analog in).
|
|
* PB1 - R_OUT_sense (analog in).
|
|
* PB2 - Nernsr_4.9_bias (digital output, 2 Mhz)
|
|
* PB3 - SPI1_SCK (output puspull, alternate, 50 MHz)
|
|
* PB4 - SPI1_MISO (digital input, alternate)
|
|
* PB5 - SPI1_MOSI (output puspull, alternate, 50 MHz)
|
|
* PB6 - R_heater_pwm (output pushpull, alternate, 2 MHz)
|
|
* PB7 - L_heater_pwm (output pushpull, alternate, 2 MHz)
|
|
* PB8 - I2C1_SCL (output pushpull, alternate, 50 MHz)
|
|
* PB9 - I2C1_SDA (output OD, alternate, 50 MHz)
|
|
* PB10 - Nernsr_ADV_esr_drive (digital input, no pull) - keep high-Z after power on
|
|
* PB11 - Nernsr_4.9_esr_drive (output pushpull, 50 Mhz)
|
|
* PB12 - Nernsr_4.2_esr_drive (digital input, no pull) - keep high-Z after power on
|
|
* PB13 - L_LED_GREEN (output pushpull, 2 MHz)
|
|
* PB14 - L_OUT_en (output pushpull, 2 MHz)
|
|
* PB15 - R_OUT_en (output pushpull, 2 MHz)
|
|
*/
|
|
#define VAL_GPIOBCRL 0xAAB8B200 /* PB7...PB0 */
|
|
#define VAL_GPIOBCRH 0x2224348B /* PB15...PB8 */
|
|
#define VAL_GPIOBODR 0x00003FFF
|
|
|
|
/*
|
|
* Port C setup.
|
|
* PC0 - 12V_sense (analog in)
|
|
* PC1 - R_LED_GREEN (output pushpull, 2 MHz)
|
|
* PC2 - L_Un_3x_sense (analog in)
|
|
* PC3 - L_Ip_sense (analog in)
|
|
* PC4 - L_OUT_sense (analog in).
|
|
* PC5 - L_Heater_sense (analog in).
|
|
* PC6 - DACout1 (output pushpull, alternate, 50 MHz)
|
|
* PC7 - DACout1 (inverted) (output pushpull, alternate, 50 MHz)
|
|
* PC8 - DACout2 (output pushpull, alternate, 50 MHz)
|
|
* PC9 - DACout2 (inverted) (output pushpull, alternate, 50 MHz)
|
|
* PC10 - BT_UART_TX (output pushpull, alternate, 10 MHz)
|
|
* PA11 - BT_UART_RX (digital input, alternate)
|
|
* PC12 - config0 (digital input, no pull)
|
|
* PC13 - config0 (digital input, no pull)
|
|
* PC14 - SPI_CS1 (output pushpull, 2 MHz)
|
|
* PC15 - SPI_CS0 (output pushpull, 2 MHz)
|
|
*/
|
|
#define VAL_GPIOCCRL 0xBB000020 /* PC7...PC0 */
|
|
#define VAL_GPIOCCRH 0x224489BB /* PC15...PC8 */
|
|
#define VAL_GPIOCODR 0x0000FFFF
|
|
|
|
/*
|
|
* Port D setup.
|
|
* Everything input with pull-up except:
|
|
* PD0 - OSC_IN (digital output, 2 Mhz) - keep low after power on
|
|
* PD1 - OSC_OUT (digital output, 2 Mhz) - keep low after power on
|
|
* PD2 - SP1_CS2 (output pushpull, 2 MHz)
|
|
*/
|
|
#define VAL_GPIODCRL 0x88888200 /* PD7...PD0 */
|
|
#define VAL_GPIODCRH 0x88888888 /* PD15...PD8 */
|
|
#define VAL_GPIODODR 0x0000FFFC
|
|
|
|
/*
|
|
* Port E setup.
|
|
* Everything input with pull-up except:
|
|
*/
|
|
#define VAL_GPIOECRL 0x88888888 /* PE7...PE0 */
|
|
#define VAL_GPIOECRH 0x88888888 /* PE15...PE8 */
|
|
#define VAL_GPIOEODR 0x0000FFFF
|
|
|
|
/*
|
|
* Port F setup.
|
|
* Everything input with pull-up except:
|
|
*/
|
|
#define VAL_GPIOFCRL 0x88888888 /* PF7...PF0 */
|
|
#define VAL_GPIOFCRH 0x88888888 /* PF15...PF8 */
|
|
#define VAL_GPIOFODR 0x0000FFFF
|
|
|
|
/*
|
|
* Port G setup.
|
|
* Everything input with pull-up except:
|
|
*/
|
|
#define VAL_GPIOGCRL 0x88888888 /* PG7...PG0 */
|
|
#define VAL_GPIOGCRH 0x88888888 /* PG15...PG8 */
|
|
#define VAL_GPIOGODR 0x0000FFFF
|
|
|
|
/*
|
|
* USB bus activation macro, required by the USB driver.
|
|
*/
|
|
#define usb_lld_connect_bus(usbp)
|
|
|
|
/*
|
|
* USB bus de-activation macro, required by the USB driver.
|
|
*/
|
|
#define usb_lld_disconnect_bus(usbp)
|
|
|
|
#if !defined(_FROM_ASM_)
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
void boardInit(void);
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
#endif /* _FROM_ASM_ */
|
|
|
|
#endif /* _BOARD_H_ */
|