|
@@ -58,6 +58,7 @@ DMA_HandleTypeDef hdma_usart3_rx;
|
|
|
/* USER CODE BEGIN PV */
|
|
/* USER CODE BEGIN PV */
|
|
|
uint8_t rx_buf[100] = {0};
|
|
uint8_t rx_buf[100] = {0};
|
|
|
uint8_t rx_buf_uart2[100] = {0};
|
|
uint8_t rx_buf_uart2[100] = {0};
|
|
|
|
|
+uint8_t rx_buf_uart2_DMA[100] = {0};
|
|
|
uint8_t totalData[120][50] = {0};
|
|
uint8_t totalData[120][50] = {0};
|
|
|
uint8_t uart2_rx_byte[10] = {0};
|
|
uint8_t uart2_rx_byte[10] = {0};
|
|
|
uint8_t loraSendNextDataFlag = 0;
|
|
uint8_t loraSendNextDataFlag = 0;
|
|
@@ -247,7 +248,7 @@ int main(void)
|
|
|
// // HAL_UART_Receive_IT(&huart2, uart2_rx_byte, 7);
|
|
// // HAL_UART_Receive_IT(&huart2, uart2_rx_byte, 7);
|
|
|
// // 使能 USART2 空闲中断
|
|
// // 使能 USART2 空闲中断
|
|
|
__HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
|
|
__HAL_UART_ENABLE_IT(&huart3, UART_IT_IDLE);
|
|
|
- HAL_UART_Receive_DMA(&huart2, rx_buf_uart2, sizeof(rx_buf_uart2));
|
|
|
|
|
|
|
+ HAL_UART_Receive_DMA(&huart2, rx_buf_uart2_DMA, sizeof(rx_buf_uart2_DMA));
|
|
|
// HAL_UART_Receive_IT(&huart2, uart2_rx_byte, 7);
|
|
// HAL_UART_Receive_IT(&huart2, uart2_rx_byte, 7);
|
|
|
// 使能 USART2 空闲中断
|
|
// 使能 USART2 空闲中断
|
|
|
__HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE);
|
|
__HAL_UART_ENABLE_IT(&huart2, UART_IT_IDLE);
|
|
@@ -292,13 +293,6 @@ int main(void)
|
|
|
printf("设备地址:0x%02X%02X\n", deviceInfo.loraDeviceAddress_H, deviceInfo.loraDeviceAddress_L);
|
|
printf("设备地址:0x%02X%02X\n", deviceInfo.loraDeviceAddress_H, deviceInfo.loraDeviceAddress_L);
|
|
|
uint8_t i = 0;
|
|
uint8_t i = 0;
|
|
|
uint8_t ledShanshuo = 0;
|
|
uint8_t ledShanshuo = 0;
|
|
|
- // HAL_GPIO_WritePin(PowerLED_GPIO_Port, PowerLED_Pin, GPIO_PIN_RESET);//亮灯
|
|
|
|
|
- // HAL_Delay(2000);
|
|
|
|
|
- // HAL_GPIO_WritePin(PowerLED_GPIO_Port, PowerLED_Pin, GPIO_PIN_SET);//亮灯
|
|
|
|
|
- // HAL_Delay(2000);
|
|
|
|
|
- // HAL_GPIO_WritePin(PowerLED_GPIO_Port, PowerLED_Pin, GPIO_PIN_RESET);//亮灯
|
|
|
|
|
- // HAL_Delay(2000);
|
|
|
|
|
- // HAL_GPIO_WritePin(PowerLED_GPIO_Port, PowerLED_Pin, GPIO_PIN_SET);//亮灯
|
|
|
|
|
while (1)
|
|
while (1)
|
|
|
{
|
|
{
|
|
|
/* USER CODE END WHILE */
|
|
/* USER CODE END WHILE */
|
|
@@ -315,12 +309,10 @@ int main(void)
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (ledShanshuo != now.seconds) {
|
|
if (ledShanshuo != now.seconds) {
|
|
|
- HAL_GPIO_TogglePin(PowerLED_GPIO_Port, PowerLED_Pin);
|
|
|
|
|
ledShanshuo = now.seconds;
|
|
ledShanshuo = now.seconds;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
if (!sosState) {
|
|
if (!sosState) {
|
|
|
- HAL_GPIO_WritePin(PowerLED_GPIO_Port, PowerLED_Pin, GPIO_PIN_SET);
|
|
|
|
|
E52_Heartbeat_Fun();
|
|
E52_Heartbeat_Fun();
|
|
|
printf("SOS中\r\n");
|
|
printf("SOS中\r\n");
|
|
|
|
|
|
|
@@ -369,7 +361,6 @@ int main(void)
|
|
|
}
|
|
}
|
|
|
uint8_t count = 0;
|
|
uint8_t count = 0;
|
|
|
while(count < 10) {
|
|
while(count < 10) {
|
|
|
- HAL_GPIO_TogglePin(PowerLED_GPIO_Port, PowerLED_Pin);
|
|
|
|
|
if (HAL_GPIO_ReadPin(JUGE_PIN_GPIO_Port, JUGE_PIN_Pin) == GPIO_PIN_RESET) {
|
|
if (HAL_GPIO_ReadPin(JUGE_PIN_GPIO_Port, JUGE_PIN_Pin) == GPIO_PIN_RESET) {
|
|
|
powerOff();
|
|
powerOff();
|
|
|
break;
|
|
break;
|