board.h 3.3 KB

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