diff --git a/make/config.mk b/make/config.mk index e661bc9..bc43a5f 100644 --- a/make/config.mk +++ b/make/config.mk @@ -34,6 +34,7 @@ TARGET_nodeflight_DEPENDS = freertos tinyprintf core lib TARGET_nodeflight_SOURCES = \ core/main.c \ lib/strops.c \ + module/rc_rx/fport.c \ module/io/stdout.c TARGET_nodeflight_INCLUDES = . @@ -125,7 +126,8 @@ TARGET_stm32_SOURCES = \ platform/stm32/hwacc/gpio.c \ platform/stm32/hwacc/uart.c \ platform/stm32/hwacc/usb_vcp.c \ - platform/stm32/hwmap/resource_stm32.c + platform/stm32/hwmap/resource_stm32.c \ + platform/stm32/fault_irq.c TARGET_stm32_CFLAGS = \ -DUSE_FULL_LL_DRIVER \ diff --git a/src/core/interface_types.h b/src/core/interface_types.h index c7d37c2..7ee2eaf 100644 --- a/src/core/interface_types.h +++ b/src/core/interface_types.h @@ -32,6 +32,13 @@ struct interface_serial_config_s { uint16_t tx_buf_size; uint16_t rx_buf_size; uint32_t flags; + + void (*rx_done)( + const uint8_t *buf, + uint16_t len, + void *storage); + + void *storage; }; struct interface_serial_s { diff --git a/src/core/main.c b/src/core/main.c index 17cfdf8..26275fe 100644 --- a/src/core/main.c +++ b/src/core/main.c @@ -42,12 +42,13 @@ int main( config_init(); - xTaskCreate(main_task, - "main", - 1024, - NULL, - tskIDLE_PRIORITY, - NULL); + // xTaskCreate(main_task, + // "main", + // 1024, + // NULL, + // tskIDLE_PRIORITY, + // NULL); + (void) main_task; vTaskStartScheduler(); asm ("bkpt 255"); diff --git a/src/module/rc_rx/fport.c b/src/module/rc_rx/fport.c new file mode 100644 index 0000000..feb5270 --- /dev/null +++ b/src/module/rc_rx/fport.c @@ -0,0 +1,127 @@ +/* + * NodeFlight - platform for embedded control systems + * Copyright (C) 2020 Max Sikström + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +#include "core/module.h" +#include "core/interface.h" +#include "core/interface_types.h" +#include "core/config.h" +#include "FreeRTOS.h" +#include "task.h" + +#include "vendor/tinyprintf/tinyprintf.h" + +#include +#include +#include +#include + +typedef struct fport_s fport_t; + +struct fport_s { + interface_header_t *if_ser; + + uint8_t data[64]; + uint16_t len; + + TaskHandle_t task; +}; + +static int fport_init( + const char *tag); + +static void fport_task( + void *storage); + +MODULE_DECL(fport, fport_init); + +static void fport_rx_done( + const uint8_t *buf, + uint16_t len, + void *storage) +{ + fport_t *fport_if = storage; + + memcpy(fport_if->data, buf, len); + fport_if->len = len; + + BaseType_t should_switch = pdFALSE; + xTaskNotifyFromISR(fport_if->task, 0x00000001, eSetBits, &should_switch); + portYIELD_FROM_ISR(should_switch); +} + +int fport_init( + const char *tag) +{ + const char *peripheral_config; + fport_t *fport_if; + + peripheral_config = config_get_peripheral_config(tag); + if (peripheral_config == NULL) { + return -1; + } + + fport_if = pvPortMalloc(sizeof(fport_t)); + if (fport_if == NULL) { + return -1; + } + + xTaskCreate(fport_task, + "fport_proc", + 1024, + fport_if, + 15, + &fport_if->task); + + fport_if->if_ser = interface_create(peripheral_config); + if (fport_if->if_ser == NULL) { + return -1; + } + interface_serial_configure(fport_if->if_ser, &(const interface_serial_config_t) { + .baudrate = 115200, + .tx_buf_size = 16, + .rx_buf_size = 128, + .flags = ( + INTERFACE_SERIAL_HALF_DUPLEX + | INTERFACE_SERIAL_INVERTED_RX + | INTERFACE_SERIAL_INVERTED_TX + ), + .rx_done = fport_rx_done, + .storage = fport_if + }); + + return 0; +} + +void fport_task( + void *storage) +{ + fport_t *fport_if = storage; + int i; + uint32_t notify_value; + + tfp_printf("fport loaded\n"); + + for (;;) { + xTaskNotifyWait(0x00, UINT32_MAX, ¬ify_value, 500 * portTICK_PERIOD_MS); + tfp_printf("fport:"); + for (i = 0; i < fport_if->len; i++) { + tfp_printf(" %02x", fport_if->data[i]); + } + tfp_printf("\n"); + } +} diff --git a/src/platform/stm32/FreeRTOSConfig.h b/src/platform/stm32/FreeRTOSConfig.h index 21b9f30..c36b60c 100644 --- a/src/platform/stm32/FreeRTOSConfig.h +++ b/src/platform/stm32/FreeRTOSConfig.h @@ -77,9 +77,9 @@ #define configTIMER_TASK_STACK_DEPTH configMINIMAL_STACK_SIZE /* Interrupt nesting behaviour configuration. */ -#define configKERNEL_INTERRUPT_PRIORITY 4 -#define configMAX_SYSCALL_INTERRUPT_PRIORITY 3 -#define configMAX_API_CALL_INTERRUPT_PRIORITY 3 +#define configKERNEL_INTERRUPT_PRIORITY (0xFFUL) +#define configMAX_SYSCALL_INTERRUPT_PRIORITY 8 +#define configMAX_API_CALL_INTERRUPT_PRIORITY 8 /* Define to trap errors during development. */ #define configASSERT(x) if ( (x) == 0) asm ("bkpt 255") diff --git a/src/platform/stm32/fault_irq.c b/src/platform/stm32/fault_irq.c new file mode 100644 index 0000000..737bea7 --- /dev/null +++ b/src/platform/stm32/fault_irq.c @@ -0,0 +1,28 @@ +/* + * NodeFlight - platform for embedded control systems + * Copyright (C) 2020 Max Sikström + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +/* + * Don't do anything special, but keeping it separate from Default_Handler will make it easier to identify hardfaults + * from other unimplemented interrupts in GDB backtrace + */ +void HardFault_Handler( + void) +{ + for (;;) { + } +} diff --git a/src/platform/stm32/hwacc/dma.c b/src/platform/stm32/hwacc/dma.c index 7aa3fee..a8a8470 100644 --- a/src/platform/stm32/hwacc/dma.c +++ b/src/platform/stm32/hwacc/dma.c @@ -129,14 +129,8 @@ static void dma_irq_handler( /* Get flags, aligned to first bits */ uint32_t flags = def->flags[0] >> def->flag_bit; - /* Clear all flags, always */ - def->flags[2] = ( - DMA_LIFCR_CFEIF0 - | DMA_LIFCR_CDMEIF0 - | DMA_LIFCR_CTEIF0 - | DMA_LIFCR_CHTIF0 - | DMA_LIFCR_CTCIF0 - ) << def->flag_bit; + /* Clear the flags identified. Any missed flags will be taken next IRQ */ + def->flags[2] = flags << def->flag_bit; if ((flags & DMA_LISR_FEIF0) && state->cb_fifo_error != NULL) { state->cb_fifo_error(def, state->storage); diff --git a/src/platform/stm32/hwacc/uart.c b/src/platform/stm32/hwacc/uart.c index 6989721..26214e3 100644 --- a/src/platform/stm32/hwacc/uart.c +++ b/src/platform/stm32/hwacc/uart.c @@ -28,17 +28,30 @@ #include "FreeRTOS.h" +#include "vendor/tinyprintf/tinyprintf.h" + #include #include -typedef struct uart_interface_s { +#define UART_TX_DMA_IRQ_PRIORITY 11 +#define UART_RX_CHAR_IRQ_PRIORITY 10 + +typedef struct uart_interface_s uart_interface_t; + +struct uart_interface_s { interface_serial_t header; - USART_TypeDef *reg; + uart_def_t def; /* Keep a copy for quick access. Just a few bytes */ + interface_serial_config_t config; const dma_stream_def_t *tx_dma; uint8_t *tx_buf; uint16_t tx_buf_size; -} uart_interface_t; + + const dma_stream_def_t *rx_dma; + uint8_t *rx_buf; + uint16_t rx_buf_pos; + uint16_t rx_buf_size; +}; static int uart_init( interface_header_t *iface, @@ -56,7 +69,16 @@ static int uart_tx_write( static void uart_tx_wait_done( interface_serial_t *iface); -PERIPHERAL_TYPE_DECL(uart, PERIPHERAL_SERIAL, UART_NUM_ARGS, uart_init, sizeof(uart_interface_t)); +static uart_interface_t *uart_ifs[UART_MAX_COUNT] = { + 0 +}; + +PERIPHERAL_TYPE_DECL( + uart, + PERIPHERAL_SERIAL, + UART_NUM_ARGS, + uart_init, + sizeof(uart_interface_t)); static void uart_tx_tc_callback( const dma_stream_def_t *def, @@ -75,12 +97,14 @@ int uart_init( if_uart->header.tx_write = uart_tx_write; if_uart->header.tx_wait_done = uart_tx_wait_done; - if_uart->reg = if_uart->header.header.peripheral->storage; + if_uart->def = *((const uart_def_t *) if_uart->header.header.peripheral->storage); if_uart->tx_dma = NULL; if_uart->tx_buf = NULL; if_uart->tx_buf_size = 0; + uart_ifs[if_uart->def.id] = if_uart; + return 0; } @@ -90,11 +114,13 @@ int uart_configure( { uart_interface_t *if_uart = (uart_interface_t *) iface; interface_resource_t *rscs = if_uart->header.header.rscs; + uint32_t irqn = if_uart->def.IRQn; + if_uart->config = *config; bool tx_en = rscs[UART_ARG_PIN_TX].decl->ref != GPIO_ID_NONE && rscs[UART_ARG_DMA_TX].decl->ref != DMA_ID_NONE; bool rx_en = rscs[UART_ARG_PIN_RX].decl->ref != GPIO_ID_NONE && rscs[UART_ARG_DMA_RX].decl->ref != DMA_ID_NONE; - LL_USART_Init(if_uart->reg, &(LL_USART_InitTypeDef) { + LL_USART_Init(if_uart->def.reg, &(LL_USART_InitTypeDef) { .BaudRate = config->baudrate, .DataWidth = LL_USART_DATAWIDTH_8B, .StopBits = LL_USART_STOPBITS_1, @@ -108,6 +134,7 @@ int uart_configure( .HardwareFlowControl = LL_USART_HWCONTROL_NONE, .OverSampling = LL_USART_OVERSAMPLING_16 }); + LL_USART_ConfigAsyncMode(if_uart->def.reg); /* TX */ if (tx_en) { @@ -122,14 +149,14 @@ int uart_configure( .Pull = LL_GPIO_PULL_NO, .Alternate = rscs[UART_ARG_PIN_TX].inst->attr }); - LL_USART_SetTXPinLevel(if_uart->reg, + LL_USART_SetTXPinLevel(if_uart->def.reg, (config->flags & INTERFACE_SERIAL_INVERTED_TX) ? LL_USART_TXPIN_LEVEL_INVERTED : LL_USART_TXPIN_LEVEL_STANDARD ); LL_DMA_Init(if_uart->tx_dma->reg, if_uart->tx_dma->stream, &(LL_DMA_InitTypeDef) { - .PeriphOrM2MSrcAddress = LL_USART_DMA_GetRegAddr(if_uart->reg, LL_USART_DMA_REG_DATA_TRANSMIT), + .PeriphOrM2MSrcAddress = LL_USART_DMA_GetRegAddr(if_uart->def.reg, LL_USART_DMA_REG_DATA_TRANSMIT), .MemoryOrM2MDstAddress = (uint32_t) if_uart->tx_buf, .Direction = LL_DMA_DIRECTION_MEMORY_TO_PERIPH, .Mode = LL_DMA_MODE_NORMAL, // LL_DMA_MODE_CIRCULAR, @@ -140,19 +167,24 @@ int uart_configure( .NbData = 0, .Channel = rscs[UART_ARG_DMA_TX].inst->attr << DMA_SxCR_CHSEL_Pos, .Priority = LL_DMA_PRIORITY_MEDIUM, - .FIFOMode = LL_DMA_FIFOMODE_DISABLE, + .FIFOMode = LL_DMA_FIFOMODE_ENABLE, .FIFOThreshold = LL_DMA_FIFOTHRESHOLD_1_2, .MemBurst = LL_DMA_MBURST_SINGLE, .PeriphBurst = LL_DMA_PBURST_SINGLE }); - dma_enable_irq(if_uart->tx_dma, 5, if_uart); + dma_enable_irq(if_uart->tx_dma, UART_TX_DMA_IRQ_PRIORITY, if_uart); dma_set_transfer_complete_cb(if_uart->tx_dma, uart_tx_tc_callback); - LL_USART_EnableDMAReq_TX(if_uart->reg); + LL_USART_EnableDMAReq_TX(if_uart->def.reg); } /* RX */ if (rx_en) { + if_uart->rx_dma = dma_get(rscs[UART_ARG_DMA_RX].decl->ref); + if_uart->rx_buf = pvPortMalloc(config->rx_buf_size); + if_uart->rx_buf_pos = 0; + if_uart->rx_buf_size = config->rx_buf_size; + gpio_config_by_id(rscs[UART_ARG_PIN_RX].decl->ref, &(LL_GPIO_InitTypeDef) { .Mode = LL_GPIO_MODE_ALTERNATE, .Speed = LL_GPIO_SPEED_FREQ_VERY_HIGH, @@ -160,16 +192,20 @@ int uart_configure( .Pull = LL_GPIO_PULL_NO, .Alternate = rscs[UART_ARG_PIN_RX].inst->attr }); - - LL_USART_SetRXPinLevel(if_uart->reg, + LL_USART_SetRXPinLevel(if_uart->def.reg, (config->flags & INTERFACE_SERIAL_INVERTED_RX) ? LL_USART_RXPIN_LEVEL_INVERTED : LL_USART_RXPIN_LEVEL_STANDARD ); + NVIC_ClearPendingIRQ(irqn); + NVIC_EnableIRQ(irqn); + NVIC_SetPriority(irqn, UART_RX_CHAR_IRQ_PRIORITY); + LL_USART_EnableIT_IDLE(if_uart->def.reg); + LL_USART_EnableIT_RXNE(if_uart->def.reg); } - LL_USART_Enable(if_uart->reg); + LL_USART_Enable(if_uart->def.reg); return 0; } @@ -197,7 +233,7 @@ int uart_tx_write( memcpy(if_uart->tx_buf, ((const uint8_t *) buf) + i, cur_bytes); LL_DMA_SetDataLength(if_uart->tx_dma->reg, if_uart->tx_dma->stream, cur_bytes); LL_DMA_EnableStream(if_uart->tx_dma->reg, if_uart->tx_dma->stream); - LL_USART_ClearFlag_TC(if_uart->reg); + LL_USART_ClearFlag_TC(if_uart->def.reg); } return bytes; @@ -207,6 +243,34 @@ void uart_tx_wait_done( interface_serial_t *iface) { uart_interface_t *if_uart = (uart_interface_t *) iface; - while (!LL_USART_IsActiveFlag_TC(if_uart->reg)) { + while (!LL_USART_IsActiveFlag_TC(if_uart->def.reg)) { } } + +static void uart_irqhandler( + uart_interface_t *if_uart) +{ + uint32_t isr = if_uart->def.reg->ISR; + if_uart->def.reg->ICR = isr; + if (isr & USART_ISR_RXNE) { + /* Can't be full, since it would be cleared upon previous byte then... */ + if_uart->rx_buf[if_uart->rx_buf_pos++] = LL_USART_ReceiveData8(if_uart->def.reg); + } + if (isr & USART_ISR_IDLE || if_uart->rx_buf_pos == if_uart->rx_buf_size) { + if (if_uart->config.rx_done != NULL) { + if_uart->config.rx_done(if_uart->rx_buf, if_uart->rx_buf_pos, if_uart->config.storage); + } + if_uart->rx_buf_pos = 0; + } +} + +/* *INDENT-OFF* */ +void USART1_IRQHandler(void) { uart_irqhandler(uart_ifs[0]); } +void USART2_IRQHandler(void) { uart_irqhandler(uart_ifs[1]); } +void USART3_IRQHandler(void) { uart_irqhandler(uart_ifs[2]); } +void UART4_IRQHandler(void) { uart_irqhandler(uart_ifs[3]); } +void UART5_IRQHandler(void) { uart_irqhandler(uart_ifs[4]); } +void USART6_IRQHandler(void) { uart_irqhandler(uart_ifs[5]); } +void UART7_IRQHandler(void) { uart_irqhandler(uart_ifs[6]); } +void UART8_IRQHandler(void) { uart_irqhandler(uart_ifs[7]); } +/* *INDENT-ON* */ diff --git a/src/platform/stm32/hwacc/uart.h b/src/platform/stm32/hwacc/uart.h index 4b03970..f63d1ed 100644 --- a/src/platform/stm32/hwacc/uart.h +++ b/src/platform/stm32/hwacc/uart.h @@ -24,6 +24,21 @@ PERIPHERAL_TYPE_EXTERN(uart); +typedef struct uart_def_s uart_def_t; + +struct uart_def_s { + USART_TypeDef *reg; + uint8_t id; + uint32_t IRQn; +}; + +#define UART_DEF(_UART, _ID) \ + (void *) &(const uart_def_t) { \ + .reg = _UART, \ + .id = _ID, \ + .IRQn = _UART ## _IRQn \ + } + enum { UART_ARG_PIN_TX = 0, UART_ARG_PIN_RX, diff --git a/src/platform/stm32f7xx/hwmap_stm32f722.c b/src/platform/stm32f7xx/hwmap_stm32f722.c index 4836cbc..a6a0b90 100644 --- a/src/platform/stm32f7xx/hwmap_stm32f722.c +++ b/src/platform/stm32f7xx/hwmap_stm32f722.c @@ -26,7 +26,7 @@ #include -PERIPHERAL_INSTANCE_DECL(uart, uart1, USART1, +PERIPHERAL_INSTANCE_DECL(uart, uart1, UART_DEF(USART1, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -44,7 +44,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart1, USART1, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_2_5, 4) ); -PERIPHERAL_INSTANCE_DECL(uart, uart2, USART2, +PERIPHERAL_INSTANCE_DECL(uart, uart2, UART_DEF(USART2, 1), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -61,7 +61,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart2, USART2, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_1_5, 4) ); -PERIPHERAL_INSTANCE_DECL(uart, uart3, USART3, +PERIPHERAL_INSTANCE_DECL(uart, uart3, UART_DEF(USART3, 2), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -81,7 +81,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart3, USART3, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_1_1, 4) ); -PERIPHERAL_INSTANCE_DECL(uart, uart4, UART4, +PERIPHERAL_INSTANCE_DECL(uart, uart4, UART_DEF(UART4, 3), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -101,7 +101,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart4, UART4, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_1_2, 4) ); -PERIPHERAL_INSTANCE_DECL(uart, uart5, UART5, +PERIPHERAL_INSTANCE_DECL(uart, uart5, UART_DEF(UART5, 4), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -116,7 +116,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart5, UART5, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_1_0, 4) ); -PERIPHERAL_INSTANCE_DECL(uart, uart6, USART6, +PERIPHERAL_INSTANCE_DECL(uart, uart6, UART_DEF(USART6, 5), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -135,7 +135,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart6, USART6, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_2_2, 5) ); -PERIPHERAL_INSTANCE_DECL(uart, uart7, UART7, +PERIPHERAL_INSTANCE_DECL(uart, uart7, UART_DEF(UART7, 6), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), @@ -152,7 +152,7 @@ PERIPHERAL_INSTANCE_DECL(uart, uart7, UART7, PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_RX, dma_1_3, 5) ); -PERIPHERAL_INSTANCE_DECL(uart, uart8, UART8, +PERIPHERAL_INSTANCE_DECL(uart, uart8, UART_DEF(UART8, 7), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_TX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_PIN_RX, pin_none, 0), PERIPHERAL_INSTANCE_RESOURCE(UART_ARG_DMA_TX, dma_none, 0), diff --git a/src/platform/stm32f7xx/stm32.h b/src/platform/stm32f7xx/stm32.h index 5ff85ce..822f41d 100644 --- a/src/platform/stm32f7xx/stm32.h +++ b/src/platform/stm32f7xx/stm32.h @@ -27,3 +27,6 @@ #include "stm32f7xx_ll_gpio.h" #include "stm32f7xx_ll_usart.h" #include "stm32f7xx_ll_utils.h" + +/* Maximum number of uarts available, sets limit of allocated arrays for storage */ +#define UART_MAX_COUNT 8 diff --git a/test_l1conf.txt b/test_l1conf.txt index a096a60..c9b6f04 100644 --- a/test_l1conf.txt +++ b/test_l1conf.txt @@ -1,2 +1,4 @@ -per uart_st uart3 pin_d08 pin_d09 dma_1_3 dma_1_1 +per uart_st uart3 pin_d08 pin_none dma_1_3 dma_none +per uart_fport uart2 pin_none pin_d06 dma_none dma_1_5 mod stdout uart_st +mod fport uart_fport diff --git a/uncrustify.cfg b/uncrustify.cfg index a9a4892..552ea15 100644 --- a/uncrustify.cfg +++ b/uncrustify.cfg @@ -93,15 +93,17 @@ mod_move_case_break=false mod_remove_empty_return=false cmt_indent_multi=false cmt_c_group=false -cmt_c_nl_start=false -cmt_c_nl_end=false +cmt_c_nl_start=true +cmt_c_nl_end=true cmt_cpp_group=false -cmt_cpp_nl_start=false -cmt_cpp_nl_end=false +cmt_cpp_nl_start=true +cmt_cpp_nl_end=true cmt_cpp_to_c=false -cmt_star_cont=false +cmt_star_cont=true cmt_multi_check_last=true cmt_insert_before_preproc=false +cmt_reflow_mode=2 +cmt_width=120 pp_indent_at_level=false pp_region_indent_code=false pp_if_indent_code=false