From 90c2c73e40f6df7d5ed985b0db26ab4cc5d67673 Mon Sep 17 00:00:00 2001 From: martin chaparro Date: Tue, 9 Nov 2021 17:44:26 -0500 Subject: [PATCH] vport stm32 --- STM32/STM32CUBE/USB_VIRTUAL_PORT/src/main.c | 14 ++++++++++++-- STM32/STM32CUBE/USB_VIRTUAL_PORT/test/README | 11 +++++++++++ 2 files changed, 23 insertions(+), 2 deletions(-) create mode 100644 STM32/STM32CUBE/USB_VIRTUAL_PORT/test/README diff --git a/STM32/STM32CUBE/USB_VIRTUAL_PORT/src/main.c b/STM32/STM32CUBE/USB_VIRTUAL_PORT/src/main.c index e4401cb..12f9ba4 100644 --- a/STM32/STM32CUBE/USB_VIRTUAL_PORT/src/main.c +++ b/STM32/STM32CUBE/USB_VIRTUAL_PORT/src/main.c @@ -2,10 +2,15 @@ #include "usb_device.h" #include #include "usbd_cdc_if.h" +#include +#include void SystemClock_Config(void); static void MX_GPIO_Init(void); uint8_t *data = "Hello World from USB CDC\n"; +char saludo[]="Hola mundo"; uint8_t buffer[64]; +char * buffer2[10]; +int contador = 0; uint8_t data_new =0; int main(void) @@ -19,10 +24,15 @@ int main(void) while (1) { if(data_new == 1){ - CDC_Transmit_FS(buffer, 64); + CDC_Transmit_FS(buffer, strlen((char *)buffer)); data_new = 0; } - HAL_Delay (100); + itoa(contador,buffer2,10); + contador = contador +2; + CDC_Transmit_FS(buffer2, strlen((char *)buffer2)); + HAL_Delay(100); + CDC_Transmit_FS("\n",1); + HAL_Delay (900); } } diff --git a/STM32/STM32CUBE/USB_VIRTUAL_PORT/test/README b/STM32/STM32CUBE/USB_VIRTUAL_PORT/test/README new file mode 100644 index 0000000..b94d089 --- /dev/null +++ b/STM32/STM32CUBE/USB_VIRTUAL_PORT/test/README @@ -0,0 +1,11 @@ + +This directory is intended for PlatformIO Unit Testing and project tests. + +Unit Testing is a software testing method by which individual units of +source code, sets of one or more MCU program modules together with associated +control data, usage procedures, and operating procedures, are tested to +determine whether they are fit for use. Unit testing finds problems early +in the development cycle. + +More information about PlatformIO Unit Testing: +- https://docs.platformio.org/page/plus/unit-testing.html