Merge branch 'referee'

This commit is contained in:
NeoZeng
2022-11-19 15:43:57 +08:00
13 changed files with 731 additions and 55 deletions

View File

@@ -4,7 +4,7 @@
#include <stdint-gcc.h>
void buzzer_init();
extern void buzzer_on(uint16_t psc, uint16_t pwm, uint8_t level);
extern void buzzer_on(uint16_t psc, uint16_t pwm,uint8_t level);
extern void buzzer_off(void);
#endif

View File

@@ -10,6 +10,7 @@
*/
#include "bsp_usart.h"
#include "stdlib.h"
#include "memory.h"
/* usart service instance, modules' info would be recoreded here using USARTRegister() */
/* usart服务实例,所有注册了usart的模块信息会被保存在这里 */
@@ -66,6 +67,8 @@ void HAL_UARTEx_RxEventCallback(UART_HandleTypeDef *huart, uint16_t Size)
if (huart == instance[i]->usart_handle)
{
instance[i]->module_callback();
memset(instance[i]->recv_buff,0,instance[i]->recv_buff_size);
HAL_UARTEx_ReceiveToIdle_DMA(instance[i]->usart_handle, instance[i]->recv_buff, instance[i]->recv_buff_size);
__HAL_DMA_DISABLE_IT(instance[i]->usart_handle->hdmarx, DMA_IT_HT);
break;

View File

@@ -5,7 +5,7 @@
#include "main.h"
#define DEVICE_USART_CNT 3 // C板至多分配3个串口
#define USART_RXBUFF_LIMIT 128 // if your protocol needs bigger buff, modify here
#define USART_RXBUFF_LIMIT 256 // if your protocol needs bigger buff, modify here
/* application callback,which resolves specific protocol,解析协议的回调函数 */
typedef void (*usart_module_callback)();

29
bsp/struct_typedef.h Normal file
View File

@@ -0,0 +1,29 @@
#ifndef STRUCT_TYPEDEF_H
#define STRUCT_TYPEDEF_H
typedef signed char int8_t;
typedef signed short int int16_t;
#ifndef _INT32_T_DECLARED
typedef signed int int32_t;
#define _INT32_T_DECLARED
#endif
typedef signed long long int64_t;
/* exact-width unsigned integer types */
typedef unsigned char uint8_t;
typedef unsigned short int uint16_t;
#ifndef _UINT32_T_DECLARED
typedef unsigned int uint32_t;
#define _UINT32_T_DECLARED
#endif
typedef unsigned long long uint64_t;
typedef unsigned char bool_t;
typedef float float;
typedef double fp64;
#endif