[LsSDK][tool] ls_syscfg_gui2.1 and ls_syscfg_debug1.0

news/2024/10/30 23:18:56/

文章目录

  • 一、简介
    • 1.工具的目的
    • 2. 更新点
      • 下个更新
  • 三、配置文件

一、简介

1.工具的目的

① 可视化选择IO口功能。
② 自由配置IO支持的功能。
③ 适用各类MCU,方便移植和开发。
④ 功能配置和裁剪(选项-syscfg-待完成–需要适配keil语法有些麻烦)
在这里插入图片描述

在这里插入图片描述

ls_syscfg.h 目的更快的配置外设参数和功能,跟专注业务代码开发。

在这里插入图片描述

2. 更新点

① 新增宏名称
② 注释
③ 回调函数(中断回调、按键回调)
④ 变更排序方式,按GPIOA、B、C排序
⑤ 回调函数会在ls_gpio.h生成弱函数,可由外部重新定义。

__WEAK void key0 (key_event_t event) {switch (event) {case KEY_EVENT_SINGLE_CLICK:break;}
}

下个更新

  1. syscfg功能
  2. 相应例程更新
  3. 基本完成功能

更多基于工具的项目开源。

三、配置文件

/********************************************************************************
* @file    ls_gpio.h
* @author  jianqiang.xue
* @version V1.3.0
* @date    2023-06-04
* @brief   业务类--GPIO定义
********************************************************************************/
#ifndef __LS_GPIO_H
#define __LS_GPIO_H
#define LS_IO_VERSION "CX32L003_通用模板"#include "cx32l003_hal.h"
#include "cx32l003_hal_def.h"
#include "bsp_gpio.h"
#include "bsp_exti.h"/* GPIO_EXTI_INT_EDGE;             // 中断类型 边沿触发GPIO_EXTI_INT_LOWFALL;  // 下降沿触发中断GPIO_EXTI_INT_HIGHRISE; // 上升沿触发中断GPIO_EXTI_INT_FALLRISE; // 下降沿上升沿都触发中断
GPIO_EXTI_INT_LEVEL;            // 中断类型 电平触发GPIO_EXTI_INT_LOWFALL;  // 低电平触发中断GPIO_EXTI_INT_HIGHRISE; // 高电平触发中断 */#define GPIO_CLK(GPIO)                              (RCC_HCLKEN_##GPIO##CKEN)
#define GPIO_APBx                                   (0)
/************************************GPIO***********************************/
#define LS_IO_NUM                                   (16)
/* Public Struct -------------------------------------------------------------*/union io_support_t {uint64_t val; // 对外值struct {uint64_t swo                : 1;uint64_t adc0_ch0           : 1;uint64_t adc0_ch1           : 1;uint64_t adc0_ch2           : 1;uint64_t adc0_ch3           : 1;uint64_t adc0_ch4           : 1;uint64_t adc0_ch5           : 1;uint64_t adc0_ch6           : 1;uint64_t tim1_ch1           : 1; // PWM0uint64_t tim1_ch2           : 1; // PWM1uint64_t tim1_ch3           : 1; // PWM2uint64_t tim1_ch4           : 1; // PWM3uint64_t tim2_ch1           : 1; // PWM4uint64_t tim2_ch2           : 1; // PWM5uint64_t tim2_ch3           : 1; // PWM6uint64_t tim2_ch4           : 1; // PWM7uint64_t uart0_tx           : 1;uint64_t uart0_rx           : 1;uint64_t uart1_tx           : 1;uint64_t uart1_rx           : 1;uint64_t uart2_tx           : 1;uint64_t uart2_rx           : 1;uint64_t i2c0_scl           : 1; // 硬件IICuint64_t i2c0_sda           : 1;uint64_t i2c_scl_soft       : 1; // 软件IICuint64_t i2c_sda_soft       : 1;uint64_t spi0_clk           : 1;uint64_t spi0_mosi          : 1;uint64_t spi0_miso          : 1;uint64_t spi0_nss           : 1;#if !LS_IO_EXTEND_SUPPORTuint64_t reserve            : 34;
#endif} bit;
};typedef enum {IO_TYPE_IN_NULL = 0, // 无上下拉IO_TYPE_IN_PULLUP,   // 输入,上拉IO_TYPE_IN_PULLDOWN, // 输入,下拉IO_TYPE_OUT_PP,      // 默认输出 推免输出IO_TYPE_OUT_OD,      // 开漏输出// 中断输入IO_TYPE_INIRQ_LEVEL_LOW,     // 电平触发-低电平IO_TYPE_INIRQ_LEVEL_HIGH,    // 电平触发-高电平IO_TYPE_INIRQ_EDGE_LOWFALL,  // 边沿触发-下降沿IO_TYPE_INIRQ_EDGE_HIGHRISE, // 边沿触发-上降沿IO_TYPE_INIRQ_EDGE_FALLRISE, // 边沿触发-任意电平变化IO_TYPE_SWO,          // 默认烧录脚IO_TYPE_KEY,          // 按键IO_TYPE_MATRIX_KEY_X, // 矩阵键盘X轴IO_TYPE_MATRIX_KEY_Y, // 矩阵键盘Y轴IO_TYPE_W2812X,IO_TYPE_ADC0_CH0, // ADC0_0IO_TYPE_ADC0_CH1, // ADC0_1IO_TYPE_ADC0_CH2, // ADC0_2IO_TYPE_ADC0_CH3, // ADC0_3IO_TYPE_ADC0_CH4, // ADC0_4IO_TYPE_ADC0_CH5, // ADC0_5IO_TYPE_ADC0_CH6, // ADC0_6IO_TYPE_TIM1_CH1, // PWM0IO_TYPE_TIM1_CH2, // PWM1IO_TYPE_TIM1_CH3, // PWM2IO_TYPE_TIM1_CH4, // PWM3IO_TYPE_TIM2_CH1, // PWM4IO_TYPE_TIM2_CH2, // PWM5IO_TYPE_TIM2_CH3, // PWM6IO_TYPE_TIM2_CH4, // PWM7IO_TYPE_UART0_TX,   // 串口0,TXIO_TYPE_UART0_RX,   // 串口0,RXIO_TYPE_UART1_TX,   // 串口1,TXIO_TYPE_UART1_RX,   // 串口1,RXIO_TYPE_UART2_TX,   // 串口2,TXIO_TYPE_UART2_RX,   // 串口2,RXIO_TYPE_I2C0_SCL,   // 硬件IIC0IO_TYPE_I2C0_SDA,   // 硬件IIC0IO_TYPE_I2C_SCL_SOFT, // 软件IICIO_TYPE_I2C_SDA_SOFT, // 软件IICIO_TYPE_SPI0_CLK,     // SPI0_时钟IO_TYPE_SPI0_MOSI,    // SPI0_主机输出IO_TYPE_SPI0_MISO,    // SPI0_主机输入IO_TYPE_SPI0_NSS,     // SPI0_片选IO_TYPE_MAX,
} io_type_t;extern const union io_support_t g_io_support[LS_IO_NUM]; // 引脚支持类型
extern const io_type_t g_io_default_type[LS_IO_NUM];     // 引脚默认类型
extern const bsp_gpio_t g_io_cfg[LS_IO_NUM];             // 引脚配置(时钟中断号)
extern const uint8_t g_io_pin_num[LS_IO_NUM];                   // 数组下标对应的引脚号
#ifdef LS_IO
const uint8_t g_io_pin_num[LS_IO_NUM] = {5, 6, 10, 12, 11, 13, 14, 15, 16, 17, 18, 19, 20, 1, 2, 3,
};const bsp_gpio_t g_io_cfg[LS_IO_NUM] = {{(GPIOA), (GPIO_PIN_1), GPIO_CLK(GPIOA), (0), (GPIOA_IRQn)},{(GPIOA), (GPIO_PIN_2), GPIO_CLK(GPIOA), (0), (GPIOA_IRQn)},{(GPIOA), (GPIO_PIN_3), GPIO_CLK(GPIOA), (0), (GPIOA_IRQn)},{(GPIOB), (GPIO_PIN_4), GPIO_CLK(GPIOB), (0), (GPIOB_IRQn)},{(GPIOB), (GPIO_PIN_5), GPIO_CLK(GPIOB), (0), (GPIOB_IRQn)},{(GPIOC), (GPIO_PIN_3), GPIO_CLK(GPIOC), (0), (GPIOC_IRQn)},{(GPIOC), (GPIO_PIN_4), GPIO_CLK(GPIOC), (0), (GPIOC_IRQn)},{(GPIOC), (GPIO_PIN_5), GPIO_CLK(GPIOC), (0), (GPIOC_IRQn)},{(GPIOC), (GPIO_PIN_6), GPIO_CLK(GPIOC), (0), (GPIOC_IRQn)},{(GPIOC), (GPIO_PIN_7), GPIO_CLK(GPIOC), (0), (GPIOC_IRQn)},{(GPIOD), (GPIO_PIN_1), GPIO_CLK(GPIOD), (0), (GPIOD_IRQn)},{(GPIOD), (GPIO_PIN_2), GPIO_CLK(GPIOD), (0), (GPIOD_IRQn)},{(GPIOD), (GPIO_PIN_3), GPIO_CLK(GPIOD), (0), (GPIOD_IRQn)},{(GPIOD), (GPIO_PIN_4), GPIO_CLK(GPIOD), (0), (GPIOD_IRQn)},{(GPIOD), (GPIO_PIN_5), GPIO_CLK(GPIOD), (0), (GPIOD_IRQn)},{(GPIOD), (GPIO_PIN_6), GPIO_CLK(GPIOD), (0), (GPIOD_IRQn)},
};const union io_support_t g_io_support[LS_IO_NUM] = {{0x74A0000}, {0x23452400}, {0x20204000}, {0x23410000}, {0x4821000},{0x844404}, {0x488808}, {0x4100000}, {0x8208102}, {0x10080201},{0x40001}, {0x10100210}, {0x8012020}, {0x3020100}, {0x10458040},{0x88A2280},
};const io_type_t g_io_default_type[LS_IO_NUM] = {IO_TYPE_UART0_RX, IO_TYPE_UART0_TX, IO_TYPE_TIM2_CH3, IO_TYPE_OUT_PP, IO_TYPE_TIM2_CH1,IO_TYPE_TIM1_CH3, IO_TYPE_TIM1_CH4, IO_TYPE_OUT_PP, IO_TYPE_ADC0_CH0, IO_TYPE_SWO,IO_TYPE_SWO, IO_TYPE_TIM1_CH2, IO_TYPE_TIM2_CH2, IO_TYPE_TIM1_CH1, IO_TYPE_TIM2_CH4,IO_TYPE_ADC0_CH6,
};__weak void app_io_exti_cb(void *gpiox, uint16_t gpio_pin) {
// [中断回调START]
// [中断回调END]
}#include "ls_key.h"
// __WEAK void xxx (key_event_t event) {
//     switch (event) {
//         case KEY_EVENT_SINGLE_CLICK:
//             break;
//     }
// }__WEAK const ls_key_cb_t ls_key_cb_list[] = {
// [按键扫描START]
// [按键扫描END]{0xFF, NULL} // 必须有
};
#endif // __LS_IO_END// [引脚宏名称START]
// [引脚宏名称END]
#endif  // __LS_GPIO_H

gitee

1.0版本

  1. ADC
    AT+ADC0_CFG?
    AT+ADC0_TIMER_MS=300
    AT+ADC0_START
    AT+ADC0_STOP
    AT+GET_ADC0_VAL?
    AT+ADC0_CFG=?
    AT+ADC0_CFG=1,10
#include "bsp_adc.h"
extern bsp_adc_cfg_t g_adc0_cfg;
extern os_timer_id OS_TIMER_ID(adc0_collection);
extern uint32_t g_adc0_timer_ms;static int atcmd_adc0_cfg_help(atcmd_pack_t *pack) {char buff[60] = {0};snprintf(buff, 60, "AT+ADC0_CFG=<clk_sel(0-7)>,<sample_num(0-255)>\r\n");strcat(buff, AT_OK);pack->reply((uint8_t*)buff, strlen(buff));return 0;
}static int atcmd_get_adc0_cfg(atcmd_pack_t *pack) {char buff[30] = {0};snprintf(buff, 30, "%d,%d\r\n", g_adc0_cfg.clk_sel, g_adc0_cfg.sample_num);strcat(buff, AT_OK);pack->reply((uint8_t*)buff, strlen(buff));return 0;
}static int atcmd_set_adc0_cfg(atcmd_pack_t *pack) {uint32_t argc[2] = {0};char buff[20] = {0};pack->argc = sscanf((char*)(pack->data), "%d,%d", &argc[0], &argc[1]);if (pack->argc != 2) {strcat(buff, AT_ARGCERR);pack->reply((uint8_t*)buff, strlen(buff));return -2;}bsp_adc0_deinit();g_adc0_cfg.clk_sel = (uint8_t)argc[0];g_adc0_cfg.sample_num = argc[1];if (bsp_adc0_init(&g_adc0_cfg)) {strcat(buff, AT_ERROR);} else {strcat(buff, AT_OK);}pack->reply((uint8_t*)buff, strlen(buff));return 0;
}static int atcmd_set_adc0_timer_ms(atcmd_pack_t *pack) {uint32_t argc[1] = {0};uint8_t buff[40] = {0};pack->argc = sscanf((char*)(pack->data), "%d", &argc[0]);if (pack->argc != 1) return -1;// 先停止周期任务,并将任务全部取消。OS_TIMER_STOP(adc0_collection);if (argc[0]) {if (os_timer_restart(OS_TIMER_ID(adc0_collection), argc[0]) != OS_OK)strcat((char*)buff, "adc0 timer restart fail");g_adc0_timer_ms = argc[0];} else {if (os_timer_stop(OS_TIMER_ID(adc0_collection)) != OS_OK)strcat((char*)buff, "adc0 timer stop fail");}strcat((char*)buff, AT_OK);pack->reply(buff, strlen((char*)buff));return 0;
}static int atcmd_adc0_start(atcmd_pack_t *pack) {uint8_t buff[40] = {0};if (os_timer_restart(OS_TIMER_ID(adc0_collection), g_adc0_timer_ms) != OS_OK)strcat((char*)buff, "adc0 timer restart fail");strcat((char*)buff, AT_OK);pack->reply(buff, strlen((char*)buff));return 0;
}static int atcmd_adc0_stop(atcmd_pack_t *pack) {uint8_t buff[40] = {0};if (os_timer_stop(OS_TIMER_ID(adc0_collection)) != OS_OK)strcat((char*)buff, "adc0 timer stop fail");strcat((char*)buff, AT_OK);pack->reply(buff, strlen((char*)buff));return 0;
}static int atcmd_get_adc0_val(atcmd_pack_t *pack) {uint8_t buff[60] = {0};snprintf((char *)buff, 60, "%d,%d,%d,%d,%d,%d,%d,%d\r\n",bsp_adc0_get_ch_val(0), bsp_adc0_get_ch_val(1), bsp_adc0_get_ch_val(2), bsp_adc0_get_ch_val(3),bsp_adc0_get_ch_val(4), bsp_adc0_get_ch_val(5), bsp_adc0_get_ch_val(6), bsp_adc0_get_ch_val(7));strcat((char*)buff, AT_OK);pack->reply(buff, strlen((char*)buff));return 0;
}static int atcmd_get_adc0_designated_val(atcmd_pack_t *pack) {uint32_t argc[1];uint8_t buff[30] = {0};pack->argc = sscanf((char*)(pack->data), "%d", &argc[0]);if (pack->argc != 1) return -1;snprintf((char *)buff, 30, "%d", bsp_adc0_get_ch_val(argc[0]));strcat((char*)buff, AT_OK);pack->reply(buff, strlen((char*)buff));return 0;
}ATCMD_INIT("AT+ADC0_TIMER_MS=", atcmd_set_adc0_timer_ms);
ATCMD_INIT("AT+ADC0_START", atcmd_adc0_start);
ATCMD_INIT("AT+ADC0_STOP", atcmd_adc0_stop);
ATCMD_INIT("AT+GET_ADC0_VAL=", atcmd_get_adc0_designated_val);
ATCMD_INIT("AT+GET_ADC0_VAL?", atcmd_get_adc0_val);ATCMD_INIT("AT+ADC0_CFG=?", atcmd_adc0_cfg_help);
ATCMD_INIT("AT+ADC0_CFG=", atcmd_set_adc0_cfg);
ATCMD_INIT("AT+ADC0_CFG?", atcmd_get_adc0_cfg);
  1. PWM
    AT+PWM=0,10
    AT+TIM1_CFG=7,99,0
    AT+TIM1_CFG=?
    AT+PWM_TASK=
#include "bsp_pwm.h"
#include "bsp_tim.h"
#if LS_TIM1_EN
extern bsp_tim_cfg_t g_tim1_cfg;
static int atcmd_set_tim1_cfg_help(atcmd_pack_t *pack) {char buff[85] = {0};snprintf(buff, 60, "AT+TIM1_CFG=<prescaler(0-65534)>,<period(0-65534)>,<level_logic(0-1)>\r\n");strcat(buff, AT_OK);pack->reply((uint8_t*)buff, strlen(buff));return 0;
}
static int atcmd_set_tim1_cfg(atcmd_pack_t *pack) {uint32_t argc[3] = {0};char buff[10] = {0};pack->argc = sscanf((char*)(pack->data), "%d,%d,%d", &argc[0], &argc[1], &argc[2]);if (pack->argc != 3) {strcat(buff, AT_ARGCERR);pack->reply((uint8_t*)buff, strlen(buff));return -2;}bsp_tim1_pwm_deinit();g_tim1_cfg.prescaler   = (uint16_t)argc[0];g_tim1_cfg.period      = (uint16_t)argc[1];g_tim1_cfg.level_logic = (uint8_t)argc[2];if (bsp_tim1_pwm_init(&g_tim1_cfg)) {strcat(buff, AT_ERROR);} else {strcat(buff, AT_OK);}pack->reply((uint8_t*)buff, strlen(buff));return 0;
}
ATCMD_INIT("AT+TIM1_CFG=?", atcmd_set_tim1_cfg_help);
ATCMD_INIT("AT+TIM1_CFG=", atcmd_set_tim1_cfg);
#endif
#if LS_TIM2_EN
extern bsp_tim_cfg_t g_tim2_cfg;
static int atcmd_set_tim2_cfg_help(atcmd_pack_t *pack) {char buff[85] = {0};snprintf(buff, 60, "AT+TIM2_CFG=<prescaler(0-65534)>,<period(0-65534)>,<level_logic(0-1)>\r\n");strcat(buff, AT_OK);pack->reply((uint8_t*)buff, strlen(buff));return 0;
}
static int atcmd_set_tim2_cfg(atcmd_pack_t *pack) {uint32_t argc[3] = {0};char buff[10] = {0};pack->argc = sscanf((char*)(pack->data), "%d,%d,%d", &argc[0], &argc[1], &argc[2]);if (pack->argc != 3) {strcat(buff, AT_ARGCERR);pack->reply((uint8_t*)buff, strlen(buff));return -2;}bsp_tim2_pwm_deinit();g_tim2_cfg.prescaler   = (uint16_t)argc[0];g_tim2_cfg.period      = (uint16_t)argc[1];g_tim2_cfg.level_logic = (uint8_t)argc[2];if (bsp_tim2_pwm_init(&g_tim2_cfg)) {strcat(buff, AT_ERROR);} else {strcat(buff, AT_OK);}pack->reply((uint8_t*)buff, strlen(buff));return 0;
}
ATCMD_INIT("AT+TIM2_CFG=?", atcmd_set_tim2_cfg_help);
ATCMD_INIT("AT+TIM2_CFG=", atcmd_set_tim2_cfg);
#endifstatic int atcmd_set_pwm_val_help(atcmd_pack_t *pack) {char buff[60] = {0};snprintf(buff, 60, "AT+PWM=<ch(0-7)>,<val(0-65535)>\r\n");strcat(buff, AT_OK);pack->reply((uint8_t*)buff, strlen(buff));return 0;
}static int atcmd_set_pwm_val(atcmd_pack_t *pack) {uint32_t argc[2] = {0};uint8_t buff[10] = {0};pack->argc = sscanf((char*)(pack->data), "%d,%d", &argc[0], &argc[1]);if (pack->argc != 2) {strcat((char*)buff, AT_ARGCERR);pack->reply(buff, strlen((char*)buff));return -2;}if (bsp_pwm_set_pulse(argc[0], argc[1])) {strcat((char*)buff, AT_ERROR);} else {strcat((char*)buff, AT_OK);}pack->reply(buff, strlen((char*)buff));return 0;
}ATCMD_INIT("AT+PWM=?", atcmd_set_pwm_val_help);
ATCMD_INIT("AT+PWM=", atcmd_set_pwm_val);

http://www.ppmy.cn/news/332218.html

相关文章

第五十二回:Drawer Widget

文章目录 概念介绍使用方法示例代码 我们在上一章回中介绍了TabBarView Widget相关的内容,本章回中将介绍 Drawer Widget.闲话休提&#xff0c;让我们一起Talk Flutter吧。 概念介绍 我们这里介绍的Drawer Widget是指从屏幕左侧推出的菜单&#xff0c;国内有些地方把它翻译成…

Qt动态调用(外部调用)SDK库(dll动态库)

Qt动态调用SDK库&#xff08;dll动态库&#xff09; ​​​​​​​ 之前的文章&#xff0c;介绍了Qt调用sdk库的方式&#xff0c;大家可以点击查看&#xff08;Q调用SDK库(dll动态库)&#xff09;之前的文章&#xff0c;里面介绍的调用方式就是静态的调用方式。如下图所示&am…

Android约束布局

一、嵌套布局效率可能很低。 在 Android 开发中,我们常常需要使用嵌套布局来实现某些较复杂的界面效果。但是嵌套层级太深会带来一些问题,主要包括: 视图层级过深,导致内存占用过高和性能下降。Android 需要为每个 View 对象分配内存,嵌套层级过深会创建很多 View 对象,占用较…

京瓷1800打印机扫描步骤_京瓷复印机扫描设置方法京瓷复印机扫描到电脑设置...

京瓷KM-2050/2550/3035/4035/5035扫描卡设置说明 扫描至PC设置步骤 (老款京瓷复印机扫描,新款下方有更新) 1.(1)首先在所在设备上安装京瓷扫描组件。 (2)在初始设定/扫描初始设定/基本系统设定/中设定好IP地址。注意DHCP要选择关。 2.设定发件人及收件人 ]3.ip端口扫描 [有针…

麒麟V10系统U盘引导盘制作手册

麒麟V10-SP1服务器系统U盘引导盘制作手册 一、前期准备 1、安装Fedora刻录软件 下载地址&#xff1a;百度网盘 请输入提取码 提取码&#xff1a;8888 2、一个容量大于8G的U盘&#xff08;推荐16G以上&#xff0c;空盘&#xff09; 3、麒麟服务器操作系统镜像&#xff08;这…

京瓷4501i打印机扫描步骤_京瓷复印机扫描设置方法–京瓷复印机扫描到电脑设置...

京瓷KM-2050/2550/3035/4035/5035扫描卡设置说明 扫描至PC设置步骤 (老款京瓷复印机扫描,新款下方有更新) 京瓷复印机扫描到电脑设置 1.(1)首先在所在设备上安装京瓷扫描组件。 (2)在初始设定/扫描初始设定/基本系统设定/中设定好IP地址。注意DHCP要选择关。 2.设定发件人及…

银河麒麟V10系统安装U盘制作

1、首先打开UltraISO软件&#xff0c;一般选择较新版本的UltraISO软件。 2、 点击工具栏中打开镜像文件工具&#xff0c;如上图红色方框标志按钮&#xff0c;然后在 “打开ISO文件”对话框中找到下载好的Kylin桌面试用版本Kylin-Desktop-V10-Release-Build1-2101-arm64.iso镜像…

中标麒麟桌面版7.0 u盘安装

一、安装前的准备 1、安装U盘启动盘制作工具ultra ISO软件或rufus 软件 2、通过ultra ISO或Rufus制作u盘启动盘 2.1通过ultra ISO制作U盘启动盘 选择“文件”-----“打开”&#xff0c;打开系统光盘镜像ISO文件 选择“启动”-------“写入磁盘镜像”&#xff0c;制作U盘启动…