serial.c 392 B

12345678910111213141516171819
  1. #include "mcc_generated_files/mcc.h"
  2. #include <string.h>
  3. void serial_print_bytes(const char *data, int len) {
  4. for (int i=0; i<len; i++) {
  5. EUSART1_Write(data[i]);
  6. }
  7. }
  8. void serial_print(const char *data) {
  9. size_t len = strlen(data);
  10. serial_print_bytes(data, len);
  11. }
  12. void serial_println(const char *data) {
  13. serial_print(data);
  14. serial_print_bytes("\r\n", 2);
  15. }