2014-03-13 01:06:26 +00:00
|
|
|
typedef enum {
|
|
|
|
PYB_USART_NONE = 0,
|
|
|
|
PYB_USART_1 = 1,
|
|
|
|
PYB_USART_2 = 2,
|
|
|
|
PYB_USART_3 = 3,
|
2014-04-14 01:45:58 +01:00
|
|
|
PYB_USART_4 = 4,
|
|
|
|
PYB_USART_5 = 5,
|
|
|
|
PYB_USART_6 = 6,
|
2014-03-13 01:06:26 +00:00
|
|
|
|
2014-04-14 01:45:58 +01:00
|
|
|
#if defined(PYBV10)
|
|
|
|
PYB_USART_XA = 4, // USART4 on X1, X2 = PA0, PA1
|
2014-03-13 01:06:26 +00:00
|
|
|
PYB_USART_XB = 1, // USART1 on X9, X10 = PB6, PB7
|
2014-04-14 01:45:58 +01:00
|
|
|
PYB_USART_YA = 6, // USART6 on Y1, Y2 = PC6, PC7
|
2014-03-13 01:06:26 +00:00
|
|
|
PYB_USART_YB = 3, // USART3 on Y9, Y10 = PB10, PB11
|
2014-04-14 01:45:58 +01:00
|
|
|
#endif
|
|
|
|
|
2014-03-13 01:06:26 +00:00
|
|
|
} pyb_usart_t;
|
|
|
|
|
2014-03-16 07:22:22 +00:00
|
|
|
typedef struct _pyb_usart_obj_t pyb_usart_obj_t;
|
2014-03-13 01:06:26 +00:00
|
|
|
|
2014-03-16 07:22:22 +00:00
|
|
|
extern pyb_usart_obj_t *pyb_usart_global_debug;
|
2014-03-25 23:40:54 +00:00
|
|
|
extern const mp_obj_type_t pyb_usart_type;
|
2014-03-16 07:22:22 +00:00
|
|
|
|
2014-04-14 01:45:58 +01:00
|
|
|
bool usart_init(pyb_usart_obj_t *usart_obj, uint32_t baudrate);
|
2014-03-16 07:22:22 +00:00
|
|
|
bool usart_rx_any(pyb_usart_obj_t *usart_obj);
|
|
|
|
int usart_rx_char(pyb_usart_obj_t *usart_obj);
|
|
|
|
void usart_tx_str(pyb_usart_obj_t *usart_obj, const char *str);
|
|
|
|
void usart_tx_strn(pyb_usart_obj_t *usart_obj, const char *str, uint len);
|
|
|
|
void usart_tx_strn_cooked(pyb_usart_obj_t *usart_obj, const char *str, uint len);
|
|
|
|
|