当前位置: 首页 > news >正文

Stm32_标准库_16_串口蓝牙模块_手机与蓝牙模块通信_手机传入信息能对芯片时间日期进行更改

实现了手机发送信息给蓝牙模块,程序对数据进行分析拆解,并更新自身数据

main.c:

#include "stm32f10x.h"    // Device header
#include "Delay.h"
#include "OLED.h"
#include "Serial.h"
#include "Time.h"
#include "Function.h"
#include <stdio.h>
#include <stdlib.h>char *News = NULL;//存数据
unsigned int time[] = {22, 59, 30};
unsigned int date[] = {2023, 12, 31};
char month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
unsigned int updateTime[] = {0, 0, 0};
unsigned int updateDate[] = {0, 0, 0};void TIM2_IRQHandler(void){//定时器2//主要运用时间更新if(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET){TIM_ClearITPendingBit(TIM2, TIM_IT_Update);//清除标志位Time_Control(time, month, date);}}int main(void){OLED_Init();//初始化OLEDTime_Init();//开启计时器Serial_Init();//开启串口while(1){uint16_t flag = 0;if(Serial_GetRxFlag() == 1){Delay_ms(1000);//等待数据传输完News = Serial_returnNews();OLED_ShowString(3, 1, News);if((flag = Function_DateCheck(Serial_GetRFlagTime(), Serial_GetFlagDate())) == 0){//至少得有标志符号OLED_ShowString(4, 1, "error");}else{if(flag == 1){if(Function_TimeUpdate(updateTime, time, News) == 1) OLED_ShowString(4, 1, ":RIGHT");//写入else  OLED_ShowString(4, 1, "ERROR"); 									}else{OLED_ShowString(4, 1, "/RIGHT");}Function_ArrayReset(updateTime, updateDate);				}flag = 0;Serial_RESETI();//I至0Serial_GetRxFlag();//制零否者if循环将会被执行两次free(News);//释放空间必须释放否者发生地址紊乱,直接卡机}Time_Show(time);//Time_Show_Date(date);}}

Function.c:

#include "stm32f10x.h"
#include "Serial.h"
#include "OLED.h"
#include "Delay.h"
//一些函数的实现void Function_ArrayClear(char *News){//恢复数组初始化uint16_t i = 0;for(i = 0; i < 100; i ++) News[i] = '\0';
}uint8_t Function_ArrayLength(char * a){//计算数组长度函数uint8_t length = 0;uint8_t i = 0;while(a[i] != '\0'){i ++;length ++;}return length;
}uint8_t Function_DateCheck(uint8_t flagTime, uint8_t flagDate){if(flagDate == flagTime) return 0;if(flagTime == 1) return 1;return 2;
}
uint8_t Function_Numlength(uint16_t num){uint8_t length = 0;if(num == 0) return (uint8_t) 1;while(num > 0){num = num / 10;length = length + 1;}return length;
}
uint8_t Function_TimeDateState(unsigned int *updateTime, char *News){uint8_t cnt = 0;uint8_t i = 0;uint8_t end = Serial_GetI();while(i < end){if(News[i] == ':') {cnt ++;i ++;if(cnt >= 3) return 0;continue;}updateTime[cnt] = updateTime[cnt] * 10 + (News[i] - '0');i ++;}//OLED_ShowNum(2,1,updateTime[2], 3);if(cnt != 2) return 0;//OLED_ShowString(2, 10, "here");//OLED_ShowNum(2,1,, 3);if(Function_Numlength(updateTime[0]) >= 3 || updateTime[0] > 23) return 0;//OLED_ShowString(2, 10, "here");if(Function_Numlength(updateTime[1]) >= 3 || updateTime[1] > 59) return 0;if(Function_Numlength(updateTime[2]) >= 3 || updateTime[2] > 59) return 0;//OLED_ShowString(2, 10, "here");return 1;
}uint8_t Function_TimeUpdate(unsigned int *updateTime, unsigned int *time, char *News){if(Function_TimeDateState(updateTime, News) == 1){uint8_t i = 0;OLED_ShowString(2, 12, "here");while(i < 3){time[i] = updateTime[i];i ++;}return 1;}return 0;
}void Function_ArrayReset(unsigned int *updateTime, unsigned int *updateDate){uint8_t i = 0;while(i < 3){updateDate[i] = 0;updateTime[i] = 0;i ++;}
}

Function.h:

#ifndef __FUNCTION_H
#define __FUNCTION_H
#include "stm32f10x.h"  
#include <stdio.h>void Function_ArrayClear(char *News);
uint8_t Function_ArrayLength(char * a);
uint8_t Function_DateCheck(uint8_t flagDate, uint8_t flagTime);
uint8_t Function_Numlength(uint16_t num);
uint8_t Function_TimeDateState(unsigned int *updateTime, char *News);
uint8_t Function_TimeUpdate(unsigned int *updateTime, unsigned int *time, char *News);
void Function_ArrayReset(unsigned int *updateTime, unsigned int *updateDate);#endif

Time.c:

#include "stm32f10x.h"
#include "OLED.h"TIM_TimeBaseInitTypeDef TIM_TimeBaseInitStructure;
NVIC_InitTypeDef NVIC_InitStructure;
/*初始化通用定时器TIM2*/
void Time_Init(void){RCC_APB1PeriphClockCmd(RCC_APB1Periph_TIM2, ENABLE);//APB1外设开启TIM_InternalClockConfig(TIM2);//选择内部时钟/*初始化时基单元*/TIM_TimeBaseInitStructure.TIM_ClockDivision = TIM_CKD_DIV1;TIM_TimeBaseInitStructure.TIM_CounterMode = TIM_CounterMode_Up;//向上计数TIM_TimeBaseInitStructure.TIM_Period = 10000 - 1;//ARR自动重装TIM_TimeBaseInitStructure.TIM_Prescaler = 7200 - 1;//psc预分频器TIM_TimeBaseInitStructure.TIM_RepetitionCounter = 0;//高级计时器内容直接给零//记录1s TIM_TimeBaseInit(TIM2, &TIM_TimeBaseInitStructure);//刚初始化完就会进中断TIM_ClearFlag(TIM2, TIM_FLAG_Update);//消除中断标志位//使能更新中断TIM_ITConfig(TIM2, TIM_IT_Update, ENABLE);/*配置中断*/NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//选择组2NVIC_InitStructure.NVIC_IRQChannel = TIM2_IRQn;//定时器2在NVIC内的通道NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 1;NVIC_InitStructure.NVIC_IRQChannelSubPriority = 1;NVIC_Init(&NVIC_InitStructure);TIM_Cmd(TIM2, ENABLE);//启动定时器
}void Time_Control(unsigned int *time, char *month, unsigned int *date){//更新时间time[2] = time[2] + 1;if(time[2] >= 60){time[2] = 0;time[1] = time[1] + 1;if(time[1] >= 60){time[1] = 0;time[0] = time[0] + 1;if(time[0] >= 24){time[0] = 0;date[2] = date[2] + 1;if(date[2] >= month[date[1]] + 1){date[2] = 1;date[1] = date[1] + 1;if(date[1] >= 13){date[1] = 1;date[0] = date[0] + 1;if(date[0] >= 9999){date[0] = 2023;}}}}}}}void Time_month2_Control(char *month,unsigned int *date){//判别闰平年 if((date[0] % 4 == 0 && date[0] % 100 != 0 )|| date[0] % 400 == 0) month[2] = 29;else month[2] = 28;
}void Time_Show(unsigned int *time){OLED_ShowNum(1,1,time[0], 2);OLED_ShowString(1, 3, ":");OLED_ShowNum(1,4,time[1], 2);OLED_ShowString(1, 6, ":");OLED_ShowNum(1,7,time[2], 2);
}
void Time_Show_Date(unsigned int *date){OLED_ShowNum(2,1,date[0], 4);OLED_ShowString(2, 5, "/");OLED_ShowNum(2,6,date[1], 2);OLED_ShowString(2, 8, "/");OLED_ShowNum(2,9,date[2], 2);
}

Time.h:

//显示时间&日期
#ifndef __TIME_H
#define __TIME_H
#include "stm32f10x.h"  
#include <stdio.h>void Time_Init(void);
void Time_Control(unsigned int *time, char *month, unsigned int *date);
void Time_month2_Control(char *month,unsigned int *date);
void Time_Show(unsigned int *time);
void Time_Show_Date(unsigned int *date);#endif

Serial.c:

#include "stm32f10x.h"                  // Device header
#include <stdio.h>
#include <stdarg.h>
#include "Delay.h"
#include <stdlib.h>
#include "OLED.h"uint8_t Serial_RxData;//存数据
uint8_t Serial_RxFlag;//标志位
GPIO_InitTypeDef GPIO_InitStructu;//GPIO
USART_InitTypeDef USART_InitStructure;//串口
NVIC_InitTypeDef NVIC_InitStructur;//中断
char news[100] = "";//存数据
uint8_t I = 0;
uint8_t flagDate = 0;//标志是否传入日期数据
uint8_t flagTime = 0;//标志是否传入时间数据void Serial_Init(void)
{RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);GPIO_InitStructu.GPIO_Mode = GPIO_Mode_AF_PP;GPIO_InitStructu.GPIO_Pin = GPIO_Pin_9;GPIO_InitStructu.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructu);GPIO_InitStructu.GPIO_Mode = GPIO_Mode_IPU;GPIO_InitStructu.GPIO_Pin = GPIO_Pin_10;GPIO_InitStructu.GPIO_Speed = GPIO_Speed_50MHz;GPIO_Init(GPIOA, &GPIO_InitStructu);USART_InitStructure.USART_BaudRate = 9600;USART_InitStructure.USART_HardwareFlowControl = USART_HardwareFlowControl_None;USART_InitStructure.USART_Mode = USART_Mode_Tx | USART_Mode_Rx;USART_InitStructure.USART_Parity = USART_Parity_No;USART_InitStructure.USART_StopBits = USART_StopBits_1;USART_InitStructure.USART_WordLength = USART_WordLength_8b;USART_Init(USART1, &USART_InitStructure);USART_ITConfig(USART1, USART_IT_RXNE, ENABLE);NVIC_PriorityGroupConfig(NVIC_PriorityGroup_2);//通道NVIC_InitStructur.NVIC_IRQChannel = USART1_IRQn;//中断通道NVIC_InitStructur.NVIC_IRQChannelCmd = ENABLE;NVIC_InitStructur.NVIC_IRQChannelPreemptionPriority = 3;NVIC_InitStructur.NVIC_IRQChannelSubPriority = 1;NVIC_Init(&NVIC_InitStructur);USART_Cmd(USART1, ENABLE);
}uint8_t Serial_GetRxFlag(void)//读取标志位后自动青除
{if (Serial_RxFlag == 1){Serial_RxFlag = 0;return 1;}return 0;
}uint8_t Serial_GetFlagDate(void)//读取标志位后自动青除
{if (flagDate == 1){flagDate = 0;return 1;}return 0;
}uint8_t Serial_GetRFlagTime(void)//读取标志位后自动青除
{if (flagTime == 1){flagTime = 0;return 1;}return 0;
}void Serial_GetRxFlag_SET(void){Serial_RxFlag = 1;
}char * Serial_returnNews(void){//返还一个数组char * array;//int j = I;uint8_t i = 0;array = (char *) malloc(sizeof(char) * 100);while(i < I){if(news[i] == '/') flagDate = 1;if(news[i] == ':') flagTime = 1;array[i] = news[i];i ++;}return array;
}void Serial_RESETI(void){//初始化II = 0;
}uint8_t Serial_GetI(void){//返回Ireturn I;
}void USART1_IRQHandler(void)//中断函数
{if (USART_GetITStatus(USART1, USART_IT_RXNE) == SET){news[I] = USART_ReceiveData(USART1);//读数据Serial_RxFlag = 1;//至标志位为有数据I ++;USART_ClearITPendingBit(USART1, USART_IT_RXNE);}
}

Serial.h:

#ifndef __SERIAL_H
#define __SERIAL_H
#include "stm32f10x.h"  
#include <stdio.h>void Serial_Init(void);
uint8_t Serial_GetRxFlag(void);
uint8_t Serial_GetRxData(void);
void Serial_GetRxFlag_SET(void);
char * Serial_returnNews(void);
void Serial_RESETI(void);
uint8_t Serial_GetI(void);
uint8_t Serial_GetRFlagTime(void);
uint8_t Serial_GetFlagDate(void);#endif

效果:

在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
时间 + 日期

main.c:

#include "stm32f10x.h"    // Device header
#include "Delay.h"
#include "OLED.h"
#include "Serial.h"
#include "Time.h"
#include "Function.h"
#include <stdio.h>
#include <stdlib.h>char *News = NULL;//存数据
unsigned int time[] = {22, 59, 30};
unsigned int date[] = {2023, 12, 31};
char month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
unsigned int updateTime[] = {0, 0, 0};
unsigned int updateDate[] = {0, 0, 0};void TIM2_IRQHandler(void){//定时器2//主要运用时间更新if(TIM_GetITStatus(TIM2, TIM_IT_Update) == SET){TIM_ClearITPendingBit(TIM2, TIM_IT_Update);//清除标志位Time_Control(time, month, date);}}int main(void){OLED_Init();//初始化OLEDTime_Init();//开启计时器Serial_Init();//开启串口while(1){uint16_t flag = 0;Time_month2_Control(month, date); if(Serial_GetRxFlag() == 1){Delay_ms(1000);//等待数据传输完News = Serial_returnNews();OLED_ShowString(3, 1, News);if((flag = Function_DateCheck(Serial_GetRFlagTime(), Serial_GetFlagDate())) == 0){//至少得有标志符号OLED_ShowString(4, 1, "error");}else{if(flag == 1){if(Function_TimeUpdate(updateTime, time, News) == 1) OLED_ShowString(4, 1, ":RIGHT");//写入else  OLED_ShowString(4, 1, "ERROR"); 									}else{if(Function_DateUpdate(updateDate,date,News) == 1)OLED_ShowString(4, 1, "/RIGHT");elseOLED_ShowString(4, 1, "ERROr");}Function_ArrayReset(updateTime, updateDate);				}Serial_RESETI();//I至0Serial_GetRxFlag();//制零否者if循环将会被执行两次free(News);//释放空间必须释放否者发生地址紊乱,直接卡机}Time_Show(time);Time_Show_Date(date);}}

Function.c:

#include "stm32f10x.h"
#include "Serial.h"
#include "OLED.h"
#include "Delay.h"
//一些函数的实现void Function_ArrayClear(char *News){//恢复数组初始化uint16_t i = 0;for(i = 0; i < 100; i ++) News[i] = '\0';
}uint8_t Function_ArrayLength(char * a){//计算数组长度函数uint8_t length = 0;uint8_t i = 0;while(a[i] != '\0'){i ++;length ++;}return length;
}uint8_t Function_DateCheck(uint8_t flagTime, uint8_t flagDate){if(flagDate == flagTime) return 0;if(flagTime == 1) return 1;return 2;
}
uint8_t Function_Numlength(uint16_t num){uint8_t length = 0;if(num == 0) return (uint8_t) 1;while(num > 0){num = num / 10;length = length + 1;}return length;
}
uint8_t Function_TimeDateState(unsigned int *updateTime, char *News){uint8_t cnt = 0;uint8_t i = 0;uint8_t end = Serial_GetI();while(i < end){if(News[i] == ':') {cnt ++;i ++;if(cnt >= 3) return 0;continue;}updateTime[cnt] = updateTime[cnt] * 10 + (News[i] - '0');i ++;}if(cnt != 2) return 0;if(Function_Numlength(updateTime[0]) >= 3 || updateTime[0] > 23) return 0;if(Function_Numlength(updateTime[1]) >= 3 || updateTime[1] > 59) return 0;if(Function_Numlength(updateTime[2]) >= 3 || updateTime[2] > 59) return 0;return 1;
}uint8_t Function_TimeUpdate(unsigned int *updateTime, unsigned int *time, char *News){if(Function_TimeDateState(updateTime, News) == 1){uint8_t i = 0;//OLED_ShowString(2, 12, "here");while(i < 3){time[i] = updateTime[i];i ++;}return 1;}return 0;
}void Function_ArrayReset(unsigned int *updateTime, unsigned int *updateDate){uint8_t i = 0;while(i < 3){updateDate[i] = 0;updateTime[i] = 0;i ++;}
}uint8_t Function_DateState(unsigned int *updateDate, char *News){uint8_t cnt = 0;uint8_t i = 0;uint8_t end = Serial_GetI();char month[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};while(i < end){if(News[i] == '/') {cnt ++;i ++;if(cnt >= 3) {return 0;}continue;}updateDate[cnt] = updateDate[cnt]* 10 + (News[i] - '0');i ++;}if(cnt != 2) return 0;if(Function_Numlength(updateDate[0]) >= 5 || updateDate[0] > 9999 || updateDate[0] == 0) return 0;if((updateDate[0] % 4 == 0 && updateDate[0] % 100 != 0 )|| updateDate[0] % 400 == 0) month[2] = 29;else month[2] = 28;if(Function_Numlength(updateDate[1]) >= 3 || updateDate[1] > 12 || updateDate[1] == 0) return 0;if(Function_Numlength(updateDate[2]) >= 3 || updateDate[2] > month[updateDate[1]]|| updateDate[2] == 0) return 0;return 1;}uint8_t Function_DateUpdate(unsigned int *updateDate, unsigned int *date, char *News){if(Function_DateState(updateDate, News) == 1){uint8_t i = 0;while(i < 3){date[i] = updateDate[i];i ++;}return 1;}return 0;
}

Function.h:

#ifndef __FUNCTION_H
#define __FUNCTION_H
#include "stm32f10x.h"  
#include <stdio.h>void Function_ArrayClear(char *News);
uint8_t Function_ArrayLength(char * a);
uint8_t Function_DateCheck(uint8_t flagDate, uint8_t flagTime);
uint8_t Function_Numlength(uint16_t num);
uint8_t Function_TimeDateState(unsigned int *updateTime, char *News);
uint8_t Function_TimeUpdate(unsigned int *updateTime, unsigned int *time, char *News);
void Function_ArrayReset(unsigned int *updateTime, unsigned int *updateDate);
uint8_t Function_DateState(unsigned int *updateDate, char *News);
uint8_t Function_DateUpdate(unsigned int *updateDate, unsigned int *date, char *News);#endif

效果:

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述
在这里插入图片描述

相关文章:

Stm32_标准库_16_串口蓝牙模块_手机与蓝牙模块通信_手机传入信息能对芯片时间日期进行更改

实现了手机发送信息给蓝牙模块&#xff0c;程序对数据进行分析拆解&#xff0c;并更新自身数据 main.c: #include "stm32f10x.h" // Device header #include "Delay.h" #include "OLED.h" #include "Serial.h" #include "Ti…...

137.【SpringCloud-快速搭建】

微服务框架搭建 (一)、SpringCloud-Parent1.创建一个SpringBoot项目2.导入我们的依赖 (二)、SpringCloud-API (实体类)1.创建一个SpringBoot项目2.导入我们的依赖3.创建我们的实体类 (三)、SpringCloud-dept (业务A)1.创建一个SpringBoot项目2.导入我们的依赖3.配置我们的配置信…...

计算机网络第2章-CDN(4)

视频流和内容分发网 HTTP流和DASH 在HTTP流中&#xff0c;视频只是存储在HTTP服务器中作为一个普通的文件&#xff0c;每个文件有有一个特定的URL。当用户要看视频时&#xff0c;客户与服务器之间创建一个TCP连接并发送HTTP GET请求。 HTTP流具有严重缺陷&#xff0c;即所有…...

Linux常见的指令合集

Linux指令合集 认识linuxlinux基础指令1.pwd 命令2. ls 命令3.cd 命令4. man 命令5. grep 命令6. ps 命令7. kill 命令8. netstat 命令9. date 查看当前系统时间10. echo 打印选项 -e linux文件操作指令1. mkdir 命令2. rmdir 命令3. touch 命令4. rm 命令5. mv 命令6. cp 命令…...

字符串_哈希

参考文章&#xff1a; E. Compress Words(字符串hash)_z听歌的小孩z的博客-CSDN博客 字符串哈希 - OI Wiki (oi-wiki.org) 板子&#xff1a; #include<bits/stdc.h> using namespace std; const int N2e450; typedef long long ll; const int mod1e97; typedef unsig…...

python 之enumerate()函数

文章目录 enumerate() 是 Python 中的一个内置函数&#xff0c;它用于在遍历可迭代对象&#xff08;如列表、元组、字符串等&#xff09;时同时获取每个元素的索引和值。这个函数非常有用&#xff0c;因为它允许您在迭代过程中轻松地访问元素的索引&#xff0c;而不需要手动维护…...

【LeetCode刷题(数据结构与算法)】:用队列实现栈

请你仅使用两个队列实现一个后入先出&#xff08;LIFO&#xff09;的栈&#xff0c;并支持普通栈的全部四种操作&#xff08;push、top、pop 和 empty&#xff09; 实现 MyStack 类&#xff1a; void push(int x) 将元素 x 压入栈顶 int pop() 移除并返回栈顶元素 int top() 返…...

“客户端到服务器的数据传递”和“服务器上的数据传递”这两种数据传递的方式的区别

“客户端到服务器的数据传递”和“服务器上的数据传递”这两种数据传递方式的主要区别如下&#xff1a; 数据的流动方向&#xff1a; 在“客户端到服务器的数据传递”中&#xff0c;数据是从客户端&#xff08;如浏览器&#xff09;流向服务器。在“服务器上的数据传递”中&…...

LCR 181 字符串中的单词反转

​​题目来源&#xff1a; leetcode题目&#xff0c;网址&#xff1a;LCR 181. 字符串中的单词反转 - 力扣&#xff08;LeetCode&#xff09; 解题思路&#xff1a; 倒叙遍历&#xff0c;获得每个单词的起始位置与终止位置&#xff0c;然后将每次遇到的单词插入结果中。 解题…...

百度OCR识别图片文本字符串——物联网上位机软件

一、开发背景 根据项目需求&#xff0c;我们需要完成LED显示屏实时显示歌词的效果。最优的方法是调用歌曲播放器的API获取歌词&#xff0c;但是由于这个开发资格不是很好申请&#xff0c;因此我们采用其他方案&#xff0c;即通过OCR识别获取歌词&#xff0c;并投射到LED显示屏上…...

JAVA学习(6)-全网最详细~

&#x1f308;write in front&#x1f308; &#x1f9f8;大家好&#xff0c;我是Aileen&#x1f9f8;.希望你看完之后&#xff0c;能对你有所帮助&#xff0c;不足请指正&#xff01;共同学习交流. &#x1f194;本文由Aileen_0v0&#x1f9f8; 原创 CSDN首发&#x1f412; 如…...

睿趣科技:未来抖音开网店还有前景吗

随着科技的快速发展&#xff0c;电商平台已经成为了人们生活中不可或缺的一部分。在中国&#xff0c;抖音作为一个短视频平台&#xff0c;近年来迅速崛起&#xff0c;吸引了大量的用户和商家。那么&#xff0c;在未来&#xff0c;抖音是否还能为商家提供一个有效的电商平台呢?…...

第六章 应用层 | 计算机网络(谢希仁 第八版)

文章目录 第六章 应用层6.1 域名系统DNS6.1.1 域名系统概述6.1.2 互联网的域名结构6.1.3 域名服务器 6.2 文件传送协议6.2.1 FTP概述6.2.2 FTP的基本工作原理6.2.3 简单文件传送协议TFTP 6.3 远程终端协议TELNET6.4 万维网www6.4.1 万维网概述6.4.2 统一资源定位符URL6.4.3 超文…...

c++ lambda 表达式

1. 简介 lambda&#xff08;匿名函数&#xff09;是C11引入的一种函数对象&#xff0c;它允许我们在需要函数的地方创建一个临时的、匿名的函数。lambda表达式表示一个可以执行的代码单元&#xff0c;可以理解为一个未命名的内联函数。Lambda函数可以用于简化代码、提高可读性…...

Go语言入门心法(七): 并发与通道

Go语言入门心法(一): 基础语法 Go语言入门心法(二): 结构体 Go语言入门心法(三): 接口 Go语言入门心法(四): 异常体系 Go语言入门心法(五): 函数 一: go语言并发与通道...

前端组件封装:构建模块化、可维护和可重用的前端应用

前端组件封装&#xff1a;构建模块化、可维护和可重用的前端应用 前端开发领域的快速演进已经将前端应用的规模和复杂性提升到了一个新的水平。在这个背景下&#xff0c;前端组件封装成为了一项关键实践&#xff0c;旨在构建模块化、可维护和可重用的前端应用。在本文中&#…...

GPT绘制流程图咒语

【咒语】下面是我的一篇论文选取部分&#xff0c;为了让读者更好理解&#xff0c;我准备画一张图&#xff0c;请你阅读后为我设计一下这个图应该怎么画&#xff0c;更有说服力&#xff0c;更容易理解 论文片段&#xff1a; 多模态数据融合研究的基础在于有效的数据采集。首先&a…...

【扩散模型从原理到实战】Chapter1 扩散模型简介

文章目录 1.1 扩散模型的原理生成模型扩散过程DDPM的扩散过程前向过程反向过程优化目标 1.2 扩散模型的发展开始扩散&#xff1a;DDPM加速生成&#xff1a;采样器刷新记录&#xff1a;基于CLIP的多模态图像生成引爆网络&#xff1a;基于CLIP的多模态图像生成再次“出圈”&#…...

使用轮廓分数提升时间序列聚类的表现

我们将使用轮廓分数和一些距离指标来执行时间序列聚类实验&#xff0c;并且进行可视化 让我们看看下面的时间序列: 如果沿着y轴移动序列添加随机噪声&#xff0c;并随机化这些序列&#xff0c;那么它们几乎无法分辨&#xff0c;如下图所示-现在很难将时间序列列分组为簇: 上面…...

蔬菜水果生鲜配送团购商城小程序的作用是什么

蔬菜水果是人们生活所需品&#xff0c;从业者众多&#xff0c;无论小摊贩还是超市商场都有不少人每天光临&#xff0c;当然这些只是自然流量&#xff0c;在实际经营中&#xff0c;蔬菜水果商家还是面临着一些难题。 对蔬菜水果商家而言&#xff0c;线下门店是重要的&#xff0…...

XML Group端口详解

在XML数据映射过程中&#xff0c;经常需要对数据进行分组聚合操作。例如&#xff0c;当处理包含多个物料明细的XML文件时&#xff0c;可能需要将相同物料号的明细归为一组&#xff0c;或对相同物料号的数量进行求和计算。传统实现方式通常需要编写脚本代码&#xff0c;增加了开…...

YSYX学习记录(八)

C语言&#xff0c;练习0&#xff1a; 先创建一个文件夹&#xff0c;我用的是物理机&#xff1a; 安装build-essential 练习1&#xff1a; 我注释掉了 #include <stdio.h> 出现下面错误 在你的文本编辑器中打开ex1文件&#xff0c;随机修改或删除一部分&#xff0c;之后…...

HTML 列表、表格、表单

1 列表标签 作用&#xff1a;布局内容排列整齐的区域 列表分类&#xff1a;无序列表、有序列表、定义列表。 例如&#xff1a; 1.1 无序列表 标签&#xff1a;ul 嵌套 li&#xff0c;ul是无序列表&#xff0c;li是列表条目。 注意事项&#xff1a; ul 标签里面只能包裹 li…...

django filter 统计数量 按属性去重

在Django中&#xff0c;如果你想要根据某个属性对查询集进行去重并统计数量&#xff0c;你可以使用values()方法配合annotate()方法来实现。这里有两种常见的方法来完成这个需求&#xff1a; 方法1&#xff1a;使用annotate()和Count 假设你有一个模型Item&#xff0c;并且你想…...

力扣-35.搜索插入位置

题目描述 给定一个排序数组和一个目标值&#xff0c;在数组中找到目标值&#xff0c;并返回其索引。如果目标值不存在于数组中&#xff0c;返回它将会被按顺序插入的位置。 请必须使用时间复杂度为 O(log n) 的算法。 class Solution {public int searchInsert(int[] nums, …...

省略号和可变参数模板

本文主要介绍如何展开可变参数的参数包 1.C语言的va_list展开可变参数 #include <iostream> #include <cstdarg>void printNumbers(int count, ...) {// 声明va_list类型的变量va_list args;// 使用va_start将可变参数写入变量argsva_start(args, count);for (in…...

rknn toolkit2搭建和推理

安装Miniconda Miniconda - Anaconda Miniconda 选择一个 新的 版本 &#xff0c;不用和RKNN的python版本保持一致 使用 ./xxx.sh进行安装 下面配置一下载源 # 清华大学源&#xff08;最常用&#xff09; conda config --add channels https://mirrors.tuna.tsinghua.edu.cn…...

机器学习复习3--模型评估

误差与过拟合 我们将学习器对样本的实际预测结果与样本的真实值之间的差异称为&#xff1a;误差&#xff08;error&#xff09;。 误差定义&#xff1a; ①在训练集上的误差称为训练误差&#xff08;training error&#xff09;或经验误差&#xff08;empirical error&#x…...

JVM——对象模型:JVM对象的内部机制和存在方式是怎样的?

引入 在Java的编程宇宙中&#xff0c;“Everything is object”是最核心的哲学纲领。当我们写下new Book()这样简单的代码时&#xff0c;JVM正在幕后构建一个复杂而精妙的“数据实体”——对象。这个看似普通的对象&#xff0c;实则是JVM内存管理、类型系统和多态机制的基石。…...

CodeBuddy一腾讯内部已有超过 85% 的程序员正在使用de编程工具

大家好&#xff0c;我是程序员500佰&#xff0c;目前正在前往独立开发路线&#xff0c;我会在这里分享关于编程技术、独立开发、技术资讯以及编程感悟等内容。 如果本文能给你提供启发和帮助&#xff0c;还请留下你的一健三连&#xff0c;给我一些鼓励&#xff0c;谢谢。 本文直…...