board.h 3.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. #ifndef __BOARD_H
  2. #define __BOARD_H
  3. #include "stm32f10x.h"
  4. #include "stm32f10x_gpio.h"
  5. #define BOARD_PIN_H Bit_SET
  6. #define BOARD_PIN_L Bit_RESET
  7. //-----------------------LED指示灯,低电平驱动
  8. #define BOARD_PIN_LED1 GPIO_Pin_3 //
  9. #define BOARD_PORT_LED1 GPIOA
  10. #define BOARD_GPIO_LED1 BOARD_PORT_LED1, BOARD_PIN_LED1 //
  11. #define BOARD_PIN_LED2 GPIO_Pin_3
  12. #define BOARD_PORT_LED2 GPIOC
  13. #define BOARD_GPIO_LED2 BOARD_PORT_LED2, BOARD_PIN_LED2 //
  14. #define LED_ON Bit_RESET
  15. #define LED_OFF Bit_SET
  16. #define BOARD_PIN_BEEP GPIO_Pin_12
  17. #define BOARD_PORT_BEEP GPIOA
  18. #define BOARD_GPIO_BEEP BOARD_PORT_BEEP, BOARD_PIN_BEEP //
  19. #define BEEP_ON Bit_SET
  20. #define BEEP_OFF Bit_RESET
  21. //-----------------------------------------LED指示灯,END
  22. //-----------------------LCD显示器驱动IO口
  23. #define BG_LED_ON Bit_RESET
  24. #define BG_LED_OFF Bit_SET
  25. #define BOARD_PIN_LCD_BG_LED GPIO_Pin_4 //
  26. #define BOARD_PORT_LCD_BG_LED GPIOB
  27. #define BOARD_GPIO_LCD_BG_LED BOARD_PORT_LCD_BG_LED, BOARD_PIN_LCD_BG_LED //
  28. #define BOARD_PIN_LCD_SDA GPIO_Pin_7 //
  29. #define BOARD_PORT_LCD_SDA GPIOB
  30. #define BOARD_GPIO_LCD_SDA BOARD_PORT_LCD_SDA, BOARD_PIN_LCD_SDA //
  31. #define BOARD_PIN_LCD_CLK GPIO_Pin_6 //
  32. #define BOARD_PORT_LCD_CLK GPIOB
  33. #define BOARD_GPIO_LCD_CLK BOARD_PORT_LCD_CLK, BOARD_PIN_LCD_CLK //
  34. #define BOARD_PIN_LCD_RST GPIO_Pin_5 //
  35. #define BOARD_PORT_LCD_RST GPIOB
  36. #define BOARD_GPIO_LCD_RST BOARD_PORT_LCD_RST, BOARD_PIN_LCD_RST //
  37. #define LCD_SDA_H() GPIO_WriteBit(BOARD_GPIO_LCD_SDA, Bit_SET)
  38. #define LCD_SDA_L() GPIO_WriteBit(BOARD_GPIO_LCD_SDA, Bit_RESET)
  39. #define READ_LCD_SDA() GPIO_ReadInputDataBit(BOARD_GPIO_LCD_SDA)
  40. #define LCD_CLK_H() GPIO_WriteBit(BOARD_GPIO_LCD_CLK, Bit_SET)
  41. #define LCD_CLK_L() GPIO_WriteBit(BOARD_GPIO_LCD_CLK, Bit_RESET)
  42. #define LCD_RST_ENABLE() GPIO_WriteBit(BOARD_GPIO_LCD_RST, Bit_RESET)
  43. #define LCD_RST_DISABLE() GPIO_WriteBit(BOARD_GPIO_LCD_RST, Bit_SET)
  44. #define LCD_BG_LED_ON() GPIO_WriteBit(BOARD_GPIO_LCD_BG_LED, BG_LED_OFF)
  45. #define LCD_BG_LED_OFF() GPIO_WriteBit(BOARD_GPIO_LCD_BG_LED, BG_LED_ON)
  46. //-----------------------------------------LCD显示器驱动IO口,END
  47. #define BOARD_PIN_KEY1 GPIO_Pin_0
  48. #define BOARD_PORT_KEY1 GPIOA
  49. #define BOARD_GPIO_KEY1 BOARD_PORT_KEY1, BOARD_PIN_KEY1 //
  50. #define BOARD_PIN_KEY2 GPIO_Pin_14
  51. #define BOARD_PORT_KEY2 GPIOB
  52. #define BOARD_GPIO_KEY2 BOARD_PORT_KEY2, BOARD_PIN_KEY2 //
  53. #define BOARD_PIN_KEY3 GPIO_Pin_15
  54. #define BOARD_PORT_KEY3 GPIOB
  55. #define BOARD_GPIO_KEY3 BOARD_PORT_KEY3, BOARD_PIN_KEY3 //
  56. #define BOARD_PIN_KEY4 GPIO_Pin_6
  57. #define BOARD_PORT_KEY4 GPIOC
  58. #define BOARD_GPIO_KEY4 BOARD_PORT_KEY4, BOARD_PIN_KEY4 //
  59. #define BOARD_PIN_KEY5 GPIO_Pin_7
  60. #define BOARD_PORT_KEY5 GPIOC
  61. #define BOARD_GPIO_KEY5 BOARD_PORT_KEY5, BOARD_PIN_KEY5 //
  62. #define BOARD_PIN_CURRENT_AD GPIO_Pin_1 //对应ADC1
  63. #define BOARD_PORT_CURRENT_AD GPIOA
  64. #define BOARD_GPIO_CURRENT_AD BOARD_PORT_CURRENT_AD, BOARD_PIN_CURRENT_AD //
  65. #endif