void uart5_init( void ) { uart_periph_init(&uart5); uart5.reg_addr = USART5; /* init RCC */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_UART5, ENABLE); RCC_APB2PeriphClockCmd(UART5_PeriphTx, ENABLE); RCC_APB2PeriphClockCmd(UART5_PeriphRx, ENABLE); /* Enable UART5 interrupts */ usart_enable_irq(UART5_IRQn); /* Init GPIOS */ GPIO_InitTypeDef gpio; /* GPIOC: GPIO_Pin_10 UART5 Tx push-pull */ gpio.GPIO_Pin = UART5_TxPin; gpio.GPIO_Mode = GPIO_Mode_AF_PP; gpio.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(UART5_TxPort, &gpio); /* GPIOC: GPIO_Pin_11 UART5 Rx pin as floating input */ gpio.GPIO_Pin = UART5_RxPin; gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(UART5_RxPort, &gpio); /* Configure UART5 */ uart_periph_set_baudrate(&uart5, UART5_BAUD); }
void uart2_init( void ) { uart_periph_init(&uart2); uart2.reg_addr = USART2; /* init RCC */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART2, ENABLE); RCC_APB2PeriphClockCmd(UART2_Periph, ENABLE); /* Enable USART2 interrupts */ usart_enable_irq(USART2_IRQn); /* Init GPIOS */ GPIO_InitTypeDef gpio; /* GPIOA: GPIO_Pin_2 USART2 Tx push-pull */ gpio.GPIO_Pin = UART2_TxPin; // ; gpio.GPIO_Mode = GPIO_Mode_AF_PP; gpio.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(UART2_TxPort, &gpio); /* GPIOA: GPIO_Pin_3 USART2 Rx pin as floating input */ gpio.GPIO_Pin = UART2_RxPin; // ; gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(UART2_RxPort, &gpio); /* Configure USART2 */ uart_periph_set_baudrate(&uart2, UART2_BAUD); }
void uart3_init( void ) { uart_periph_init(&uart3); uart3.reg_addr = USART3; /* init RCC */ RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3, ENABLE); RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE); RCC_APB2PeriphClockCmd(UART3_Periph, ENABLE); /* Enable USART3 interrupts */ usart_enable_irq(USART3_IRQn); /* Init GPIOS */ GPIO_PinRemapConfig(GPIO_PartialRemap_USART3, ENABLE); GPIO_InitTypeDef gpio; /* GPIOC: GPIO_Pin_10 USART3 Tx push-pull */ gpio.GPIO_Pin = UART3_TxPin; gpio.GPIO_Mode = GPIO_Mode_AF_PP; gpio.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(UART3_TxPort, &gpio); /* GPIOC: GPIO_Pin_11 USART3 Rx pin as floating input */ gpio.GPIO_Pin = UART3_RxPin; gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(UART3_RxPort, &gpio); /* Configure USART3 */ uart_periph_set_baudrate(&uart3, UART3_BAUD); }
void uart5_init( void ) { uart_periph_init(&uart5); uart5.reg_addr = (void *)UART5; /* init RCC and GPIOs */ #if defined(STM32F4) rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_UART5EN); set_uart_pin(UART5_GPIO_PORT_RX, UART5_GPIO_RX, UART5_GPIO_AF); set_uart_pin(UART5_GPIO_PORT_TX, UART5_GPIO_TX, UART5_GPIO_AF); #elif defined(STM32F1) rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_UART5EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPDEN); gpio_set_mode(GPIO_BANK_UART5_TX, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_UART5_TX); gpio_set_mode(GPIO_BANK_UART5_RX, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_UART5_RX); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_UART5_IRQ); /* Configure USART */ uart_periph_set_mode(&uart5, USE_UART5_TX, USE_UART5_RX, FALSE); uart_periph_set_baudrate(&uart5, UART5_BAUD); }
void uart1_init( void ) { uart_periph_init(&uart1); uart1.reg_addr = USART1; /* init RCC */ RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE); RCC_APB2PeriphClockCmd(UART1_Periph, ENABLE); /* Enable USART1 interrupts */ usart_enable_irq(USART1_IRQn); /* Init GPIOS */ GPIO_InitTypeDef gpio; /* GPIOA: GPIO_Pin_9 USART1 Tx push-pull */ gpio.GPIO_Pin = UART1_TxPin; gpio.GPIO_Mode = GPIO_Mode_AF_PP; gpio.GPIO_Speed = GPIO_Speed_50MHz; GPIO_Init(UART1_TxPort, &gpio); /* GPIOA: GPIO_Pin_10 USART1 Rx pin as floating input */ gpio.GPIO_Pin = UART1_RxPin; gpio.GPIO_Mode = GPIO_Mode_IN_FLOATING; GPIO_Init(UART1_RxPort, &gpio); /* Configure USART1 */ uart_periph_set_baudrate(&uart1, UART1_BAUD); }
void uart8_init(void) { uart_periph_init(&uart8); // Only set pin if enabled and not statically defined in board file #if USE_UART8_TX && defined UART8_GPIO_PORT_TX gpio_setup_pin_af(UART8_GPIO_PORT_TX, UART8_GPIO_TX, UART8_GPIO_AF, TRUE); #endif #if USE_UART8_RX && defined UART8_GPIO_PORT_RX gpio_setup_pin_af(UART8_GPIO_PORT_RX, UART8_GPIO_RX, UART8_GPIO_AF, FALSE); #endif sdStart(&SD8, &usart8_config); uart8.reg_addr = &SD8; uart8.init_struct = &uart8_init_struct; uart8_init_struct.conf = &usart8_config; // Create threads #if USE_UART8_RX uart8_init_struct.rx_mtx = &uart8_rx_mtx; uart8_init_struct.rx_sem = &uart8_rx_sem; chThdCreateStatic(wa_thd_uart8_rx, sizeof(wa_thd_uart8_rx), NORMALPRIO, thd_uart8_rx, NULL); #endif #if USE_UART8_TX uart8_init_struct.tx_mtx = &uart8_tx_mtx; uart8_init_struct.tx_sem = &uart8_tx_sem; chThdCreateStatic(wa_thd_uart8_tx, sizeof(wa_thd_uart8_tx), NORMALPRIO, thd_uart8_tx, NULL); #endif }
void uart2_init(void) { uart_periph_init(&uart2); uart2.reg_addr = (void *)USART2; /* init RCC and GPIOs */ rcc_periph_clock_enable(RCC_USART2); #if USE_UART2_TX gpio_setup_pin_af(UART2_GPIO_PORT_TX, UART2_GPIO_TX, UART2_GPIO_AF, TRUE); #endif #if USE_UART2_RX gpio_setup_pin_af(UART2_GPIO_PORT_RX, UART2_GPIO_RX, UART2_GPIO_AF, FALSE); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_USART2_IRQ); #if UART2_HW_FLOW_CONTROL && defined(STM32F4) #warning "USING UART2 FLOW CONTROL. Make sure to pull down CTS if you are not connecting any flow-control-capable hardware." /* setup CTS and RTS pins */ gpio_setup_pin_af(UART2_GPIO_PORT_CTS, UART2_GPIO_CTS, UART2_GPIO_AF, FALSE); gpio_setup_pin_af(UART2_GPIO_PORT_RTS, UART2_GPIO_RTS, UART2_GPIO_AF, TRUE); #endif /* Configure USART Tx,Rx, and hardware flow control*/ uart_periph_set_mode(&uart2, USE_UART2_TX, USE_UART2_RX, UART2_HW_FLOW_CONTROL); /* Configure USART */ uart_periph_set_bits_stop_parity(&uart2, UART2_BITS, UART2_STOP, UART2_PARITY); uart_periph_set_baudrate(&uart2, UART2_BAUD); }
void uart1_init(void) { uart_periph_init(&uart1); uart1.reg_addr = (void *)USART1; /* init RCC and GPIOs */ rcc_periph_clock_enable(RCC_USART1); #if USE_UART1_TX gpio_setup_pin_af(UART1_GPIO_PORT_TX, UART1_GPIO_TX, UART1_GPIO_AF, TRUE); #endif #if USE_UART1_RX gpio_setup_pin_af(UART1_GPIO_PORT_RX, UART1_GPIO_RX, UART1_GPIO_AF, FALSE); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_USART1_IRQ); #if UART1_HW_FLOW_CONTROL #warning "USING UART1 FLOW CONTROL. Make sure to pull down CTS if you are not connecting any flow-control-capable hardware." /* setup CTS and RTS gpios */ gpio_setup_pin_af(UART1_GPIO_PORT_CTS, UART1_GPIO_CTS, UART1_GPIO_AF, FALSE); gpio_setup_pin_af(UART1_GPIO_PORT_RTS, UART1_GPIO_RTS, UART1_GPIO_AF, TRUE); #endif /* Configure USART1, enable hardware flow control*/ uart_periph_set_mode(&uart1, USE_UART1_TX, USE_UART1_RX, UART1_HW_FLOW_CONTROL); /* Set USART1 parameters and enable interrupt */ uart_periph_set_bits_stop_parity(&uart1, UART1_BITS, UART1_STOP, UART1_PARITY); uart_periph_set_baudrate(&uart1, UART1_BAUD); }
void uart0_init( void ) { uart_periph_init(&uart0); uart0.reg_addr = UART0_BASE; #ifdef USE_UART0_RX_ONLY // only use the RX0 P0.1 pin, no TX PINSEL0 = (PINSEL0 & ~U0_PINMASK_RX) | U0_PINSEL_RX; #else // set port pins for UART0 PINSEL0 = (PINSEL0 & ~U0_PINMASK) | U0_PINSEL; #endif // initialize uart parameters uart_disable_interrupts(&uart0); uart_set_baudrate(&uart0, UART0_BAUD); // initialize the interrupt vector VICIntSelect &= ~VIC_BIT(VIC_UART0); // UART0 selected as IRQ VICIntEnable = VIC_BIT(VIC_UART0); // UART0 interrupt enabled _VIC_CNTL(UART0_VIC_SLOT) = VIC_ENABLE | VIC_UART0; _VIC_ADDR(UART0_VIC_SLOT) = (uint32_t)uart0_ISR; // address of the ISR uart_enable_interrupts(&uart0); }
void uart1_init( void ) { uart_periph_init(&uart1); uart1.reg_addr = UART1_BASE; #ifdef USE_UART1_RX_ONLY // only use the RX1 P0.9 pin, no TX PINSEL0 = (PINSEL0 & ~U1_PINMASK_RX) | U1_PINSEL_RX; #else // set port pins for UART1 PINSEL0 = (PINSEL0 & ~U1_PINMASK) | U1_PINSEL; #endif uart_disable_interrupts(&uart1); uart_set_baudrate(&uart1, UART1_BAUD); // initialize the interrupt vector VICIntSelect &= ~VIC_BIT(VIC_UART1); // UART1 selected as IRQ VICIntEnable = VIC_BIT(VIC_UART1); // UART1 interrupt enabled _VIC_CNTL(UART1_VIC_SLOT) = VIC_ENABLE | VIC_UART1; _VIC_ADDR(UART1_VIC_SLOT) = (uint32_t)uart1_ISR; // address of the ISR // enable receiver interrupts uart_enable_interrupts(&uart1); }
void uart3_init( void ) { uart_periph_init(&uart3); uart3.reg_addr = (void *)USART3; /* init RCC */ rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART3EN); #if USE_UART3_TX gpio_setup_pin_af(UART3_GPIO_PORT_TX, UART3_GPIO_TX, UART3_GPIO_AF, TRUE); #endif #if USE_UART3_RX gpio_setup_pin_af(UART3_GPIO_PORT_RX, UART3_GPIO_RX, UART3_GPIO_AF, FALSE); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_USART3_IRQ); #if UART3_HW_FLOW_CONTROL && defined(STM32F4) #warning "USING UART3 FLOW CONTROL. Make sure to pull down CTS if you are not connecting any flow-control-capable hardware." /* setup CTS and RTS pins */ gpio_setup_pin_af(UART3_GPIO_PORT_CTS, UART3_GPIO_CTS, UART3_GPIO_AF, FALSE); gpio_setup_pin_af(UART3_GPIO_PORT_RTS, UART3_GPIO_RTS, UART3_GPIO_AF, TRUE); #endif /* Configure USART Tx,Rx, and hardware flow control*/ uart_periph_set_mode(&uart3, USE_UART3_TX, USE_UART3_RX, UART3_HW_FLOW_CONTROL); /* Configure USART */ uart_periph_set_baudrate(&uart3, UART3_BAUD); }
void uart6_init( void ) { uart_periph_init(&uart6); uart6.reg_addr = (void *)USART6; /* enable uart clock */ rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART6EN); /* init RCC and GPIOs */ #if USE_UART6_TX gpio_setup_pin_af(UART6_GPIO_PORT_TX, UART6_GPIO_TX, UART6_GPIO_AF, TRUE); #endif #if USE_UART6_RX gpio_setup_pin_af(UART6_GPIO_PORT_RX, UART6_GPIO_RX, UART6_GPIO_AF, FALSE); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_USART6_IRQ); #if UART6_HW_FLOW_CONTROL #warning "USING UART6 FLOW CONTROL. Make sure to pull down CTS if you are not connecting any flow-control-capable hardware." /* setup CTS and RTS pins */ gpio_setup_pin_af(UART6_GPIO_PORT_CTS, UART6_GPIO_CTS, UART6_GPIO_AF, FALSE); gpio_setup_pin_af(UART6_GPIO_PORT_RTS, UART6_GPIO_RTS, UART6_GPIO_AF, TRUE); #endif /* Configure USART Tx,Rx and hardware flow control*/ uart_periph_set_mode(&uart6, USE_UART6_TX, USE_UART6_RX, UART6_HW_FLOW_CONTROL); uart_periph_set_baudrate(&uart6, UART6_BAUD); }
int main (int argc, char** argv) { mcu_init(); sys_time_register_timer((1./PERIODIC_FREQUENCY), NULL); led_init(); adc_init(); adc_buf_channel(ADC_0, &buf_adc[0], ADC_NB_SAMPLES); adc_buf_channel(ADC_1, &buf_adc[1], ADC_NB_SAMPLES); adc_buf_channel(ADC_2, &buf_adc[2], ADC_NB_SAMPLES); adc_buf_channel(ADC_3, &buf_adc[3], ADC_NB_SAMPLES); adc_buf_channel(ADC_4, &buf_adc[4], ADC_NB_SAMPLES); adc_buf_channel(ADC_5, &buf_adc[5], ADC_NB_SAMPLES); #ifdef ADC_6 adc_buf_channel(ADC_6, &buf_adc[6], ADC_NB_SAMPLES); #endif #ifdef ADC_7 adc_buf_channel(ADC_7, &buf_adc[7], ADC_NB_SAMPLES); #endif #if NB_ADC != 8 #error "8 ADCs expected !" #endif #ifdef USE_UART0 uart_periph_init(&uart0); #endif #ifdef USE_UART1 uart_periph_init(&uart1); #endif mcu_int_enable(); while(1) { if (sys_time_check_and_ack_timer(0)) { LED_TOGGLE(1); uint16_t values[NB_ADC]; uint8_t i; for(i = 0; i < NB_ADC; i++) values[i] = buf_adc[i].sum / ADC_NB_SAMPLES; uint8_t id = 42; DOWNLINK_SEND_ADC(&id, NB_ADC, values); } } return 0; }
void uart4_init( void ) { uart_periph_init(&uart4); uart4.reg_addr = (void *)UART4; /* init RCC and GPIOs */ rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_UART4EN); set_uart_pin(UART4_GPIO_PORT_RX, UART4_GPIO_RX, UART4_GPIO_AF); set_uart_pin(UART4_GPIO_PORT_TX, UART4_GPIO_TX, UART4_GPIO_AF); /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_UART4_IRQ); /* Configure USART */ uart_periph_set_mode(&uart4, USE_UART4_TX, USE_UART4_RX, FALSE); uart_periph_set_baudrate(&uart4, UART4_BAUD); }
void uart1_init( void ) { uart_periph_init(&uart1); uart1.reg_addr = (void *)USART1; /* init RCC and GPIOs */ #if defined(STM32F4) rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN); set_uart_pin(UART1_GPIO_PORT_RX, UART1_GPIO_RX, UART1_GPIO_AF); set_uart_pin(UART1_GPIO_PORT_TX, UART1_GPIO_TX, UART1_GPIO_AF); #elif defined(STM32F1) rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_USART1EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPAEN); gpio_set_mode(GPIO_BANK_USART1_TX, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_TX); gpio_set_mode(GPIO_BANK_USART1_RX, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_USART1_RX); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_USART1_IRQ); #if UART1_HW_FLOW_CONTROL #warning "USING UART1 FLOW CONTROL. Make sure to pull down CTS if you are not connecting any flow-control-capable hardware." /* setup CTS and RTS gpios */ #if defined(STM32F4) set_uart_pin(UART1_GPIO_PORT_CTS, UART1_GPIO_CTS, UART1_GPIO_AF); set_uart_pin(UART1_GPIO_PORT_RTS, UART1_GPIO_RTS, UART1_GPIO_AF); #elif defined(STM32F1) gpio_set_mode(GPIO_BANK_USART1_RTS, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART1_RTS); gpio_set_mode(GPIO_BANK_USART1_CTS, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_USART1_CTS); #endif #endif /* Configure USART1, enable hardware flow control*/ uart_periph_set_mode(&uart1, USE_UART1_TX, USE_UART1_RX, UART1_HW_FLOW_CONTROL); /* Set USART1 baudrate and enable interrupt */ uart_periph_set_baudrate(&uart1, UART1_BAUD); }
void uart6_init(void) { uart_periph_init(&uart6); sdStart(&SD6, &usart6_config); uart6.reg_addr = &SD6; uart6.init_struct = &uart6_init_struct; // Create threads #if USE_UART6_RX uart6_init_struct.rx_mtx = &uart6_rx_mtx; uart6_init_struct.rx_sem = &uart6_rx_sem; chThdCreateStatic(wa_thd_uart6_rx, sizeof(wa_thd_uart6_rx), NORMALPRIO, thd_uart6_rx, NULL); #endif #if USE_UART6_TX uart6_init_struct.tx_mtx = &uart6_tx_mtx; uart6_init_struct.tx_sem = &uart6_tx_sem; chThdCreateStatic(wa_thd_uart6_tx, sizeof(wa_thd_uart6_tx), NORMALPRIO, thd_uart6_tx, NULL); #endif }
void uart5_init( void ) { uart_periph_init(&uart5); uart5.reg_addr = (void *)UART5; /* init RCC and GPIOs */ rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_UART5EN); #if USE_UART5_TX gpio_setup_pin_af(UART5_GPIO_PORT_TX, UART5_GPIO_TX, UART5_GPIO_AF, TRUE); #endif #if USE_UART5_RX gpio_setup_pin_af(UART5_GPIO_PORT_RX, UART5_GPIO_RX, UART5_GPIO_AF, FALSE); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_UART5_IRQ); /* Configure USART */ uart_periph_set_mode(&uart5, USE_UART5_TX, USE_UART5_RX, FALSE); uart_periph_set_baudrate(&uart5, UART5_BAUD); }
void uart3_init( void ) { uart_periph_init(&uart3); uart3.reg_addr = (void *)USART3; /* init RCC */ #if defined(STM32F4) rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART3EN); set_uart_pin(UART3_GPIO_PORT_RX, UART3_GPIO_RX, UART3_GPIO_AF); set_uart_pin(UART3_GPIO_PORT_TX, UART3_GPIO_TX, UART3_GPIO_AF); #elif defined(STM32F1) rcc_peripheral_enable_clock(&RCC_APB1ENR, RCC_APB1ENR_USART3EN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_IOPCEN); rcc_peripheral_enable_clock(&RCC_APB2ENR, RCC_APB2ENR_AFIOEN); AFIO_MAPR |= AFIO_MAPR_USART3_REMAP_PARTIAL_REMAP; gpio_set_mode(GPIO_BANK_USART3_PR_TX, GPIO_MODE_OUTPUT_50_MHZ, GPIO_CNF_OUTPUT_ALTFN_PUSHPULL, GPIO_USART3_PR_TX); gpio_set_mode(GPIO_BANK_USART3_PR_RX, GPIO_MODE_INPUT, GPIO_CNF_INPUT_FLOAT, GPIO_USART3_PR_RX); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_USART3_IRQ); #if UART3_HW_FLOW_CONTROL && defined(STM32F4) #warning "USING UART3 FLOW CONTROL. Make sure to pull down CTS if you are not connecting any flow-control-capable hardware." /* setup CTS and RTS pins */ set_uart_pin(UART3_GPIO_PORT_CTS, UART3_GPIO_CTS, UART3_GPIO_AF); set_uart_pin(UART3_GPIO_PORT_RTS, UART3_GPIO_RTS, UART3_GPIO_AF); #endif /* Configure USART Tx,Rx, and hardware flow control*/ uart_periph_set_mode(&uart3, USE_UART3_TX, USE_UART3_RX, UART3_HW_FLOW_CONTROL); /* Configure USART */ uart_periph_set_baudrate(&uart3, UART3_BAUD); }
void uart5_init( void ) { uart_periph_init(&uart5); uart5.reg_addr = (void *)UART5; /* init RCC and GPIOs */ rcc_periph_clock_enable(RCC_UART5); #if USE_UART5_TX gpio_setup_pin_af(UART5_GPIO_PORT_TX, UART5_GPIO_TX, UART5_GPIO_AF, TRUE); #endif #if USE_UART5_RX gpio_setup_pin_af(UART5_GPIO_PORT_RX, UART5_GPIO_RX, UART5_GPIO_AF, FALSE); #endif /* Enable USART interrupts in the interrupt controller */ usart_enable_irq(NVIC_UART5_IRQ); /* Configure USART */ uart_periph_set_mode(&uart5, USE_UART5_TX, USE_UART5_RX, FALSE); uart_periph_set_bits_stop_parity(&uart5, UART5_BITS, UART5_STOP, UART5_PARITY); uart_periph_set_baudrate(&uart5, UART5_BAUD); }
void uart1_init( void ) { uart_periph_init(&uart1); uart.dev = UART1_DEV; uart_periph_init_param(&uart1,UART1_BAUD); }
void uart1_init(void) { uart_periph_init(&uart1); strncpy(uart1.dev, UART1_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart1, UART1_BAUD); }
void uart2_init(void) { uart_periph_init(&uart2); strncpy(uart2.dev, UART2_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart2, UART2_BAUD); }
void uart3_init(void) { uart_periph_init(&uart3); strncpy(uart3.dev, UART3_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart3, UART3_BAUD); }
void uart4_init(void) { uart_periph_init(&uart4); strncpy(uart4.dev, UART4_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart4, UART4_BAUD); }
void uart5_init(void) { uart_periph_init(&uart5); strncpy(uart5.dev, UART5_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart5, UART5_BAUD); }
void uart1_init( void ) { uart_periph_init(&uart1); uart.dev = UART1_DEV; uart_periph_set_baudrate(&uart1,UART1_BAUD,FALSE); }
void uart0_init( void ) { uart_periph_init(&uart0); uart.dev = UART0_DEV; uart_periph_set_baudrate(&uart0,UART0_BAUD,FALSE); }
void uart6_init(void) { uart_periph_init(&uart6); strncpy(uart6.dev, UART6_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart6, UART6_BAUD); }
void uart0_init(void) { uart_periph_init(&uart0); strncpy(uart0.dev, UART0_DEV, UART_DEV_NAME_SIZE); uart_periph_set_baudrate(&uart0, UART0_BAUD); }