fix enable USART port
This commit is contained in:
parent
68749ef851
commit
281c9924f6
|
@ -41,6 +41,7 @@
|
||||||
#define USART_IRQ NVIC_USART1_IRQ /**< USART peripheral interrupt signal */
|
#define USART_IRQ NVIC_USART1_IRQ /**< USART peripheral interrupt signal */
|
||||||
#define USART_ISR usart1_isr /**< USART interrupt service routine */
|
#define USART_ISR usart1_isr /**< USART interrupt service routine */
|
||||||
#define USART_PORT GPIOA /**< USART port */
|
#define USART_PORT GPIOA /**< USART port */
|
||||||
|
#define USART_PORT_RCC RCC_GPIOA /**< USART port peripheral clock */
|
||||||
#define USART_PIN_TX GPIO_USART1_TX /**< USART transmit pin (PA9) */
|
#define USART_PIN_TX GPIO_USART1_TX /**< USART transmit pin (PA9) */
|
||||||
#define USART_PIN_RX GPIO_USART1_RX /**< USART receive pin (PA10) */
|
#define USART_PIN_RX GPIO_USART1_RX /**< USART receive pin (PA10) */
|
||||||
/** @} */
|
/** @} */
|
||||||
|
@ -59,6 +60,7 @@ volatile uint8_t usart_received = 0; // same as rx_used, but since the user can
|
||||||
void usart_setup(void)
|
void usart_setup(void)
|
||||||
{
|
{
|
||||||
/* enable USART I/O peripheral */
|
/* enable USART I/O peripheral */
|
||||||
|
rcc_periph_clock_enable(USART_PORT_RCC); // enable clock for USART port peripheral
|
||||||
rcc_periph_clock_enable(USART_RCC); // enable clock for USART peripheral
|
rcc_periph_clock_enable(USART_RCC); // enable clock for USART peripheral
|
||||||
gpio_set_mode(USART_PORT, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USART_PIN_TX); // setup GPIO pin USART transmit
|
gpio_set_mode(USART_PORT, GPIO_MODE_OUTPUT_10_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, USART_PIN_TX); // setup GPIO pin USART transmit
|
||||||
gpio_set_mode(USART_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, USART_PIN_RX); // setup GPIO pin USART receive
|
gpio_set_mode(USART_PORT, GPIO_MODE_INPUT, GPIO_CNF_INPUT_PULL_UPDOWN, USART_PIN_RX); // setup GPIO pin USART receive
|
||||||
|
|
Loading…
Reference in New Issue