File tree 2 files changed +26
-0
lines changed
2 files changed +26
-0
lines changed Original file line number Diff line number Diff line change @@ -528,6 +528,31 @@ int uart_getc(serial_t *obj, unsigned char *c)
528
528
return 0 ;
529
529
}
530
530
531
+ // PR180: HardwareSerial: use correct UART HW for TX
532
+ /**
533
+ * @brief Write byte to uart
534
+ * @param obj : pointer to serial_t structure
535
+ * @retval error status
536
+ */
537
+ int uart_putc (serial_t * obj , unsigned char c )
538
+ {
539
+ uint32_t tickstart = GetTick ();
540
+
541
+ if (obj == NULL ) {
542
+ return -1 ;
543
+ }
544
+
545
+ while (serial_tx_active (obj ))
546
+ {
547
+ if ((GetTick () - tickstart ) >= TX_TIMEOUT )
548
+ {
549
+ return 0 ; // 0 means no error? Should be timeout error?
550
+ }
551
+ }
552
+
553
+ USART_SendData (uart_handlers [obj -> index ]-> Instance , c );
554
+ return 0 ; // 0 means no error
555
+ }
531
556
532
557
533
558
Original file line number Diff line number Diff line change @@ -90,6 +90,7 @@ typedef struct __UART_HandleTypeDef
90
90
void uart_deinit (serial_t * obj );
91
91
92
92
int uart_getc (serial_t * obj , unsigned char * c );
93
+ int uart_putc (serial_t * obj , unsigned char c ); // PR180: HardwareSerial: use correct UART HW for TX
93
94
94
95
uint8_t serial_tx_active (serial_t * obj );
95
96
uint8_t serial_rx_active (serial_t * obj );
You can’t perform that action at this time.
0 commit comments