#define u8 unsigned char
#define u32 unsigned int
#define u16 unsigned short int
int temp=0;
char spiBuf[10];
u8 Rx_data3=0,Rx_data2=0,Rx_data1=0;
Rx_data3=0x00;
Rx_data2=0x8D;
Rx_data1=0x2C;
sprintf(spiBuf, "%x%x%x\0", Rx_data1, Rx_data2, Rx_data3); //字符串:拼接
temp=strtol(spiBuf,0,16);//字符串:数字转换
参考
stm32常用数据类型 U8、U16、U32:
https://blog.csdn.net/u011642774/article/details/60466101
C语言 字符串和数字转换函数:
https://www.cnblogs.com/kungfupanda/p/3801699.html
u32 code=0;
for(u16 t=0;t<6;t++){//字符转为整数
if((spiBuf[t]>='0')&&(spiBuf[t]<='9'))
code=spiBuf[t]-48+code*16;
if((spiBuf[t]>='A')&&(spiBuf[t]<='F'))
code=spiBuf[t]-65+code*16+10;
if((spiBuf[t]>='a')&&(spiBuf[t]<='f'))
code=spiBuf[t]-97+code*16+10;
}