uart.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566
  1. /*
  2. * This file is part of the MSP430 hardware UART example.
  3. *
  4. * Copyright (C) 2012 Stefan Wendler <sw@kaltpost.de>
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. */
  19. /******************************************************************************
  20. * Hardware UART example for MSP430.
  21. *
  22. * Stefan Wendler
  23. * sw@kaltpost.de
  24. * http://gpio.kaltpost.de
  25. *
  26. *****************************************************************************/
  27. #ifndef __UART_H
  28. #define __UART_H
  29. /**
  30. * Initialize soft UART
  31. */
  32. void uart_init(void);
  33. /**
  34. * Set pointer for ISR to call when data was received.
  35. *
  36. * @param[in] *isr_ptr pointer to ISR
  37. */
  38. void uart_set_rx_isr_ptr(void (*isr_ptr)(unsigned char c));
  39. /**
  40. * Read one character from UART blocking.
  41. *
  42. * @return character received
  43. */
  44. unsigned char uart_getc();
  45. /**
  46. * Write one chracter to the UART blocking.
  47. *
  48. * @param[in] *c the character to write
  49. */
  50. void uart_putc(unsigned char c);
  51. /**
  52. * Write string to the UART blocking.
  53. *
  54. * @param[in] *str the 0 terminated string to write
  55. */
  56. void uart_puts(const char *str);
  57. #endif