编译成功
This commit is contained in:
@@ -3,11 +3,11 @@
|
||||
/* 板级BSP头文件 */
|
||||
#include "Bsp.h"
|
||||
|
||||
#define WR_BUFFER_SIZE 512
|
||||
#define WR_BUFFER_SIZE 512
|
||||
|
||||
/* 1. 创建shell对象,开辟shell缓冲区 */
|
||||
Shell Host; //Shell实例化
|
||||
char HostBuffer[WR_BUFFER_SIZE]; //读写缓冲区
|
||||
Shell Host; // Shell实例化
|
||||
char HostBuffer[WR_BUFFER_SIZE]; // 读写缓冲区
|
||||
const COM_MAP_T *HostCom = TTY_COM;
|
||||
/**
|
||||
* @brief Shell写函数
|
||||
@@ -16,8 +16,9 @@ const COM_MAP_T *HostCom = TTY_COM;
|
||||
* @note void
|
||||
* @example void
|
||||
*/
|
||||
signed short ShellWrite(char *ch, unsigned short Len) {
|
||||
ComSendStr(HostCom, (uint8_t *) ch, Len);
|
||||
signed short ShellWrite(char *ch, unsigned short Len)
|
||||
{
|
||||
ComSendStr(HostCom, (uint8_t *)ch, Len);
|
||||
return Len;
|
||||
}
|
||||
|
||||
@@ -28,29 +29,30 @@ signed short ShellWrite(char *ch, unsigned short Len) {
|
||||
* @note void
|
||||
* @example void
|
||||
*/
|
||||
void LetterShellIrqFunc(void *Param) {
|
||||
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) {
|
||||
//初始化串口
|
||||
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
|
||||
// 初始化LetterShell
|
||||
shellInit(&Host, HostBuffer, WR_BUFFER_SIZE);
|
||||
}
|
||||
|
||||
@@ -2,17 +2,19 @@
|
||||
// Created by anonymous on 2026/5/24.
|
||||
//
|
||||
/* C标准库头文件 */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
/* BSP文件 */
|
||||
#include "main.h"
|
||||
#include "Bsp.h"
|
||||
#include "main.h"
|
||||
|
||||
int main(void) {
|
||||
int main(void)
|
||||
{
|
||||
|
||||
BspInit();
|
||||
|
||||
while (1) {
|
||||
while (1)
|
||||
{
|
||||
LedToggle(LED0);
|
||||
DelayMs(100);
|
||||
}
|
||||
Reference in New Issue
Block a user