初始化曝光时间15ms
This commit is contained in:
27
APP/mymain.c
27
APP/mymain.c
@ -23,7 +23,7 @@ uint32_t Receive_Data_Count = 0;
|
||||
uint32_t Last_Receive_Data_Count = 0;
|
||||
|
||||
uint32_t shutter_time = 20;
|
||||
uint32_t mode = 0;
|
||||
uint32_t mode = 1;
|
||||
float Temperature = 0;
|
||||
/* Send_Data_Type
|
||||
* 0 发送原始数据
|
||||
@ -32,7 +32,7 @@ float Temperature = 0;
|
||||
* 3 发送多次均数据
|
||||
* 4 发送滑动平均数据
|
||||
*/
|
||||
uint32_t Send_Data_Type = 0;
|
||||
uint8_t Send_Data_Type = 0;
|
||||
uint32_t sn = 1699;
|
||||
|
||||
void Communication_Init() {
|
||||
@ -78,7 +78,7 @@ void mymain()
|
||||
// __HAL_UART_DISABLE(&huart2);
|
||||
// HAL_UART_Receive_DMA(&huart2, (uint8_t *)USART2_RX_Buffer, USART2_RX_BUFFER_SIZE*2);
|
||||
// USART2->CR3 |= USART_CR3_DMAT; // 启用DMA传输
|
||||
|
||||
Send_Shutter_Time(15);
|
||||
|
||||
// LED_OFF;
|
||||
// // HAL_GPIO_WritePin(GPIOA,GPIO_PIN_2,0);
|
||||
@ -127,9 +127,9 @@ void mymain()
|
||||
}
|
||||
}
|
||||
//按命令发送数据
|
||||
if((Send_Data_Type & 0x8000) !=0)
|
||||
if((Send_Data_Type & 0x80) !=0)
|
||||
{
|
||||
Send_Data_Type = Send_Data_Type & 0x7FFF;
|
||||
Send_Data_Type = Send_Data_Type & 0x7F;
|
||||
uint16_t sgi_result[USART2_RX_BUFFER_SIZE];
|
||||
// printf("AAA");
|
||||
switch (Send_Data_Type)
|
||||
@ -152,7 +152,7 @@ void mymain()
|
||||
Send_Data(0x61,(uint8_t *)Moving_Average_Buffer,515*2);
|
||||
break;
|
||||
}
|
||||
Send_Data_Type = Send_Data_Type & 0x7FFF;
|
||||
Send_Data_Type = Send_Data_Type & 0x7F;
|
||||
}
|
||||
// if ( a == 1300 * 15) {
|
||||
// Temperature = DS18B20_GetTemperature();
|
||||
@ -198,8 +198,6 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
||||
|
||||
void commander_run(void)
|
||||
{
|
||||
|
||||
|
||||
if(g_usart_rx_sta > 7)
|
||||
{
|
||||
uint16_t data_length = g_usart_rx_sta & 0x3fff;
|
||||
@ -246,16 +244,16 @@ void commander_run(void)
|
||||
}
|
||||
//获取曝光时间
|
||||
case 0x53:{
|
||||
uint8_t st[5];
|
||||
uint8_t st[4];
|
||||
// memcpy(st,&shutter_time,4);
|
||||
st[3] = shutter_time & 0xff;
|
||||
st[2] = (shutter_time >> 8) & 0xff;
|
||||
st[1] = (shutter_time >> 16) & 0xff;
|
||||
st[0] = (shutter_time >> 24) & 0xff;
|
||||
|
||||
st[4] = Send_Data_Type & 0x7FFF;
|
||||
|
||||
// printf("shutter_time %d\n",shutter_time);
|
||||
Send_Data(0x53,st,5);
|
||||
Send_Data(0x53,st,4);
|
||||
break;
|
||||
}
|
||||
//获取温度
|
||||
@ -293,7 +291,12 @@ void commander_run(void)
|
||||
}
|
||||
//获取数据
|
||||
case 0x61: {
|
||||
Send_Data_Type = Send_Data_Type | 0x8000;
|
||||
Send_Data_Type = Send_Data_Type | 0x80;
|
||||
break;
|
||||
}
|
||||
case 0x62: {
|
||||
uint8_t d = Send_Data_Type & 0x7F;
|
||||
Send_Data(0x62,&d,1);
|
||||
break;
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user