#ifndef __BOARD_H #define __BOARD_H #include "stm32f10x.h" #include "stm32f10x_gpio.h" //-------------------------------------------- #define BOARD_PIN_SPI_CLK GPIO_Pin_5 //SPI1_SCK(8) #define BOARD_PORT_SPI_CLK GPIOA //DAC_OUT2 ADC12_IN5 #define BOARD_GPIO_SPI_CLK BOARD_PORT_SPI_CLK, BOARD_PIN_SPI_CLK // #define BOARD_PIN_SPI_MISO GPIO_Pin_6 //SPI1_MISO(8) #define BOARD_PORT_SPI_MISO GPIOA // TIM8_BKIN/ADC12_IN6 // TIM3_CH1(8) #define BOARD_GPIO_SPI_MISO BOARD_PORT_SPI_MISO, BOARD_PIN_SPI_MISO // #define BOARD_PIN_SPI_MOSI GPIO_Pin_7 //SPI1_MOSI(8)/ #define BOARD_PORT_SPI_MOSI GPIOA // TIM8_CH1N/ADC12_IN7 // TIM3_CH2(8) #define BOARD_GPIO_SPI_MOSI BOARD_PORT_SPI_MOSI, BOARD_PIN_SPI_MOSI // #define BOARD_PIN_SPI_CSN GPIO_Pin_4 //SPI1_NSS(8)/ #define BOARD_PORT_SPI_CSN GPIOA // USART2_CK(8) // DAC_OUT1/ADC12_IN4 #define BOARD_GPIO_SPI_CSN BOARD_PORT_SPI_CSN, BOARD_PIN_SPI_CSN // #define BOARD_PIN_SPI_GPIOA GPIO_Pin_5 //ADC12_IN15 #define BOARD_PORT_SPI_GPIOA GPIOC #define BOARD_GPIO_SPI_GPIOA BOARD_PORT_SPI_GPIOA, BOARD_PIN_SPI_GPIOA // #define BOARD_PIN_SPI_GPIOB GPIO_Pin_0 //ADC12_IN8/TIM3_CH3 TIM1_CH2N #define BOARD_PORT_SPI_GPIOB GPIOB // TIM8_CH2N,N表示互补输出功能 #define BOARD_GPIO_SPI_GPIOB BOARD_PORT_SPI_GPIOB, BOARD_PIN_SPI_GPIOB // #define BOARD_PIN_SPI_GPIOC GPIO_Pin_1 //ADC12_IN9/TIM3_CH4(8) #define BOARD_PORT_SPI_GPIOC GPIOB // TIM8_CH3N,N表示互补输出功能 #define BOARD_GPIO_SPI_GPIOC BOARD_PORT_SPI_GPIOC, BOARD_PIN_SPI_GPIOC // #define BOARD_PIN_SPI_GPIOD GPIO_Pin_2 //USART2_TX(8)/TIM5_CH3 #define BOARD_PORT_SPI_GPIOD GPIOA // ADC123_IN2/ #define BOARD_GPIO_SPI_GPIOD BOARD_PORT_SPI_GPIOD, BOARD_PIN_SPI_GPIOD // // TIM2_CH3 (8) #define BOARD_PIN_SPI_GPIOE GPIO_Pin_10 //I2C2_SCL/USART3_TX(8) TIM2_CH3 #define BOARD_PORT_SPI_GPIOE GPIOB #define BOARD_GPIO_SPI_GPIOE BOARD_PORT_SPI_GPIOE, BOARD_PIN_SPI_GPIOE // #define BOARD_PIN_SPI_GPIOF GPIO_Pin_11 //I2C2_SDA/USART3_RX(8) TIM2_CH4 #define BOARD_PORT_SPI_GPIOF GPIOB #define BOARD_GPIO_SPI_GPIOF BOARD_PORT_SPI_GPIOF, BOARD_PIN_SPI_GPIOF // #define BOARD_PIN_SPI_GPIOG GPIO_Pin_12 //SPI2_NSS/I2S2_WS/ #define BOARD_PORT_SPI_GPIOG GPIOB // I2C2_SMBA/ // USART3_CK(8)/ // TIM1_BKIN(8) #define BOARD_GPIO_SPI_GPIOG BOARD_PORT_SPI_GPIOG, BOARD_PIN_SPI_GPIOG // #define BOARD_PIN_SPI_GPIOH GPIO_Pin_13 //SPI2_SCK/I2S2_CK #define BOARD_PORT_SPI_GPIOH GPIOB // USART3_CTS(8)/ // TIM1_CH1N #define BOARD_GPIO_SPI_GPIOH BOARD_PORT_SPI_GPIOH, BOARD_PIN_SPI_GPIOH // #define BOARD_PIN_H Bit_SET #define BOARD_PIN_L Bit_RESET //-----------------------LED指示灯,低电平驱动 #define BOARD_PIN_LED1 GPIO_Pin_3 // #define BOARD_PORT_LED1 GPIOA #define BOARD_GPIO_LED1 BOARD_PORT_LED1, BOARD_PIN_LED1 // #define BOARD_PIN_LED2 GPIO_Pin_3 #define BOARD_PORT_LED2 GPIOC #define BOARD_GPIO_LED2 BOARD_PORT_LED2, BOARD_PIN_LED2 // #define LED_ON Bit_RESET #define LED_OFF Bit_SET #define BOARD_PIN_BEEP GPIO_Pin_12 #define BOARD_PORT_BEEP GPIOA #define BOARD_GPIO_BEEP BOARD_PORT_BEEP, BOARD_PIN_BEEP // #define BEEP_ON Bit_SET #define BEEP_OFF Bit_RESET //-----------------------------------------LED指示灯,END //-----------------------LCD显示器驱动IO口 #define BG_LED_ON Bit_RESET #define BG_LED_OFF Bit_SET #define BOARD_PIN_LCD_BG_LED GPIO_Pin_4 // #define BOARD_PORT_LCD_BG_LED GPIOB #define BOARD_GPIO_LCD_BG_LED BOARD_PORT_LCD_BG_LED, BOARD_PIN_LCD_BG_LED // #define BOARD_PIN_LCD_SDA GPIO_Pin_7 // #define BOARD_PORT_LCD_SDA GPIOB #define BOARD_GPIO_LCD_SDA BOARD_PORT_LCD_SDA, BOARD_PIN_LCD_SDA // #define BOARD_PIN_LCD_CLK GPIO_Pin_6 // #define BOARD_PORT_LCD_CLK GPIOB #define BOARD_GPIO_LCD_CLK BOARD_PORT_LCD_CLK, BOARD_PIN_LCD_CLK // #define BOARD_PIN_LCD_RST GPIO_Pin_5 // #define BOARD_PORT_LCD_RST GPIOB #define BOARD_GPIO_LCD_RST BOARD_PORT_LCD_RST, BOARD_PIN_LCD_RST // #define LCD_SDA_H() GPIO_WriteBit(BOARD_GPIO_LCD_SDA, Bit_SET) #define LCD_SDA_L() GPIO_WriteBit(BOARD_GPIO_LCD_SDA, Bit_RESET) #define READ_LCD_SDA() GPIO_ReadInputDataBit(BOARD_GPIO_LCD_SDA) #define LCD_CLK_H() GPIO_WriteBit(BOARD_GPIO_LCD_CLK, Bit_SET) #define LCD_CLK_L() GPIO_WriteBit(BOARD_GPIO_LCD_CLK, Bit_RESET) #define LCD_RST_ENABLE() GPIO_WriteBit(BOARD_GPIO_LCD_RST, Bit_RESET) #define LCD_RST_DISABLE() GPIO_WriteBit(BOARD_GPIO_LCD_RST, Bit_SET) #define LCD_BG_LED_ON() GPIO_WriteBit(BOARD_GPIO_LCD_BG_LED, BG_LED_OFF) #define LCD_BG_LED_OFF() GPIO_WriteBit(BOARD_GPIO_LCD_BG_LED, BG_LED_ON) //-----------------------------------------LCD显示器驱动IO口,END #define BOARD_PIN_KEY1 GPIO_Pin_0 #define BOARD_PORT_KEY1 GPIOA #define BOARD_GPIO_KEY1 BOARD_PORT_KEY1, BOARD_PIN_KEY1 // #define BOARD_PIN_KEY2 GPIO_Pin_14 #define BOARD_PORT_KEY2 GPIOB #define BOARD_GPIO_KEY2 BOARD_PORT_KEY2, BOARD_PIN_KEY2 // #define BOARD_PIN_KEY3 GPIO_Pin_15 #define BOARD_PORT_KEY3 GPIOB #define BOARD_GPIO_KEY3 BOARD_PORT_KEY3, BOARD_PIN_KEY3 // #define BOARD_PIN_KEY4 GPIO_Pin_6 #define BOARD_PORT_KEY4 GPIOC #define BOARD_GPIO_KEY4 BOARD_PORT_KEY4, BOARD_PIN_KEY4 // #define BOARD_PIN_KEY5 GPIO_Pin_7 #define BOARD_PORT_KEY5 GPIOC #define BOARD_GPIO_KEY5 BOARD_PORT_KEY5, BOARD_PIN_KEY5 // #define BOARD_PIN_CURRENT_AD GPIO_Pin_1 //对应ADC1 #define BOARD_PORT_CURRENT_AD GPIOA #define BOARD_GPIO_CURRENT_AD BOARD_PORT_CURRENT_AD, BOARD_PIN_CURRENT_AD // #endif