备注在前: uint8_t 即 unsigned char(总忘 typedefunsignedcharuint8_t; 本模板不保证完全正确 目录 目录 蓝桥杯嵌入式新板模板创建&简单经验分享 0. RCC 时钟树 1. GPIO 1.1 LED 1.2 KEY 2. LCD显示屏 3. UART串口 4. IIC 4.1 EEPROM 24c02 ...
/* USER CODE BEGIN 0 */volatile uint8_t rx1_len = 0; //接收一帧数据的长度volatile uint8_t recv1_end_flag = 0; //一帧数据接收完成标志uint8_t rx1_buffer[20]={0}; //接收数据缓存数组volatile uint8_t rx3_len = 0; //接收一帧数据的长度volatile uint8_t recv3_end_flag = 0; ...
1.定义接受数组 /*USER CODE BEGIN 0*/uint8_t aRxBuffer[1];/*USER CODE END 0*/ 2.先开启中断,只起一次作用 /*USER CODE BEGIN 2*/HAL_UART_Receive_IT(&huart1,(uint8_t *)aRxBuffer,1);/*USER CODE END 2*/ 3.每次中断触发都要在中断回调函数再此开启串口接收中断 /*USER CODE BEGIN 4...
void USART3_Configuration(u32 bound); void USART1_SendOneData(uint8_t SendOneData); //串口1发送一帧数据 void USART2_SendOneData(uint8_t SendOneData); void USART3_SendOneData(uint8_t SendOneData); void USART1_SendUnfixedData(uint8_t *Buffer, uint8_t Length); void USART2_SendUnfixedDat...
*函 数名: KEY_Scan(uint8_t mode) *功 能: 按键处理函数 *形 参: mode:0 不支持连续按;1 支持连续按 *返 回值: 返回按键值 0:表示未有按键按下 * 1:KEY_RIGHT按下 2:KEY_DOWN按下 * 3:KEY_LEFT按下 4:KEY_UP按下 ***/ uint8_t KEY_Scan(uint8_t mode) { static uint8_t key ...
void OLED_ShowNum(uint8_t x, uint8_t y, unsigned int num, uint8_t len, uint8_t size2) { uint8_t t, temp; uint8_t enshow = 0; for (t = 0; t < len; t++) { temp = (num / oled_pow(10, len - t - 1)) % 10; if (enshow == 0 && t < (len - 1)) { if...
uint16_tval=0;HAL_TIM_PWM_Start(&htimx,TIM_CHANNEL_1);While(){_HAL_TIM_SET_COMPARE(&htimx,TIM_CHANNEL_1,val);_val++;} 3_UART_发送10字符串,仅执行1次(不在while中) //定义两个数组变量Uint8_t T[]=”\nPlease enter10characters:\r\n”;Uint8_t R[20];//串口中断发送/接收aTxSta...
登录后复制/* USER CODE BEGIN 4 */// 捕获中断回调函数,每次捕获到信号就会进入这个回调函数voidHAL_TIM_IC_CaptureCallback(TIM_HandleTypeDef *htim){uint32_tfallingCount =0;// 下降沿计数uint8_ttemp =0;// 判断是否是定时器1的外部捕获口2if(htim->Instance == TIM1) ...
int8_tSTORAGE_GetCapacity_FS(uint8_t lun,uint32_t*block_num,uint16_t*block_size){/* USER CODE BEGIN 3 */*block_num=FLASH_PAGE_NBR;*block_size=FLASH_PAGE_SIZE;return(USBD_OK);/* USER CODE END 3 */} 6 读优盘函数 第六,修改读优盘函数。如下,把目标flash地址中的数据拷贝到buf中。
int8_tSTORAGE_GetCapacity_FS(uint8_tlun,uint32_t*block_num,uint16_t*block_size){/* USER CODE BEGIN 3 */*block_num = FLASH_PAGE_NBR;*block_size = FLASH_PAGE_SIZE;return(USBD_OK);/* USER CODE END 3 */} 6 读优盘函数