You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

77 lines
1.5 KiB

  1. /* Copyright 2021
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 3 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <https://www.gnu.org/licenses/>.
  15. */
  16. #pragma once
  17. #include <stdint.h>
  18. #include <hal.h>
  19. #ifndef SERIAL_DRIVER
  20. # define SERIAL_DRIVER SD1
  21. #endif
  22. #ifndef SD1_TX_PIN
  23. # define SD1_TX_PIN A9
  24. #endif
  25. #ifndef SD1_TX_PAL_MODE
  26. # define SD1_TX_PAL_MODE 7
  27. #endif
  28. #ifndef SD1_RX_PIN
  29. # define SD1_RX_PIN A10
  30. #endif
  31. #ifndef SD1_RX_PAL_MODE
  32. # define SD1_RX_PAL_MODE 7
  33. #endif
  34. #ifndef SD1_CTS_PIN
  35. # define SD1_CTS_PIN A11
  36. #endif
  37. #ifndef SD1_CTS_PAL_MODE
  38. # define SD1_CTS_PAL_MODE 7
  39. #endif
  40. #ifndef SD1_RTS_PIN
  41. # define SD1_RTS_PIN A12
  42. #endif
  43. #ifndef SD1_RTS_PAL_MODE
  44. # define SD1_RTS_PAL_MODE 7
  45. #endif
  46. #ifndef SD1_CR1
  47. # define SD1_CR1 0
  48. #endif
  49. #ifndef SD1_CR2
  50. # define SD1_CR2 0
  51. #endif
  52. #ifndef SD1_CR3
  53. # define SD1_CR3 0
  54. #endif
  55. void uart_init(uint32_t baud);
  56. void uart_putchar(uint8_t c);
  57. uint8_t uart_getchar(void);
  58. bool uart_available(void);