usart.h 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  1. #ifndef __DEBUG_USART_H
  2. #define __DEBUG_USART_H
  3. #include "stm32f2xx.h"
  4. #include <stdio.h>
  5. #include "sys_data.h"
  6. //#define USART_BAUDRATE 9600 //눔왯꺼景쪽
  7. //#define USART3_RX_GPIO_PORT GPIOD
  8. //#define USART3_RX_GPIO_CLK RCC_AHB1Periph_GPIOD
  9. //#define USART3_RX_PIN GPIO_Pin_8
  10. //#define USART3_RX_AF GPIO_AF_USART3
  11. //#define USART3_RX_SOURCE GPIO_PinSource8
  12. //#define USART3_TX_GPIO_PORT GPIOD
  13. //#define USART3_TX_GPIO_CLK RCC_AHB1Periph_GPIOD
  14. //#define USART3_TX_PIN GPIO_Pin_9
  15. //#define USART3_TX_AF GPIO_AF_USART3
  16. //#define USART3_TX_SOURCE GPIO_PinSource9
  17. //232多신땍屢
  18. #define USART_232 USART1
  19. #define USART_232_CLK RCC_APB2Periph_USART1
  20. #define USART_232_BAUDRATE 115200 //눔왯꺼景쪽
  21. #define USART_232_RX_GPIO_PORT GPIOA
  22. #define USART_232_RX_GPIO_CLK RCC_AHB1Periph_GPIOA
  23. #define USART_232_RX_PIN GPIO_Pin_10
  24. #define USART_232_RX_AF GPIO_AF_USART1
  25. #define USART_232_RX_SOURCE GPIO_PinSource10
  26. #define USART_232_TX_GPIO_PORT GPIOA
  27. #define USART_232_TX_GPIO_CLK RCC_AHB1Periph_GPIOA
  28. #define USART_232_TX_PIN GPIO_Pin_9
  29. #define USART_232_TX_AF GPIO_AF_USART1
  30. #define USART_232_TX_SOURCE GPIO_PinSource9
  31. #define USART_232_IRQHandler USART1_IRQHandler
  32. #define USART_232_IRQ USART1_IRQn
  33. void USART3_config(void);
  34. // 꿎桿刻절
  35. void USART_485_config(void);
  36. void USART_485_DE_TX(void);
  37. void USART_485_DE_RX(void);
  38. //485多신땍屢
  39. #define USART_485 USART3
  40. #define USART_485_CLK RCC_APB1Periph_USART3
  41. #define USART_485_BAUDRATE 9600 //눔왯꺼景쪽
  42. #define USART_485_RX_GPIO_PORT GPIOC
  43. #define USART_485_RX_GPIO_CLK RCC_AHB1Periph_GPIOC
  44. #define USART_485_RX_PIN GPIO_Pin_11
  45. #define USART_485_RX_AF GPIO_AF_USART3
  46. #define USART_485_RX_SOURCE GPIO_PinSource11
  47. #define USART_485_TX_GPIO_PORT GPIOC
  48. #define USART_485_TX_GPIO_CLK RCC_AHB1Periph_GPIOC
  49. #define USART_485_TX_PIN GPIO_Pin_10
  50. #define USART_485_TX_AF GPIO_AF_USART3
  51. #define USART_485_TX_SOURCE GPIO_PinSource10
  52. #define USART_485_IRQHandler USART3_IRQHandler
  53. #define USART_485_IRQ USART3_IRQn
  54. //485왠齡多신
  55. #define USART_485_DE_GPIO_PORT GPIOC
  56. #define USART_485_DE_GPIO_CLK RCC_AHB1Periph_GPIOC
  57. #define USART_485_DE_PIN GPIO_Pin_12
  58. #endif /* __USART1_H */