Compare commits
No commits in common. "cbaaace76b86ee9415017390801a191627de8cf0" and "7bbdfc0bf498de60b59b734a98a042dc4731200a" have entirely different histories.
cbaaace76b
...
7bbdfc0bf4
6
.gitmodules
vendored
6
.gitmodules
vendored
@ -1,6 +0,0 @@
|
|||||||
[submodule "main/utilities/imp_util_ring_queue"]
|
|
||||||
path = main/utilities/imp_util_ring_queue
|
|
||||||
url = ssh://git@192.168.124.23:222/Utilities/imp_util_ring_queue.git
|
|
||||||
[submodule "main/utilities/imp_types"]
|
|
||||||
path = main/utilities/imp_types
|
|
||||||
url = ssh://git@192.168.124.23:222/Utilities/imp_types.git
|
|
||||||
@ -1,51 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file main_app.c
|
|
||||||
* @author Alvin Young (impressionyang@outlook.com)
|
|
||||||
* @brief
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2024-11-25
|
|
||||||
*
|
|
||||||
* _ _
|
|
||||||
* (_)_ _ ___ _______ ___ ___ (_)__ ___ __ _____ ____ ___ _
|
|
||||||
* / / ' \/ _ \/ __/ -_|_-<(_-</ / _ \/ _ \/ // / _ `/ _ \/ _ `/
|
|
||||||
* /_/_/_/_/ .__/_/ \__/___/___/_/\___/_//_/\_, /\_,_/_//_/\_, /
|
|
||||||
* /_/ /___/ /___/
|
|
||||||
* @copyright Copyright (c) 2024 impressionyang
|
|
||||||
*
|
|
||||||
* @par 修改日志:
|
|
||||||
* <table>
|
|
||||||
* <tr><th>Date <th>Version <th>Author <th>Description
|
|
||||||
* <tr><td>2024-11-25 <td>v1.0 <td>Alvin Young <td>首次创建
|
|
||||||
* </table>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
#include "main_app.h"
|
|
||||||
#include "freertos/FreeRTOS.h"
|
|
||||||
#include "freertos/task.h"
|
|
||||||
#include "esp_system.h"
|
|
||||||
#include "esp_chip_info.h"
|
|
||||||
#include "sdkconfig.h"
|
|
||||||
#include <inttypes.h>
|
|
||||||
|
|
||||||
#include "main_common.h"
|
|
||||||
|
|
||||||
/* define --------------------------------------------------------------------*/
|
|
||||||
/* typedef -------------------------------------------------------------------*/
|
|
||||||
/* variables -----------------------------------------------------------------*/
|
|
||||||
/* Private function(only *.c) -----------------------------------------------*/
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
|
|
||||||
uint8_t imp_main_app_task()
|
|
||||||
{
|
|
||||||
int i = 0;
|
|
||||||
while (1) {
|
|
||||||
cdc_printf("hello %d\r\n", i++);
|
|
||||||
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
/*
|
|
||||||
* EOF
|
|
||||||
*/
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file main_app.h
|
|
||||||
* @author Alvin Young (impressionyang@outlook.com)
|
|
||||||
* @brief
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2024-11-25
|
|
||||||
*
|
|
||||||
* _ _
|
|
||||||
* (_)_ _ ___ _______ ___ ___ (_)__ ___ __ _____ ____ ___ _
|
|
||||||
* / / ' \/ _ \/ __/ -_|_-<(_-</ / _ \/ _ \/ // / _ `/ _ \/ _ `/
|
|
||||||
* /_/_/_/_/ .__/_/ \__/___/___/_/\___/_//_/\_, /\_,_/_//_/\_, /
|
|
||||||
* /_/ /___/ /___/
|
|
||||||
* @copyright Copyright (c) 2024 impressionyang
|
|
||||||
*
|
|
||||||
* @par 修改日志:
|
|
||||||
* <table>
|
|
||||||
* <tr><th>Date <th>Version <th>Author <th>Description
|
|
||||||
* <tr><td>2024-11-25 <td>v1.0 <td>Alvin Young <td>首次创建
|
|
||||||
* </table>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __MAIN_APP_H__
|
|
||||||
#define __MAIN_APP_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
|
|
||||||
#include <stdint.h>
|
|
||||||
|
|
||||||
/* define --------------------------------------------------------------------*/
|
|
||||||
/* typedef -------------------------------------------------------------------*/
|
|
||||||
/* variables -----------------------------------------------------------------*/
|
|
||||||
/* Private function(only *.c) -----------------------------------------------*/
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
|
|
||||||
uint8_t imp_main_app_task();
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif //__MAIN_APP_H__
|
|
||||||
/*
|
|
||||||
* EOF
|
|
||||||
*/
|
|
||||||
@ -8,17 +8,13 @@ idf_component_register(
|
|||||||
"utilities/usb_cherry/CherryUSB/class/cdc/"
|
"utilities/usb_cherry/CherryUSB/class/cdc/"
|
||||||
"utilities/usb_cherry/CherryUSB/class/msc/"
|
"utilities/usb_cherry/CherryUSB/class/msc/"
|
||||||
"utilities/usb_cherry/CherryUSB/core/"
|
"utilities/usb_cherry/CherryUSB/core/"
|
||||||
"utilities/usb_cherry/CherryUSB/port/dwc2/"
|
"utilities/usb_cherry/CherryUSB/port/dwc2"
|
||||||
"utilities/imp_util_ring_queue/"
|
|
||||||
"utilities/imp_types/"
|
|
||||||
"APP/main_app/"
|
|
||||||
|
|
||||||
EXCLUDE_SRCS
|
EXCLUDE_SRCS
|
||||||
"utilities/usb_cherry/CherryUSB/class/cdc/usbh_cdc_acm.c"
|
"utilities/usb_cherry/CherryUSB/class/cdc/usbh_cdc_acm.c"
|
||||||
"utilities/usb_cherry/CherryUSB/class/msc/usbh_msc.c"
|
"utilities/usb_cherry/CherryUSB/class/msc/usbh_msc.c"
|
||||||
"utilities/usb_cherry/CherryUSB/core/usbh_core.c"
|
"utilities/usb_cherry/CherryUSB/core/usbh_core.c"
|
||||||
"utilities/usb_cherry/CherryUSB/port/dwc2/usb_hc_dwc2.c"
|
"utilities/usb_cherry/CherryUSB/port/dwc2/usb_hc_dwc2.c"
|
||||||
"utilities/imp_util_ring_queue/ring_queue_test.c"
|
|
||||||
|
|
||||||
INCLUDE_DIRS
|
INCLUDE_DIRS
|
||||||
"."
|
"."
|
||||||
@ -31,9 +27,6 @@ idf_component_register(
|
|||||||
"utilities/usb_cherry/CherryUSB/common"
|
"utilities/usb_cherry/CherryUSB/common"
|
||||||
"utilities/usb_cherry/CherryUSB/core"
|
"utilities/usb_cherry/CherryUSB/core"
|
||||||
"utilities/usb_cherry/CherryUSB/port/dwc2"
|
"utilities/usb_cherry/CherryUSB/port/dwc2"
|
||||||
"utilities/imp_util_ring_queue/"
|
|
||||||
"APP/main_app/"
|
|
||||||
"utilities/imp_types/"
|
|
||||||
|
|
||||||
LDFRAGMENTS
|
LDFRAGMENTS
|
||||||
"utilities/letter_shell/port/esp-idf/shell.lf"
|
"utilities/letter_shell/port/esp-idf/shell.lf"
|
||||||
|
|||||||
22
main/main.c
22
main/main.c
@ -18,8 +18,6 @@
|
|||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include "shell_port.h"
|
#include "shell_port.h"
|
||||||
#include "main_app.h"
|
|
||||||
#include "main_common.h"
|
|
||||||
|
|
||||||
static void _init_esp()
|
static void _init_esp()
|
||||||
{
|
{
|
||||||
@ -33,14 +31,18 @@ static void _init_esp()
|
|||||||
ESP_ERROR_CHECK(ret);
|
ESP_ERROR_CHECK(ret);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern void cdc_acm_msc_init();
|
||||||
|
extern int cdc_printf(const char* fmt, ...);
|
||||||
|
|
||||||
void app_main(void)
|
void app_main(void)
|
||||||
{
|
{
|
||||||
_init_esp();
|
_init_esp();
|
||||||
vTaskDelay(10);
|
vTaskDelay(10);
|
||||||
cdc_acm_msc_init();
|
|
||||||
vTaskDelay(10);
|
|
||||||
userShellInit();
|
userShellInit();
|
||||||
cdc_printf("Hello world!\n");
|
vTaskDelay(10);
|
||||||
|
|
||||||
|
printf("Hello world!\n");
|
||||||
|
cdc_acm_msc_init();
|
||||||
|
|
||||||
/* Print chip information */
|
/* Print chip information */
|
||||||
esp_chip_info_t chip_info;
|
esp_chip_info_t chip_info;
|
||||||
@ -72,11 +74,13 @@ void app_main(void)
|
|||||||
|
|
||||||
// for (int i = 10; i >= 0; i--) {
|
// for (int i = 10; i >= 0; i--) {
|
||||||
// printf("Restarting in %d seconds...\n", i);
|
// printf("Restarting in %d seconds...\n", i);
|
||||||
// vTaskDelay(1000 / portTICK_PERIOD_MS);
|
// vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
// }
|
// }
|
||||||
cdc_printf("start run app:\r\n");
|
int i = 0;
|
||||||
imp_main_app_task();
|
while (1) {
|
||||||
|
cdc_printf("hello %d", i++);
|
||||||
|
vTaskDelay(1000 / portTICK_PERIOD_MS);
|
||||||
|
}
|
||||||
printf("Restarting now.\n");
|
printf("Restarting now.\n");
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
esp_restart();
|
esp_restart();
|
||||||
|
|||||||
@ -1,49 +0,0 @@
|
|||||||
/**
|
|
||||||
* @file main_common.h
|
|
||||||
* @author Alvin Young (impressionyang@outlook.com)
|
|
||||||
* @brief
|
|
||||||
* @version 0.1
|
|
||||||
* @date 2024-11-25
|
|
||||||
*
|
|
||||||
* _ _
|
|
||||||
* (_)_ _ ___ _______ ___ ___ (_)__ ___ __ _____ ____ ___ _
|
|
||||||
* / / ' \/ _ \/ __/ -_|_-<(_-</ / _ \/ _ \/ // / _ `/ _ \/ _ `/
|
|
||||||
* /_/_/_/_/ .__/_/ \__/___/___/_/\___/_//_/\_, /\_,_/_//_/\_, /
|
|
||||||
* /_/ /___/ /___/
|
|
||||||
* @copyright Copyright (c) 2024 impressionyang
|
|
||||||
*
|
|
||||||
* @par 修改日志:
|
|
||||||
* <table>
|
|
||||||
* <tr><th>Date <th>Version <th>Author <th>Description
|
|
||||||
* <tr><td>2024-11-25 <td>v1.0 <td>Alvin Young <td>首次创建
|
|
||||||
* </table>
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
/* Define to prevent recursive inclusion -------------------------------------*/
|
|
||||||
#ifndef __MAIN_COMMON_H__
|
|
||||||
#define __MAIN_COMMON_H__
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Includes ------------------------------------------------------------------*/
|
|
||||||
/* define --------------------------------------------------------------------*/
|
|
||||||
/* typedef -------------------------------------------------------------------*/
|
|
||||||
/* variables -----------------------------------------------------------------*/
|
|
||||||
/* Private function(only *.c) -----------------------------------------------*/
|
|
||||||
/* Exported functions --------------------------------------------------------*/
|
|
||||||
|
|
||||||
extern void cdc_acm_msc_init();
|
|
||||||
extern int cdc_printf(const char* fmt, ...);
|
|
||||||
extern signed short cdc_usb_read_bytes(char* data, unsigned short len);
|
|
||||||
extern signed short cdc_usb_writ_bytes(char* data, unsigned short len);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif //__MAIN_COMMON_H__
|
|
||||||
|
|
||||||
/*
|
|
||||||
* EOF
|
|
||||||
*/
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Subproject commit 6cf82b2d2c8f3c944dd93f079f9cc7f0eef6018c
|
|
||||||
@ -1 +0,0 @@
|
|||||||
Subproject commit 61a122b22be15ef94e2d114a819aee8fb7f39e0d
|
|
||||||
@ -124,7 +124,7 @@
|
|||||||
* @brief shell格式化输出的缓冲大小
|
* @brief shell格式化输出的缓冲大小
|
||||||
* 为0时不使用shell格式化输出
|
* 为0时不使用shell格式化输出
|
||||||
*/
|
*/
|
||||||
#define SHELL_PRINT_BUFFER 64
|
#define SHELL_PRINT_BUFFER 128
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief shell格式化输入的缓冲大小
|
* @brief shell格式化输入的缓冲大小
|
||||||
@ -171,13 +171,13 @@
|
|||||||
/**
|
/**
|
||||||
* @brief shell默认用户
|
* @brief shell默认用户
|
||||||
*/
|
*/
|
||||||
#define SHELL_DEFAULT_USER "alvin"
|
#define SHELL_DEFAULT_USER "letter"
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief shell默认用户密码
|
* @brief shell默认用户密码
|
||||||
* 若默认用户不需要密码,设为""
|
* 若默认用户不需要密码,设为""
|
||||||
*/
|
*/
|
||||||
#define SHELL_DEFAULT_USER_PASSWORD "passwd"
|
#define SHELL_DEFAULT_USER_PASSWORD ""
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief shell自动锁定超时
|
* @brief shell自动锁定超时
|
||||||
|
|||||||
@ -12,7 +12,6 @@
|
|||||||
#include "shell.h"
|
#include "shell.h"
|
||||||
#include "freertos/FreeRTOS.h"
|
#include "freertos/FreeRTOS.h"
|
||||||
#include "driver/uart.h"
|
#include "driver/uart.h"
|
||||||
#include "main_common.h"
|
|
||||||
|
|
||||||
|
|
||||||
#define SHELL_UART UART_NUM_0
|
#define SHELL_UART UART_NUM_0
|
||||||
@ -30,13 +29,7 @@ char shellBuffer[512];
|
|||||||
*/
|
*/
|
||||||
unsigned short userShellWrite(char *data, unsigned short len)
|
unsigned short userShellWrite(char *data, unsigned short len)
|
||||||
{
|
{
|
||||||
// return uart_write_bytes(SHELL_UART, (const char *)data, len);
|
return uart_write_bytes(SHELL_UART, (const char *)data, len);
|
||||||
// return cdc_usb_writ_bytes(data, len);
|
|
||||||
unsigned short ret = 0;
|
|
||||||
ret = cdc_usb_writ_bytes(data, len);
|
|
||||||
// cdc_printf("write need : %d, get %d\r\n", len, ret);
|
|
||||||
// cdc_printf("%s", data);
|
|
||||||
return len;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -50,11 +43,7 @@ unsigned short userShellWrite(char *data, unsigned short len)
|
|||||||
*/
|
*/
|
||||||
signed char userShellRead(char *data, unsigned short len)
|
signed char userShellRead(char *data, unsigned short len)
|
||||||
{
|
{
|
||||||
// return uart_read_bytes(SHELL_UART, (uint8_t *)data, len, portMAX_DELAY);
|
return uart_read_bytes(SHELL_UART, (uint8_t *)data, len, portMAX_DELAY);
|
||||||
signed char ret = 0;
|
|
||||||
ret = cdc_usb_read_bytes(data, len);
|
|
||||||
// cdc_printf("read need : %d, get %d\r\n", len, ret);
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
#include "usbd_msc.h"
|
#include "usbd_msc.h"
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
|
|
||||||
#include "imp_util_ring_queue.h"
|
|
||||||
|
|
||||||
/*!< endpoint address */
|
/*!< endpoint address */
|
||||||
#define CDC_IN_EP 0x81
|
#define CDC_IN_EP 0x81
|
||||||
#define CDC_OUT_EP 0x02
|
#define CDC_OUT_EP 0x02
|
||||||
@ -20,14 +18,14 @@
|
|||||||
#define USBD_LANGID_STRING 1033
|
#define USBD_LANGID_STRING 1033
|
||||||
|
|
||||||
/*!< config descriptor size */
|
/*!< config descriptor size */
|
||||||
#define USB_CONFIG_SIZE (9 + CDC_ACM_DESCRIPTOR_LEN )// + MSC_DESCRIPTOR_LEN)
|
#define USB_CONFIG_SIZE (9 + CDC_ACM_DESCRIPTOR_LEN + MSC_DESCRIPTOR_LEN)
|
||||||
|
|
||||||
/*!< global descriptor */
|
/*!< global descriptor */
|
||||||
static const uint8_t cdc_msc_descriptor[] = {
|
static const uint8_t cdc_msc_descriptor[] = {
|
||||||
USB_DEVICE_DESCRIPTOR_INIT(USB_2_0, 0xEF, 0x02, 0x01, USBD_VID, USBD_PID, 0x0100, 0x01),
|
USB_DEVICE_DESCRIPTOR_INIT(USB_2_0, 0xEF, 0x02, 0x01, USBD_VID, USBD_PID, 0x0100, 0x01),
|
||||||
USB_CONFIG_DESCRIPTOR_INIT(USB_CONFIG_SIZE, 0x02, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER),
|
USB_CONFIG_DESCRIPTOR_INIT(USB_CONFIG_SIZE, 0x03, 0x01, USB_CONFIG_BUS_POWERED, USBD_MAX_POWER),
|
||||||
CDC_ACM_DESCRIPTOR_INIT(0x00, CDC_INT_EP, CDC_OUT_EP, CDC_IN_EP, 0x02),
|
CDC_ACM_DESCRIPTOR_INIT(0x00, CDC_INT_EP, CDC_OUT_EP, CDC_IN_EP, 0x02),
|
||||||
// MSC_DESCRIPTOR_INIT(0x02, MSC_OUT_EP, MSC_IN_EP, 0x00),
|
MSC_DESCRIPTOR_INIT(0x02, MSC_OUT_EP, MSC_IN_EP, 0x00),
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
/// string0 descriptor
|
/// string0 descriptor
|
||||||
///////////////////////////////////////
|
///////////////////////////////////////
|
||||||
@ -109,27 +107,18 @@ usbd_interface_t cdc_cmd_intf;
|
|||||||
/*!< interface two */
|
/*!< interface two */
|
||||||
usbd_interface_t cdc_data_intf;
|
usbd_interface_t cdc_data_intf;
|
||||||
|
|
||||||
imp_util_ring_queue_t ring_q_cdc_recv = {0};
|
|
||||||
unsigned char ring_q_cdc_recv_swap_data[1024 + 1] = { 0 };
|
|
||||||
|
|
||||||
/* function ------------------------------------------------------------------*/
|
/* function ------------------------------------------------------------------*/
|
||||||
int cdc_printf(const char *fmt, ...);
|
|
||||||
|
|
||||||
void usbd_cdc_acm_out(uint8_t ep)
|
void usbd_cdc_acm_out(uint8_t ep)
|
||||||
{
|
{
|
||||||
uint8_t data[64];
|
uint8_t data[64];
|
||||||
uint32_t read_byte;
|
uint32_t read_byte;
|
||||||
|
|
||||||
usbd_ep_read(ep, data, 64, &read_byte);
|
usbd_ep_read(ep, data, 64, &read_byte);
|
||||||
imp_util_ring_queue_write(&ring_q_cdc_recv, data, read_byte);
|
for (uint8_t i = 0; i < read_byte; i++) {
|
||||||
// for (uint8_t i = 0; i < read_byte; i++) {
|
USB_LOG_RAW("%02x ", data[i]);
|
||||||
// USB_LOG_RAW("%02x ", data[i]);
|
}
|
||||||
// cdc_printf("%02x ", data[i]);
|
USB_LOG_RAW("\r\n");
|
||||||
// }
|
USB_LOG_RAW("read len:%d\r\n", read_byte);
|
||||||
// USB_LOG_RAW("\r\n");
|
|
||||||
// USB_LOG_RAW("read len:%d\r\n", read_byte);
|
|
||||||
// cdc_printf("\r\n");
|
|
||||||
// cdc_printf("read len:%d\r\n", read_byte);
|
|
||||||
usbd_ep_read(ep, NULL, 0, NULL);
|
usbd_ep_read(ep, NULL, 0, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -160,12 +149,9 @@ void cdc_acm_msc_init(void)
|
|||||||
usbd_interface_add_endpoint(&cdc_data_intf, &cdc_out_ep);
|
usbd_interface_add_endpoint(&cdc_data_intf, &cdc_out_ep);
|
||||||
usbd_interface_add_endpoint(&cdc_data_intf, &cdc_in_ep);
|
usbd_interface_add_endpoint(&cdc_data_intf, &cdc_in_ep);
|
||||||
|
|
||||||
// usbd_msc_class_init(MSC_OUT_EP, MSC_IN_EP);
|
usbd_msc_class_init(MSC_OUT_EP, MSC_IN_EP);
|
||||||
|
|
||||||
usbd_initialize();
|
usbd_initialize();
|
||||||
|
|
||||||
imp_util_ring_queue_init(&ring_q_cdc_recv, ring_q_cdc_recv_swap_data, 1025);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
volatile uint8_t dtr_enable = 0;
|
volatile uint8_t dtr_enable = 0;
|
||||||
@ -187,41 +173,9 @@ void cdc_acm_data_send_with_dtr_test(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
signed short cdc_usb_read_bytes(char* data, unsigned short len)
|
|
||||||
{
|
|
||||||
signed short ret = len;
|
|
||||||
if (len >= 64) {
|
|
||||||
ret = 64;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (imp_util_ring_queue_get_wlvl(&ring_q_cdc_recv) >= len) {
|
|
||||||
imp_util_ring_queue_read(&ring_q_cdc_recv, (uint8_t*)data, len);
|
|
||||||
}else {
|
|
||||||
data[0] = 0;
|
|
||||||
ret = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
signed short cdc_usb_writ_bytes(char* data, unsigned short len)
|
|
||||||
{
|
|
||||||
signed short n;
|
|
||||||
char aBuffer[64] = { 0 };
|
|
||||||
n = len >= 64 ? 64 : len;
|
|
||||||
aBuffer[63] = '\n';
|
|
||||||
strncpy(aBuffer, data, n);
|
|
||||||
|
|
||||||
if (dtr_enable) {
|
|
||||||
usbd_ep_write(CDC_IN_EP, (uint8_t*)data, n, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
return len;
|
|
||||||
}
|
|
||||||
|
|
||||||
int cdc_printf(const char *fmt, ...) {
|
int cdc_printf(const char *fmt, ...) {
|
||||||
int n;
|
int n;
|
||||||
char aBuffer[64] = {0};
|
char aBuffer[64];
|
||||||
va_list args;
|
va_list args;
|
||||||
|
|
||||||
va_start(args, fmt);
|
va_start(args, fmt);
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user