添加工程应用文件
This commit is contained in:
Executable
+98
@@ -0,0 +1,98 @@
|
||||
#include "LetterShell.h"
|
||||
#include "shell.h"
|
||||
/* 板级BSP头文件 */
|
||||
#include "Bsp.h"
|
||||
|
||||
#define WR_BUFFER_SIZE 512
|
||||
|
||||
/* 1. 创建shell对象,开辟shell缓冲区 */
|
||||
Shell Host; //Shell实例化
|
||||
char HostBuffer[WR_BUFFER_SIZE]; //读写缓冲区
|
||||
const COM_MAP_T *HostCom = TTY_COM;
|
||||
/**
|
||||
* @brief Shell写函数
|
||||
* @param ComId 串口号,ch 数据
|
||||
* @retval void
|
||||
* @note void
|
||||
* @example void
|
||||
*/
|
||||
signed short ShellWrite(char *ch, unsigned short Len) {
|
||||
ComSendStr(HostCom, (uint8_t *) ch, Len);
|
||||
return Len;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Shell读函数 - 中断回调实现
|
||||
* @param Vector 中断向量号
|
||||
* @retval void
|
||||
* @note void
|
||||
* @example void
|
||||
*/
|
||||
void LetterShellIrqFunc(void *Param) {
|
||||
uint8_t ch = 0x00;
|
||||
ch = ComReceiveChar(Param);
|
||||
shellHandler(&Host, ch);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief 初始化Shell
|
||||
* @note void
|
||||
* @param ComX 串口号,baud 波特率
|
||||
* @retval void
|
||||
*/
|
||||
void LetterShellInit(const COM_MAP_T *ComX, uint32_t Baud) {
|
||||
//初始化串口
|
||||
ComStdConfig(ComX, Baud);
|
||||
//设置串口回调函数
|
||||
IrqRegister(ComX->Periph.Irqn, LetterShellIrqFunc);
|
||||
//设置中断等级
|
||||
IrqEnable(ComX->Periph.Irqn, 1, 1);
|
||||
//注册写函数
|
||||
Host.write = ShellWrite;
|
||||
//初始化LetterShell
|
||||
shellInit(&Host, HostBuffer, WR_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * @brief 打印版本号
|
||||
// * @param void
|
||||
// * @retval void
|
||||
// * @note void
|
||||
// * @example void
|
||||
// */
|
||||
// void version(void)
|
||||
// {
|
||||
// printf("%s,%s\r\n",HARDWARE_VERSION,SOFTWARE_VERSION);
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @brief 重启单片机
|
||||
// * @param void
|
||||
// * @retval void
|
||||
// * @note void
|
||||
// * @example void
|
||||
// */
|
||||
// void reboot(void)
|
||||
// {
|
||||
// SystemReboot();
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @brief 串口测试程序
|
||||
// * @param void
|
||||
// * @retval void
|
||||
// * @note void
|
||||
// * @example void
|
||||
// */
|
||||
//
|
||||
// void comTest(uint8_t ComId)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// //打印版本号
|
||||
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), version, version, version);
|
||||
// //软重启单片机
|
||||
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), reboot, reboot, reboot);
|
||||
// //串口测试
|
||||
// SHELL_EXPORT_CMD(SHELL_CMD_PERMISSION(0)|SHELL_CMD_TYPE(SHELL_TYPE_CMD_FUNC), comTest, comTest, comTest);
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
#ifndef __LETTER_SHELL_H__
|
||||
#define __LETTER_SHELL_H__
|
||||
|
||||
#include "Bsp.h"
|
||||
|
||||
void LetterShellInit(const COM_MAP_T *ComX, uint32_t Baud);
|
||||
|
||||
#endif
|
||||
Executable
+21
@@ -0,0 +1,21 @@
|
||||
//
|
||||
// Created by anonymous on 2026/5/24.
|
||||
//
|
||||
/* C标准库头文件 */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
/* BSP文件 */
|
||||
#include "main.h"
|
||||
#include "Bsp.h"
|
||||
|
||||
int main(void) {
|
||||
|
||||
BspInit();
|
||||
|
||||
while (1) {
|
||||
LedToggle(LED0);
|
||||
DelayMs(100);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
Executable
+8
@@ -0,0 +1,8 @@
|
||||
//
|
||||
// Created by anonymous on 2026/5/24.
|
||||
//
|
||||
|
||||
#ifndef MAIN_H
|
||||
#define MAIN_H
|
||||
|
||||
#endif //MAIN_H
|
||||
Executable
+39
@@ -0,0 +1,39 @@
|
||||
//
|
||||
// Created by anonymous on 2026/5/28.
|
||||
//
|
||||
|
||||
#ifndef _BOARD_H
|
||||
#define _BOARD_H
|
||||
|
||||
/* Voilet Bsp */
|
||||
#include "VoiletPort.h"
|
||||
|
||||
/* Chip Library Enable */
|
||||
|
||||
/* Extra Library Enable */
|
||||
#define TTY_COM COM1
|
||||
#define TTY_BAUD 115200
|
||||
|
||||
#define LED_NUM 2 //LED灯数量
|
||||
enum {
|
||||
LED0 = 0,
|
||||
LED1
|
||||
};
|
||||
|
||||
#define DI_NUM 0 //数字信号输入通道数量
|
||||
// enum {
|
||||
//
|
||||
// };
|
||||
|
||||
#define DO_NUM 0 //数字信号输出通道数量
|
||||
// enum {
|
||||
//
|
||||
// };
|
||||
|
||||
#define RS485_1 COM1
|
||||
// #define RS485_2
|
||||
// #define RS485_3
|
||||
// #define RS485_4
|
||||
// #define RS485_5
|
||||
|
||||
#endif //_BOARD_H
|
||||
+1
-1
Submodule VoiletBspStm32F10x updated: 249409457f...b3bfcb42f5
Reference in New Issue
Block a user