dispset 增加 all 一键全管脚设置 (APP V1.00.34)
- dispset all 0/1/z: 一次把数码管 7 个管脚全部拉高/拉低/置高阻 - 抽出 cli_disp_set_pin() 单脚驱动, 单脚与 all 共用 - 仅 APP 改动, Boot 不动 (仍 V1.00.07) - docs/开发日志.md: 新增 §62
This commit is contained in:
parent
fb681a4b69
commit
c9c1d474a7
12
docs/开发日志.md
12
docs/开发日志.md
@ -1548,3 +1548,15 @@ APP2 链接的镜像发向 APP1 区。设备端 END 校验(向量表 Reset PC
|
|||||||
- `cli_parse_disp_pin()`:解析 `pin1`~`pin7`(或裸 `1`~`7`)。
|
- `cli_parse_disp_pin()`:解析 `pin1`~`pin7`(或裸 `1`~`7`)。
|
||||||
- 版本:APP `V1.00.32` → `V1.00.33`(`APP_FW_VERSION_NUM` 0x00010020 →
|
- 版本:APP `V1.00.32` → `V1.00.33`(`APP_FW_VERSION_NUM` 0x00010020 →
|
||||||
0x00010021)。Boot 不动(仍 V1.00.07)。
|
0x00010021)。Boot 不动(仍 V1.00.07)。
|
||||||
|
|
||||||
|
## 62. `dispset` 增加 `all` 一键全管脚设置(2026-09-06,APP V1.00.34,仅 APP)
|
||||||
|
|
||||||
|
- 需求:`dispset all 0/1` 一次把数码管 7 个管脚全部拉高/拉低(也支持
|
||||||
|
`dispset all z` 全置高阻)。
|
||||||
|
- 实现(`mcm-ddc-ble/src/cli_core.c`):
|
||||||
|
- 抽出 `cli_disp_set_pin(pin_no, val)`(单脚驱动 0/1/z),单脚与 all 共用;
|
||||||
|
- `CmdDispSet` 顶部识别 `all`(大小写不敏感)→ 循环 pin1~7 逐个
|
||||||
|
`cli_disp_set_pin()`,回显 `all 7 display pins = 0/1/high-Z`;
|
||||||
|
- help 串更新为 `dispset <pin1-7|all> [0|1|z]`。
|
||||||
|
- 版本:APP `V1.00.33` → `V1.00.34`(`APP_FW_VERSION_NUM` 0x00010021 →
|
||||||
|
0x00010022)。Boot 不动(仍 V1.00.07)。
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
Binary file not shown.
Binary file not shown.
@ -9,12 +9,12 @@
|
|||||||
#define __APP_VERSION_H__
|
#define __APP_VERSION_H__
|
||||||
|
|
||||||
#ifndef APP_FW_VERSION
|
#ifndef APP_FW_VERSION
|
||||||
#define APP_FW_VERSION "V1.00.33"
|
#define APP_FW_VERSION "V1.00.34"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Numeric form used by the BLE info query / OTA records: 0x00MMmmpp */
|
/* Numeric form used by the BLE info query / OTA records: 0x00MMmmpp */
|
||||||
#ifndef APP_FW_VERSION_NUM
|
#ifndef APP_FW_VERSION_NUM
|
||||||
#define APP_FW_VERSION_NUM 0x00010021u
|
#define APP_FW_VERSION_NUM 0x00010022u
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* __APP_VERSION_H__ */
|
#endif /* __APP_VERSION_H__ */
|
||||||
|
|||||||
@ -701,77 +701,130 @@ static void CmdDispAuto(int argc, char* argv[])
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief "dispset <pin1-7> [0|1]": drive a display pin low/high manually.
|
* @brief Drive one display pin (1..7) to 0 / 1 / high-Z.
|
||||||
* pin1..pin7 map to PB0/PB1/PA0/PA1/PB11/PB13/PA6. "z" = high-Z.
|
* @return 1 on success, 0 on bad value, -1 on bad pin number.
|
||||||
* No value reads the current level. Use after "dispauto off".
|
|
||||||
*/
|
*/
|
||||||
static void CmdDispSet(int argc, char* argv[])
|
static int cli_disp_set_pin(uint8_t pin_no, char val)
|
||||||
{
|
{
|
||||||
GPIO_Module* port;
|
GPIO_Module* port;
|
||||||
uint16_t pin;
|
uint16_t pin;
|
||||||
uint8_t pin_no;
|
|
||||||
GPIO_InitType s;
|
GPIO_InitType s;
|
||||||
char name[8];
|
|
||||||
|
|
||||||
|
if (!display_pin_map(pin_no, &port, &pin))
|
||||||
|
{
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
|
GPIO_InitStruct(&s);
|
||||||
|
s.Pin = pin;
|
||||||
|
if (val == '1')
|
||||||
|
{
|
||||||
|
s.GPIO_Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
|
GPIO_InitPeripheral(port, &s);
|
||||||
|
GPIO_SetBits(port, pin);
|
||||||
|
}
|
||||||
|
else if (val == '0')
|
||||||
|
{
|
||||||
|
s.GPIO_Mode = GPIO_MODE_OUTPUT_PP;
|
||||||
|
GPIO_InitPeripheral(port, &s);
|
||||||
|
GPIO_ResetBits(port, pin);
|
||||||
|
}
|
||||||
|
else if (val == 'z' || val == 'Z')
|
||||||
|
{
|
||||||
|
s.GPIO_Mode = GPIO_MODE_INPUT;
|
||||||
|
s.GPIO_Pull = GPIO_NO_PULL;
|
||||||
|
GPIO_InitPeripheral(port, &s);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief "dispset <pin1-7|all> [0|1|z]": drive display pin(s) manually.
|
||||||
|
* pin1..pin7 map to PB0/PB1/PA0/PA1/PB11/PB13/PA6; "all" hits all 7.
|
||||||
|
* "z" = high-Z. No value reads one pin's level. Use after "dispauto off".
|
||||||
|
*/
|
||||||
|
static void CmdDispSet(int argc, char* argv[])
|
||||||
|
{
|
||||||
if (argc < 2)
|
if (argc < 2)
|
||||||
{
|
{
|
||||||
cli_write("usage: dispset <pin1-7> [0|1] (e.g. dispset pin1 1)\r\n");
|
cli_write("usage: dispset <pin1-7|all> [0|1|z]\r\n");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cli_parse_disp_pin(argv[1], &pin_no) ||
|
/* "all": apply the value to all 7 display pins */
|
||||||
!display_pin_map(pin_no, &port, &pin))
|
if (strcmp(argv[1], "all") == 0 || strcmp(argv[1], "ALL") == 0)
|
||||||
{
|
{
|
||||||
cli_printf("bad pin: %s (use pin1..pin7)\r\n", argv[1]);
|
uint8_t p;
|
||||||
return;
|
|
||||||
}
|
|
||||||
cli_pin_str(port, pin, name);
|
|
||||||
|
|
||||||
if (argc >= 3)
|
if (argc < 3 || argv[2][1] != '\0')
|
||||||
{
|
{
|
||||||
|
cli_write("usage: dispset all [0|1|z]\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (display_auto_get())
|
if (display_auto_get())
|
||||||
{
|
{
|
||||||
cli_write("warning: auto display is ON - use 'dispauto off' first\r\n");
|
cli_write("warning: auto display is ON - use 'dispauto off' first\r\n");
|
||||||
}
|
}
|
||||||
|
for (p = 1u; p <= 7u; p++)
|
||||||
|
{
|
||||||
|
if (cli_disp_set_pin(p, argv[2][0]) != 1)
|
||||||
|
{
|
||||||
|
cli_write("usage: dispset all [0|1|z]\r\n");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
cli_printf("all 7 display pins = %s\r\n",
|
||||||
|
(argv[2][0] == 'z' || argv[2][0] == 'Z') ? "high-Z" : argv[2]);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (argv[2][0] == '1' && argv[2][1] == '\0')
|
/* single pin */
|
||||||
|
{
|
||||||
|
GPIO_Module* port;
|
||||||
|
uint16_t pin;
|
||||||
|
uint8_t pin_no;
|
||||||
|
char name[8];
|
||||||
|
|
||||||
|
if (!cli_parse_disp_pin(argv[1], &pin_no) ||
|
||||||
|
!display_pin_map(pin_no, &port, &pin))
|
||||||
{
|
{
|
||||||
GPIO_InitStruct(&s);
|
cli_printf("bad pin: %s (use pin1..pin7 or all)\r\n", argv[1]);
|
||||||
s.Pin = pin;
|
return;
|
||||||
s.GPIO_Mode = GPIO_MODE_OUTPUT_PP;
|
|
||||||
GPIO_InitPeripheral(port, &s);
|
|
||||||
GPIO_SetBits(port, pin);
|
|
||||||
cli_printf("pin%u (%s) = 1\r\n", (unsigned)pin_no, name);
|
|
||||||
}
|
}
|
||||||
else if (argv[2][0] == '0' && argv[2][1] == '\0')
|
cli_pin_str(port, pin, name);
|
||||||
|
|
||||||
|
if (argc >= 3)
|
||||||
{
|
{
|
||||||
GPIO_InitStruct(&s);
|
if (display_auto_get())
|
||||||
s.Pin = pin;
|
{
|
||||||
s.GPIO_Mode = GPIO_MODE_OUTPUT_PP;
|
cli_write("warning: auto display is ON - use 'dispauto off' first\r\n");
|
||||||
GPIO_InitPeripheral(port, &s);
|
}
|
||||||
GPIO_ResetBits(port, pin);
|
if (argv[2][1] == '\0' && cli_disp_set_pin(pin_no, argv[2][0]) == 1)
|
||||||
cli_printf("pin%u (%s) = 0\r\n", (unsigned)pin_no, name);
|
{
|
||||||
}
|
if (argv[2][0] == 'z' || argv[2][0] == 'Z')
|
||||||
else if (argv[2][0] == 'z' || argv[2][0] == 'Z')
|
{
|
||||||
{
|
cli_printf("pin%u (%s) = high-Z\r\n", (unsigned)pin_no, name);
|
||||||
/* high-impedance (release the pin) */
|
}
|
||||||
GPIO_InitStruct(&s);
|
else
|
||||||
s.Pin = pin;
|
{
|
||||||
s.GPIO_Mode = GPIO_MODE_INPUT;
|
cli_printf("pin%u (%s) = %c\r\n", (unsigned)pin_no, name, argv[2][0]);
|
||||||
s.GPIO_Pull = GPIO_NO_PULL;
|
}
|
||||||
GPIO_InitPeripheral(port, &s);
|
}
|
||||||
cli_printf("pin%u (%s) = high-Z\r\n", (unsigned)pin_no, name);
|
else
|
||||||
|
{
|
||||||
|
cli_write("usage: dispset <pin1-7> [0|1|z]\r\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cli_write("usage: dispset <pin1-7> [0|1] (0=low, 1=high, z=hi-Z)\r\n");
|
cli_printf("pin%u (%s) = %u\r\n", (unsigned)pin_no, name,
|
||||||
|
(unsigned)(GPIO_ReadInputDataBit(port, pin) ? 1u : 0u));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
cli_printf("pin%u (%s) = %u\r\n", (unsigned)pin_no, name,
|
|
||||||
(unsigned)(GPIO_ReadInputDataBit(port, pin) ? 1u : 0u));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Command table; add new commands here */
|
/* Command table; add new commands here */
|
||||||
@ -792,7 +845,7 @@ static const CliCmd_t s_cmds[] = {
|
|||||||
{"pinset", "pinset <pxN> [0|1]: set/read GPIO level (pa0-6/pb0-13)", CmdPinSet},
|
{"pinset", "pinset <pxN> [0|1]: set/read GPIO level (pa0-6/pb0-13)", CmdPinSet},
|
||||||
{"disp", "disp <value> [f] [hex]: set 7-seg display value", CmdDisp},
|
{"disp", "disp <value> [f] [hex]: set 7-seg display value", CmdDisp},
|
||||||
{"dispauto", "dispauto [on|off]: enable/disable auto display scan", CmdDispAuto},
|
{"dispauto", "dispauto [on|off]: enable/disable auto display scan", CmdDispAuto},
|
||||||
{"dispset", "dispset <pin1-7> [0|1]: drive display pin (pin1=PB0..pin7=PA6)", CmdDispSet},
|
{"dispset", "dispset <pin1-7|all> [0|1|z]: drive display pin(s)", CmdDispSet},
|
||||||
{"factory", "factory: restore params to defaults and reboot", CmdFactory},
|
{"factory", "factory: restore params to defaults and reboot", CmdFactory},
|
||||||
{"uartrst", "uartrst: re-init USART1 (460800 8N1), flush rx queue", CmdUartRst},
|
{"uartrst", "uartrst: re-init USART1 (460800 8N1), flush rx queue", CmdUartRst},
|
||||||
{"uartinfo", "uartinfo: show USART1 pins/baud/format", CmdUartInfo},
|
{"uartinfo", "uartinfo: show USART1 pins/baud/format", CmdUartInfo},
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"file": "mothercup_ble_prod_ota.bin",
|
"file": "mothercup_ble_prod_ota.bin",
|
||||||
"target_bank": 1,
|
"target_bank": 1,
|
||||||
"size": 59184,
|
"size": 59392,
|
||||||
"crc32": "0xCE4E676C",
|
"crc32": "0x59E51401",
|
||||||
"version": 65569
|
"version": 65570
|
||||||
}
|
}
|
||||||
Binary file not shown.
@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"file": "mothercup_ble_prod_ota_app2.bin",
|
"file": "mothercup_ble_prod_ota_app2.bin",
|
||||||
"target_bank": 2,
|
"target_bank": 2,
|
||||||
"size": 59484,
|
"size": 59692,
|
||||||
"crc32": "0x3A51266C",
|
"crc32": "0xB370E0B5",
|
||||||
"version": 65569
|
"version": 65570
|
||||||
}
|
}
|
||||||
Loading…
x
Reference in New Issue
Block a user