51uwb.cn
标题:
疑问
[打印本页]
作者:
回家的欲望
时间:
2020-2-11 02:47
标题:
疑问
USART_puts(&rx_buffer[LOCATION_INFO_START_IDX],rx_buffer[LOCATION_INFO_LEN_IDX])这串基站的代码向串口输出什么,有知道的吗
作者:
tuzhuke
时间:
2020-2-11 14:32
USART_puts(&rx_buffer[LOCATION_INFO_START_IDX],rx_buffer[LOCATION_INFO_LEN_IDX]);
void USART_puts(uint8_t *s,uint8_t len)
第一个参数是指针,第二个是数据长度。
rx_buffer是模块通过无线收到的数据包。实际数据包是下面的东西,结合起来看
angle_msg[LOCATION_FLAG_IDX] = 1;
angle_msg[LOCATION_INFO_START_IDX + (len++)] = 'm';
angle_msg[LOCATION_INFO_START_IDX + (len++)] = 'r';
angle_msg[LOCATION_INFO_START_IDX + (len++)] = 0x02;
angle_msg[LOCATION_INFO_START_IDX + (len++)] = TAG_ID;//TAG ID
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)(framenum&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((framenum>>8)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10 >>8)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance2/10)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance2/10 >>8)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance3/10)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance3/10 >>8)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = (uint8)((distance1/10 >>8)&0xFF);
angle_msg[LOCATION_INFO_START_IDX + (len++)] = '\n';
angle_msg[LOCATION_INFO_START_IDX + (len++)] = '\r';
复制代码
作者:
回家的欲望
时间:
2020-2-16 03:38
#define Trigger1_GPIO_PORT GPIOB
#define Trigger1_GPIO_CLK RCC_APB2Periph_GPIOB
#define Trigger1 GPIO_Pin_9
#define Trigger2_GPIO_PORT GPIOB
#define Trigger2_GPIO_CLK RCC_APB2Periph_GPIOB
#define Trigger2 GPIO_Pin_10
#define High(p,i) {p->BSRR=i}
#define LOW(p,i) {p->BRR=i}
#define On1 High(Trigger1_GPIO_PORT,Trigger1)
#define Off1 LOW(Trigger1_GPIO_PORT,Trigger1)
#define On2 High(Trigger2_GPIO_PORT,Trigger2)
#define Off2 LOW(Trigger2_GPIO_PORT,Trigger2)
#define initialize Off1;Off2;SOFT_DELAY
#define serious injury On1;SOFT_DELAY;Off1
#define slight injury On2;SOFT_DELAY;Off2
void Trigger_Config(void)
{ GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(Trigger1_GPIO_CLK |Trigger2_GPIO_CLK,ENABLE);
GPIO_InitStructure.GPIO_Pin=Trigger1|Trigger2;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(Trigger1_GPIO_PORT,&GPIO_InitStructure);
GPIO_Init(Trigger2_GPIO_PORT,&GPIO_InitStructure);
GPIO_RsetBits(Trigger1_GPIO_PORT,Trigger1);
GPIO_RsetBits(Trigger2_GPIO_PORT,Trigger2);
}
作者:
回家的欲望
时间:
2020-2-16 03:38
void Trigger_Config(void)
{ GPIO_InitTypeDef GPIO_InitStructure;
RCC_APB2PeriphClockCmd(Trigger1_GPIO_CLK |Trigger2_GPIO_CLK,ENABLE);
GPIO_InitStructure.GPIO_Pin=Trigger1|Trigger2;
GPIO_InitStructure.GPIO_Mode=GPIO_Mode_Out_PP;
GPIO_InitStructure.GPIO_Speed=GPIO_Speed_50MHz;
GPIO_Init(Trigger1_GPIO_PORT,&GPIO_InitStructure);
GPIO_Init(Trigger2_GPIO_PORT,&GPIO_InitStructure);
GPIO_RsetBits(Trigger1_GPIO_PORT,Trigger1);
GPIO_RsetBits(Trigger2_GPIO_PORT,Trigger2);
}一直报错
作者:
回家的欲望
时间:
2020-2-16 03:39
".\STM3210E-EVAL\STM3210E-EVAL.axf" - 1 Error(s), 21 Warning(s).
作者:
回家的欲望
时间:
2020-2-16 03:50
找到原因了,我把所有关于printf函数的语句都注释掉了
欢迎光临 51uwb.cn (http://51uwb.cn/)
Powered by Discuz! X3.3