diff options
| author | Damien George | 2014-01-22 22:55:07 +0000 |
|---|---|---|
| committer | Damien George | 2014-01-22 22:55:07 +0000 |
| commit | b5d13c309f00b0c959c0806c1ab11ba7a07c2cee (patch) | |
| tree | e9f2a453b16edda613765f767ab69afdc4c9bf74 /stm/usart.c | |
| parent | 5fa93b67557f21c22a41449c3266571c427f6798 (diff) | |
stm: Fix USART3 init. Small edits to Makefile and other things.
Diffstat (limited to 'stm/usart.c')
| -rw-r--r-- | stm/usart.c | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/stm/usart.c b/stm/usart.c index 17ff146d5..1ab385174 100644 --- a/stm/usart.c +++ b/stm/usart.c @@ -77,11 +77,19 @@ void usart_init(pyb_usart_t usart_id, uint32_t baudrate) { case PYB_USART_3: USARTx = USART3; +#if defined(PYBOARD4) + GPIO_Port = GPIOB; + GPIO_AF_USARTx = GPIO_AF_USART3; + GPIO_Pin = GPIO_Pin_10 | GPIO_Pin_11; + GPIO_PinSource_TX = GPIO_PinSource10; + GPIO_PinSource_RX = GPIO_PinSource11; +#else GPIO_Port = GPIOD; GPIO_AF_USARTx = GPIO_AF_USART3; GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_9; GPIO_PinSource_TX = GPIO_PinSource8; GPIO_PinSource_RX = GPIO_PinSource9; +#endif RCC_APBxPeriph = RCC_APB1Periph_USART3; RCC_APBxPeriphClockCmd =RCC_APB1PeriphClockCmd; @@ -206,7 +214,7 @@ static mp_obj_t usart_obj_tx_char(mp_obj_t self_in, mp_obj_t c) { static mp_obj_t usart_obj_tx_str(mp_obj_t self_in, mp_obj_t s) { pyb_usart_obj_t *self = self_in; if (self->is_enabled) { - if (MP_OBJ_IS_TYPE(s, &str_type)) { + if (MP_OBJ_IS_STR(s)) { uint len; const byte *data = mp_obj_str_get_data(s, &len); usart_tx_bytes(self->usart_id, data, len); |
