From bb0c36e3c19b4aac1a319ce707a9b7ae32df8a6d Mon Sep 17 00:00:00 2001 From: mculover666 <2412828003@qq.com> Date: Fri, 19 Jun 2020 20:06:38 +0800 Subject: [PATCH] add pm2d5 to lorawam project --- .../BSP/Hardware/PM25/sensor_parser.c | 337 ++++++++++++++++++ .../BSP/Hardware/PM25/sensor_parser.h | 54 +++ board/RHF0M0E5_STM32WLE5xx/BSP/Inc/usart.h | 3 +- .../LoRaWAN/Mac/region/RegionCN470.h | 4 +- board/RHF0M0E5_STM32WLE5xx/BSP/Src/main.c | 2 +- board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c | 6 +- .../BSP/Src/stm32wlxx_it.c | 29 +- board/RHF0M0E5_STM32WLE5xx/BSP/Src/usart.c | 90 ++++- .../KEIL/lorawan/App/Commissioning.h | 17 +- .../KEIL/lorawan/App/app_lorawan.c | 141 ++++++-- .../KEIL/lorawan/App/app_system.c | 3 +- .../KEIL/lorawan/TencentOS_Tiny.uvoptx | 299 ++++++++-------- .../KEIL/lorawan/TencentOS_Tiny.uvprojx | 44 ++- 13 files changed, 806 insertions(+), 223 deletions(-) create mode 100644 board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.c create mode 100644 board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.h diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.c new file mode 100644 index 00000000..675b690c --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.c @@ -0,0 +1,337 @@ +/*---------------------------------------------------------------------------- + * Tencent is pleased to support the open source community by making TencentOS + * available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * If you have downloaded a copy of the TencentOS binary from Tencent, please + * note that the TencentOS binary is licensed under the BSD 3-Clause License. + * + * If you have downloaded a copy of the TencentOS source code from Tencent, + * please note that TencentOS source code is licensed under the BSD 3-Clause + * License, except for the third-party components listed below which are + * subject to different license terms. Your integration of TencentOS into your + * own projects may require compliance with the BSD 3-Clause License, as well + * as the other licenses applicable to the third-party components included + * within TencentOS. + *---------------------------------------------------------------------------*/ + +#include "sensor_parser.h" + +__STATIC__ shell_ctl_t shell_ctl; + +__STATIC__ k_stack_t shell_parser_task_stack[SHELL_PARSER_TASK_STACK_SIZE]; + +__STATIC__ int shell_getchar(void) +{ + uint8_t chr; + k_err_t err; + + if (tos_sem_pend(&SHELL_CTL->shell_rx_sem, TOS_TIME_FOREVER) != K_ERR_NONE) { + return -1; + } + + err = tos_chr_fifo_pop(&SHELL_CTL->shell_rx_fifo, &chr); + + return err == K_ERR_NONE ? chr : -1; +} + +typedef struct sensor_frame_st { + uint16_t len; + uint16_t data1; + uint16_t data2; + uint16_t data3; + uint16_t data4; + uint16_t data5; + uint16_t data6; + uint16_t data7; + uint16_t data8; + uint16_t data9; + uint16_t data10; + uint16_t data11; + uint16_t data12; + uint16_t data13; + uint16_t chk_sum; + + uint8_t len_h; + uint8_t len_l; + + uint8_t data1_h; + uint8_t data1_l; + + uint8_t data2_h; + uint8_t data2_l; + + uint8_t data3_h; + uint8_t data3_l; + + uint8_t data4_h; + uint8_t data4_l; + + uint8_t data5_h; + uint8_t data5_l; + + uint8_t data6_h; + uint8_t data6_l; + + uint8_t data7_h; + uint8_t data7_l; + + uint8_t data8_h; + uint8_t data8_l; + + uint8_t data9_h; + uint8_t data9_l; + + uint8_t data10_h; + uint8_t data10_l; + + uint8_t data11_h; + uint8_t data11_l; + + uint8_t data12_h; + uint8_t data12_l; + + uint8_t data13_h; + uint8_t data13_l; + + uint8_t chk_sum_h; + uint8_t chk_sum_l; +} __PACKED__ sensor_frame_t; + +extern k_mail_q_t mail_q; + +k_tick_t last_report = 0; + +int read_frame(sensor_frame_t *frame) +{ + frame->len_h = shell_getchar(); + frame->len_l = shell_getchar(); + + frame->data1_h = shell_getchar(); + frame->data1_l = shell_getchar(); + + frame->data2_h = shell_getchar(); + frame->data2_l = shell_getchar(); + + frame->data3_h = shell_getchar(); + frame->data3_l = shell_getchar(); + + frame->data4_h = shell_getchar(); + frame->data4_l = shell_getchar(); + + frame->data5_h = shell_getchar(); + frame->data5_l = shell_getchar(); + + frame->data6_h = shell_getchar(); + frame->data6_l = shell_getchar(); + + frame->data7_h = shell_getchar(); + frame->data7_l = shell_getchar(); + + frame->data8_h = shell_getchar(); + frame->data8_l = shell_getchar(); + + frame->data9_h = shell_getchar(); + frame->data9_l = shell_getchar(); + + frame->data10_h = shell_getchar(); + frame->data10_l = shell_getchar(); + + frame->data11_h = shell_getchar(); + frame->data11_l = shell_getchar(); + + frame->data12_h = shell_getchar(); + frame->data12_l = shell_getchar(); + + frame->data13_h = shell_getchar(); + frame->data13_l = shell_getchar(); + + frame->chk_sum_h = shell_getchar(); + frame->chk_sum_l = shell_getchar(); + + + frame->len = (frame->len_h << 8) | frame->len_l; + frame->data1 = (frame->data1_h << 8) | frame->data1_l; + frame->data2 = (frame->data2_h << 8) | frame->data2_l; + frame->data3 = (frame->data3_h << 8) | frame->data3_l; + frame->data4 = (frame->data4_h << 8) | frame->data4_l; + frame->data5 = (frame->data5_h << 8) | frame->data5_l; + frame->data6 = (frame->data6_h << 8) | frame->data6_l; + frame->data7 = (frame->data7_h << 8) | frame->data7_l; + frame->data8 = (frame->data8_h << 8) | frame->data8_l; + frame->data9 = (frame->data9_h << 8) | frame->data9_l; + frame->data10 = (frame->data10_h << 8) | frame->data10_l; + frame->data11 = (frame->data11_h << 8) | frame->data11_l; + frame->data12 = (frame->data12_h << 8) | frame->data12_l; + frame->data13 = (frame->data13_h << 8) | frame->data13_l; + frame->chk_sum = (frame->chk_sum_h << 8) | frame->chk_sum_l; + + + uint16_t chsum; + chsum = frame->len_h + + frame->len_l + + frame->data1_h + + frame->data1_l + + frame->data2_h + + frame->data2_l + + frame->data3_h + + frame->data3_l + + frame->data4_h + + frame->data4_l + + frame->data5_h + + frame->data5_l + + frame->data6_h + + frame->data6_l + + frame->data7_h + + frame->data7_l + + frame->data8_h + + frame->data8_l + + frame->data9_h + + frame->data9_l + + frame->data10_h + + frame->data10_l + + frame->data11_h + + frame->data11_l + + frame->data12_h + + frame->data12_l + + frame->data13_h + + frame->data13_l; + + if (chsum + 0x42 + 0x4d != frame->chk_sum) { + return -1; + } + + k_tick_t now = tos_systick_get(); + if (last_report == 0 || now - last_report >= 15000) { + last_report = now; + + printf("data1: %d\n", frame->data1); + printf("data2: %d\n", frame->data2); + printf("data3: %d\n", frame->data3); + printf("data4: %d\n", frame->data4); + printf("data5: %d\n", frame->data5); + printf("data6: %d\n", frame->data6); + printf("data7: %d\n", frame->data7); + printf("data8: %d\n", frame->data8); + printf("data9: %d\n", frame->data9); + printf("data10: %d\n", frame->data10); + printf("data11: %d\n", frame->data11); + printf("data12: %d\n", frame->data12); + printf("data13: %d\n", frame->data13); + printf("\n\n"); + + return 0; + } + + return -1; +} + +sensor_frame_t frame; + +__STATIC__ int shell_readline(void) +{ + int chr, last_chr = 0; + char *buf = SHELL_CTL->cmd_buffer; + + while (K_TRUE) { + if (buf - SHELL_CTL->cmd_buffer >= (SHELL_CTL->cmd_buffer_size - 1)) { + return -1; + } + + chr = shell_getchar(); + if (chr < 0) { + return -1; + } + + if (chr == 0x4d && last_chr == 0x42) { + if (read_frame(&frame) == 0) { + tos_mail_q_post(&mail_q, &frame.data1_h, 13 * 2); + } + } + + *buf++ = chr; + last_chr = chr; + } +} + + +__STATIC__ void shell_parser(void *arg) +{ + while (K_TRUE) { + shell_readline(); + } +} + +__API__ int tos_shell_init(char *cmd_buf, int cmd_buf_size, shell_output_t output) +{ + void *buffer = K_NULL; + + TOS_PTR_SANITY_CHECK_RC(cmd_buf, -1); + TOS_PTR_SANITY_CHECK_RC(output, -1); + + memset(SHELL_CTL, 0, sizeof(shell_ctl_t)); + + SHELL_CTL->cmd_buffer = cmd_buf; + SHELL_CTL->cmd_buffer_size = cmd_buf_size; + SHELL_CTL->output = output; + + buffer = tos_mmheap_alloc(cmd_buf_size * 2); + if (!buffer) { + return -1; + } + + SHELL_CTL->shell_rx_fifo_buffer = (uint8_t *)buffer; + tos_chr_fifo_create(&SHELL_CTL->shell_rx_fifo, buffer, cmd_buf_size * 2); + + if (tos_sem_create(&SHELL_CTL->shell_rx_sem, (k_sem_cnt_t)0u) != K_ERR_NONE) { + goto errout0; + } + + if (tos_task_create(&SHELL_CTL->parser, "shell_parser", shell_parser, + K_NULL, SHELL_PARSER_TASK_PRIO, shell_parser_task_stack, + SHELL_PARSER_TASK_STACK_SIZE, 0) != K_ERR_NONE) { + goto errout1; + } + + return 0; + +errout1: + tos_sem_destroy(&SHELL_CTL->shell_rx_sem); + +errout0: + tos_mmheap_free(SHELL_CTL->shell_rx_fifo_buffer); + SHELL_CTL->shell_rx_fifo_buffer = K_NULL; + tos_chr_fifo_destroy(&SHELL_CTL->shell_rx_fifo); + + return -1; +} + +__API__ void tos_shell_deinit(void) +{ + tos_task_destroy(&SHELL_CTL->parser); + tos_sem_destroy(&SHELL_CTL->shell_rx_sem); + + tos_mmheap_free(SHELL_CTL->shell_rx_fifo_buffer); + SHELL_CTL->shell_rx_fifo_buffer = K_NULL; + tos_chr_fifo_destroy(&SHELL_CTL->shell_rx_fifo); +} + +__API__ void tos_shell_printf(const char *format, ...) +{ + va_list args; + static char buffer[SHELL_OUTPUT_MAX]; + + va_start(args, format); + vsnprintf(buffer, sizeof(buffer), format, args); + va_end(args); + + (SHELL_CTL->output)(buffer); +} + +__API__ void tos_shell_input_byte(uint8_t data) +{ + if (tos_chr_fifo_push(&SHELL_CTL->shell_rx_fifo, data) == K_ERR_NONE) { + tos_sem_post(&SHELL_CTL->shell_rx_sem); + } +} + diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.h b/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.h new file mode 100644 index 00000000..b69c8169 --- /dev/null +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Hardware/PM25/sensor_parser.h @@ -0,0 +1,54 @@ +/*---------------------------------------------------------------------------- + * Tencent is pleased to support the open source community by making TencentOS + * available. + * + * Copyright (C) 2019 THL A29 Limited, a Tencent company. All rights reserved. + * If you have downloaded a copy of the TencentOS binary from Tencent, please + * note that the TencentOS binary is licensed under the BSD 3-Clause License. + * + * If you have downloaded a copy of the TencentOS source code from Tencent, + * please note that TencentOS source code is licensed under the BSD 3-Clause + * License, except for the third-party components listed below which are + * subject to different license terms. Your integration of TencentOS into your + * own projects may require compliance with the BSD 3-Clause License, as well + * as the other licenses applicable to the third-party components included + * within TencentOS. + *---------------------------------------------------------------------------*/ + +#ifndef _TOS_SHELL_H_ +#define _TOS_SHELL_H_ + +#include "tos_k.h" + +#define SHELL_CMD_ARGV_MAX 16 +#define SHELL_OUTPUT_MAX 256 +#define SHELL_PARSER_TASK_STACK_SIZE 1024 +#define SHELL_PARSER_TASK_PRIO 5 + +typedef void (*shell_output_t)(const char *str); + +typedef struct shell_control_st { + k_task_t parser; + + shell_output_t output; + + char *cmd_buffer; + int cmd_buffer_size; + + k_sem_t shell_rx_sem; + k_chr_fifo_t shell_rx_fifo; + uint8_t *shell_rx_fifo_buffer; +} shell_ctl_t; + +#define SHELL_CTL ((shell_ctl_t *)(&shell_ctl)) + +__API__ int tos_shell_init(char *cmd_buf, int cmd_buf_size, shell_output_t output); + +__API__ void tos_shell_deinit(void); + +__API__ void tos_shell_printf(const char *format, ...); + +__API__ void tos_shell_input_byte(uint8_t data); + +#endif /* _TOS_SHELL_H_ */ + diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/usart.h b/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/usart.h index b2380278..8e79aa59 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/usart.h +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Inc/usart.h @@ -49,9 +49,10 @@ extern "C" { #define USARTx_RX_AF GPIO_AF7_USART1 extern UART_HandleTypeDef huart1; +extern UART_HandleTypeDef huart2; void MX_USART1_UART_Init(void); - +void MX_USART2_UART_Init(void); #ifdef __cplusplus } diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Middlewares/LoRaWAN/Mac/region/RegionCN470.h b/board/RHF0M0E5_STM32WLE5xx/BSP/Middlewares/LoRaWAN/Mac/region/RegionCN470.h index 0be4e736..0a053162 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Middlewares/LoRaWAN/Mac/region/RegionCN470.h +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Middlewares/LoRaWAN/Mac/region/RegionCN470.h @@ -52,7 +52,7 @@ /*! * Maximal datarate that can be used by the node */ -#define CN470_TX_MAX_DATARATE DR_5 +#define CN470_TX_MAX_DATARATE DR_0 /*! * Minimal datarate that can be used by the node @@ -62,7 +62,7 @@ /*! * Maximal datarate that can be used by the node */ -#define CN470_RX_MAX_DATARATE DR_5 +#define CN470_RX_MAX_DATARATE DR_0 /*! * Default datarate used by the node diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/main.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/main.c index 14ff70d0..4b60cba9 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/main.c +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/main.c @@ -4,7 +4,7 @@ #define APPLICATION_TASK_STK_SIZE 4096 extern void application_entry(void *arg); -osThreadDef(application_entry, osPriorityNormal, 1, APPLICATION_TASK_STK_SIZE); +osThreadDef(application_entry, 3, 1, APPLICATION_TASK_STK_SIZE); __weak void application_entry(void *arg) { diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c index 71587d52..58cc0de9 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/mcu_init.c @@ -27,11 +27,11 @@ int fgetc(FILE *f) void board_init(void) { - HAL_Init(); - SystemClock_Config(); + HAL_Init(); + SystemClock_Config(); SystemApp_Init(); - MX_LoRaWAN_Init(); + MX_LoRaWAN_Init(); } /** diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c index a57a0b1f..6d5001dd 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/stm32wlxx_it.c @@ -25,7 +25,7 @@ #include "main.h" #include "stm32wlxx_it.h" #include "tos_k.h" - +#include "sensor_parser.h" /* Private includes ----------------------------------------------------------*/ /* USER CODE BEGIN Includes */ /* USER CODE END Includes */ @@ -62,6 +62,7 @@ /* External variables --------------------------------------------------------*/ extern UART_HandleTypeDef huart1; +extern UART_HandleTypeDef huart2; extern SUBGHZ_HandleTypeDef hsubghz; /* USER CODE BEGIN EV */ @@ -220,11 +221,35 @@ void USART1_IRQHandler(void) /* USER CODE END USART2_IRQn 1 */ } +void USART2_IRQHandler(void) +{ + /* USER CODE BEGIN LPUART1_IRQn 0 */ + + /* USER CODE END LPUART1_IRQn 0 */ + tos_knl_irq_enter(); + HAL_UART_IRQHandler(&huart2); + tos_knl_irq_leave(); + /* USER CODE BEGIN LPUART1_IRQn 1 */ + + /* USER CODE END LPUART1_IRQn 1 */ +} + void Radio_IRQHandler(void) { HAL_SUBGHZ_IRQHandler(&hsubghz); } -/* USER CODE BEGIN 1 */ +/* USER CODE BEGIN 1 */ +void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart) +{ + extern uint8_t msg; + + if(huart ->Instance == USART2) + { + tos_shell_input_byte(msg); + HAL_UART_Receive_IT(&huart2, (uint8_t*)&msg, 1); + + } +} /* USER CODE END 1 */ /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/usart.c b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/usart.c index e38935f5..3e48acef 100644 --- a/board/RHF0M0E5_STM32WLE5xx/BSP/Src/usart.c +++ b/board/RHF0M0E5_STM32WLE5xx/BSP/Src/usart.c @@ -25,7 +25,10 @@ /* External variables --------------------------------------------------------*/ /* Private typedef -----------------------------------------------------------*/ +uint8_t msg; + UART_HandleTypeDef huart1; +UART_HandleTypeDef huart2; /* Private define ------------------------------------------------------------*/ /* Private macro -------------------------------------------------------------*/ @@ -50,31 +53,86 @@ void MX_USART1_UART_Init(void) } } +void MX_USART2_UART_Init(void) +{ + huart2.Instance = USART2; + huart2.Init.BaudRate = 9600; + huart2.Init.WordLength = UART_WORDLENGTH_8B; + huart2.Init.StopBits = UART_STOPBITS_1; + huart2.Init.Parity = UART_PARITY_NONE; + huart2.Init.Mode = UART_MODE_TX_RX; + huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE; + huart2.Init.OverSampling = UART_OVERSAMPLING_16; + huart2.Init.OneBitSampling = UART_ONE_BIT_SAMPLE_DISABLE; + huart2.AdvancedInit.AdvFeatureInit = UART_ADVFEATURE_NO_INIT; + + if (HAL_UART_Init(&huart2) != HAL_OK) + { + Error_Handler(); + } + + HAL_UART_Receive_IT(&huart2, &msg, 1); +} void HAL_UART_MspInit(UART_HandleTypeDef *uartHandle) { GPIO_InitTypeDef GPIO_InitStruct = {0}; RCC_PeriphCLKInitTypeDef PeriphClkInit = {0}; + + if(uartHandle->Instance==USART2) + { + /* USER CODE BEGIN USART2_MspInit 0 */ - /* Enable GPIO TX/RX clock */ - USARTx_TX_GPIO_CLK_ENABLE(); - USARTx_RX_GPIO_CLK_ENABLE(); + /* USER CODE END USART2_MspInit 0 */ + /* USART2 clock enable */ + __HAL_RCC_USART2_CLK_ENABLE(); - USARTx_CLK_ENABLE(); + __HAL_RCC_GPIOA_CLK_ENABLE(); + /**USART2 GPIO Configuration + PA2 ------> USART2_TX + PA3 ------> USART2_RX + */ + GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = GPIO_AF7_USART2; + HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); - GPIO_InitStruct.Pin = USARTx_TX_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_PULLUP; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = USARTx_TX_AF; - HAL_GPIO_Init(USARTx_TX_GPIO_Port, &GPIO_InitStruct); + /* USART2 interrupt Init */ + HAL_NVIC_SetPriority(USART2_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(USART2_IRQn); + /* USER CODE BEGIN USART2_MspInit 1 */ - GPIO_InitStruct.Pin = USARTx_RX_Pin; - GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; - GPIO_InitStruct.Pull = GPIO_NOPULL; - GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; - GPIO_InitStruct.Alternate = USARTx_RX_AF; - HAL_GPIO_Init(USARTx_RX_GPIO_Port, &GPIO_InitStruct); + /* USER CODE END USART2_MspInit 1 */ + } + else if(uartHandle->Instance==USART1) + { + /* Enable GPIO TX/RX clock */ + USARTx_TX_GPIO_CLK_ENABLE(); + USARTx_RX_GPIO_CLK_ENABLE(); + + USARTx_CLK_ENABLE(); + + GPIO_InitStruct.Pin = USARTx_TX_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_PULLUP; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = USARTx_TX_AF; + HAL_GPIO_Init(USARTx_TX_GPIO_Port, &GPIO_InitStruct); + + GPIO_InitStruct.Pin = USARTx_RX_Pin; + GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; + GPIO_InitStruct.Pull = GPIO_NOPULL; + GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; + GPIO_InitStruct.Alternate = USARTx_RX_AF; + HAL_GPIO_Init(USARTx_RX_GPIO_Port, &GPIO_InitStruct); + + /* USART1 interrupt Init */ + HAL_NVIC_SetPriority(USART1_IRQn, 0, 0); + HAL_NVIC_EnableIRQ(USART1_IRQn); + + } } /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h index 39b7d5cb..9d12d9bf 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/Commissioning.h @@ -60,7 +60,7 @@ extern "C" { #define LORAWAN_PUBLIC_NETWORK true /*root key*/ -#define LORAWAN_APP_KEY { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37, 0x1e, 0x29, 0xaa, 0xaa, 0xad, 0x20, 0x4a, 0x72 } +#define LORAWAN_APP_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } /*for ABP================================================================================*/ #define STATIC_DEVICE_ADDRESS 1 //if 0 , using a ramdom address @@ -68,22 +68,21 @@ extern "C" { #define LORAWAN_NETWORK_ID ( uint32_t )0 #define LORAWAN_DEVICE_ADDRESS ( uint32_t )0x0100000a -#define LORAWAN_NWK_KEY { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37, 0x1e, 0x29, 0xaa, 0xaa, 0xad, 0x20, 0x4a, 0x72 } +#define LORAWAN_NWK_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } /*for 1.1.x*/ -#define LORAWAN_F_NWK_S_INT_KEY { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37, 0x1e, 0x29, 0xaa, 0xaa, 0xad, 0x20, 0x4a, 0x72 } -#define LORAWAN_S_NWK_S_INT_KEY { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37, 0x1e, 0x29, 0xaa, 0xaa, 0xad, 0x20, 0x4a, 0x72 } -#define LORAWAN_NWK_S_ENC_KEY { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37, 0x1e, 0x29, 0xaa, 0xaa, 0xad, 0x20, 0x4a, 0x72 } -#define LORAWAN_APP_S_KEY { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37, 0x1e, 0x29, 0xaa, 0xaa, 0xad, 0x20, 0x4a, 0x72 } +#define LORAWAN_F_NWK_S_INT_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } +#define LORAWAN_S_NWK_S_INT_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } +#define LORAWAN_NWK_S_ENC_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } +#define LORAWAN_APP_S_KEY { 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45, 0x67, 0x89, 0x12, 0x34, 0x56, 0x78, 0x91, 0x23, 0x45 } /*for OTAA================================================================================*/ #define STATIC_DEVICE_EUI 1 //if 0 , using a ramdom EUI #define IEEE_OUI 0x01, 0x01, 0x01 -#define LORAWAN_DEVICE_EUI { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37} -#define LORAWAN_JOIN_EUI /*APP_EUI*/ { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0xf7, 0x37} - +#define LORAWAN_DEVICE_EUI { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf7} +#define LORAWAN_JOIN_EUI /*APP_EUI*/ { 0x8c, 0xf9, 0x57, 0x20, 0x00, 0x00, 0x4d, 0xf7} diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c index 1163a4bd..61d0f589 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_lorawan.c @@ -3,19 +3,29 @@ #include "timer.h" #include "app_system.h" #include "app_lorawan.h" -//#include "stm32_seq.h" #include "stm32_lpm.h" #include "adc_if.h" #include "lorawan_version.h" #include - +#include "sensor_parser.h" #define APP_TX_DUTYCYCLE 30000 //ms #define LORAWAN_DOWNLINK_PORT 2 #define LORAWAN_UPLINK_PORT 10 + +k_mail_q_t mail_q; +#define DATA_CNT 26 +uint8_t mail_buf[DATA_CNT]; + + +typedef struct device_data_st { + uint8_t data[DATA_CNT]; +} __PACKED__ dev_data_t; + + /*! * user main_callback function declare , you need to implement them * and register. @@ -47,7 +57,6 @@ lw_app_data_t app_data = { app_data_buff, 0, 0 }; /*send task function declaration*/ static TimerEvent_t send_timer; -//static k_timer_t send_timer; static void send_process(void *args); static void cycle_send_event(void *context); static void Lora_start_send(void); @@ -82,18 +91,18 @@ void MX_LoRaWAN_Init(void) /*Class*/ lw_request_class(CLASS_A); - /*channel 8-16*/ + /*channel 80-87*/ LWChannel_mask_t ch={0x0000,0,0,0,0,0x00FF}; lw_current_chmask_set(&ch); /*tx dr*/ - lw_config_tx_datarate_set(DR_3); + lw_config_tx_datarate_set(DR_5); /*OTAA*/ lw_config_otaa_set(LORA_ENABLE); /*enable adr*/ - lw_adr_set(LORA_ENABLE); + lw_adr_set(LORA_DISABLE); /*set retry*/ lw_confirm_retry_set(3); @@ -101,29 +110,107 @@ void MX_LoRaWAN_Init(void) printf("lorawan init ok.\r\n"); } -void application_entry(void *arg) -{ +uint8_t pool[DATA_CNT]; +#define CMD_LEN_MAX 50 +char cmd_buf[CMD_LEN_MAX]; +dev_data_t dev_data; - //创建信号量 - tos_sem_create_max(&lora_mac_process_sem, 0, 1); - - //创建任务 - tos_task_create(&lora_mac_process_task, - "lora_mac_process_task", - LoraMacProcess_task_entry, - NULL, - 2, - lora_mac_process_task_stack, - sizeof(lora_mac_process_task_stack), - 10); - - Lora_start_send(); +uint16_t report_period = 10; + +void uart_output(const char *str) +{ + /* if using c lib printf through uart, a simpler one is: */ + printf(str); } +void recv_callback(uint8_t *data, uint8_t len) +{ + int i = 0; + + printf("len: %d\n", len); + + for (i = 0; i < len; ++i) { + printf("data[%d]: %d\n", i, data[i]); + } + + if (len == 1) { + report_period = data[0]; + } else if (len >= 2) { + report_period = data[0] | (data[1] << 8); + } + printf("report_period: %d\n", report_period); +} + +void application_entry(void *arg) +{ + + int i = 0; + int ret = 0; + int send_failed_count = 0; + + tos_mail_q_create(&mail_q, pool, DATA_CNT, sizeof(uint8_t)); + tos_shell_init(cmd_buf, sizeof(cmd_buf), uart_output); + + //create task to process loramac + tos_sem_create_max(&lora_mac_process_sem, 0, 1); + tos_task_create(&lora_mac_process_task, + "lora_mac_process_task", + LoraMacProcess_task_entry, + NULL, + 2, + lora_mac_process_task_stack, + sizeof(lora_mac_process_task_stack), + 10); + + //report pm2.5 data + while (1) { + size_t mail_size; + + tos_mail_q_pend(&mail_q, &dev_data.data, &mail_size, TOS_TIME_FOREVER); + + /*fill the data*/ + i = 0; + app_data.port = LORAWAN_UPLINK_PORT; + + for (i = 0; i < mail_size; i++) { + app_data.buff[i] = dev_data.data[i]; + printf("[%d] %x\n", i, dev_data.data[i]); + } + printf("\n\n"); + app_data.size = i; + + /*Check if it is in OTAA mode*/ + if(LORA_ENABLE == lw_config_otaa_get()) + { + /*check if it is already joined*/ + if(lw_join_status() != LORA_SET) + { + lw_join(); + continue; + } + } + + ret = lw_send(&app_data, LORAWAN_CONFIRMED_MSG); + if (ret != LORAMAC_STATUS_OK ) + { + printf("LoRa Send data faild!, retcode = %d, count is %d\r\n",ret, send_failed_count); + send_failed_count++; + if (send_failed_count > 10) + { + NVIC_SystemReset();// when lora send faied more than 10 times , cpu reset to reconnect. + } + } + else + { + send_failed_count = 0; + } + + tos_task_delay(10000); + } + + //Lora_start_send(); +} -/*============================================================== -create a send task ,the task is periodic trigger -================================================================*/ void Lora_start_send(void) { /* send everytime timer elapses */ @@ -134,8 +221,6 @@ void Lora_start_send(void) static void cycle_send_event(void *args) { - //触发此任务 - //UTIL_SEQ_SetTask(CFG_SEQ_TASK_LORA_SEND_ON_TX_TIMER, CFG_SEQ_Prio_0); send_process(NULL); /*Wait for next tx slot*/ TimerStart(&send_timer); @@ -250,8 +335,6 @@ void mac_event_callback(APP_EVENT_t evt,const void* param) } static void LoraMacProcessNotify(void) { - //UTIL_SEQ_SetTask(CFG_SEQ_TASK_LORAMAC_PROCESS, CFG_SEQ_Prio_0); - //释放信号量 tos_sem_post(&lora_mac_process_sem); } diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_system.c b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_system.c index 15d573e4..e6da26ac 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_system.c +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/App/app_system.c @@ -3,7 +3,6 @@ #include "main.h" #include "app_system.h" #include "adc_if.h" -//#include "stm32_seq.h" #include "stm32_systime.h" #include "stm32_lpm.h" @@ -34,6 +33,8 @@ void SystemApp_Init(void) Gpio_PreInit(); vcom_Init(NULL); + + MX_USART2_UART_Init(); /*Initialize the temperature and Battery measurement services */ SYS_InitMeasurement(); diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx index ddf321e4..4333aae6 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvoptx @@ -117,11 +117,6 @@ STLink\ST-LINKIII-KEIL_SWO.dll - - 0 - JL2CM3 - -U260106173 -O78 -S2 -ZTIFSpeedSel5000 -A0 -C0 -JU1 -JI127.0.0.1 -JP0 -RST0 -TO18 -TC10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -TB1 -TFE0 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4.FLM -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM) - 0 UL2CM3 @@ -130,7 +125,7 @@ 0 ST-LINKIII-KEIL_SWO - -U066DFF495056805087213734 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO18 -TC10000000 -TP21 -TDS8000 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO15 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4.FLM -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM) + -U51FF68064965575333151687 -O206 -SF4000 -C0 -A0 -I0 -HNlocalhost -HP7184 -P1 -N00("ARM CoreSight SW-DP") -D00(6BA02477) -L00(0) -TO131090 -TC10000000 -TT10000000 -TP21 -TDS8004 -TDT0 -TDC1F -TIEFFFFFFFF -TIP8 -FO31 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4.FLM -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM) 0 @@ -336,18 +331,6 @@ 0 0 0 - ..\..\BSP\Src\main.c - main.c - 0 - 0 - - - 2 - 7 - 1 - 0 - 0 - 0 ..\..\BSP\Src\mcu_init.c mcu_init.c 0 @@ -355,7 +338,7 @@ 2 - 8 + 7 1 0 0 @@ -367,7 +350,7 @@ 2 - 9 + 8 1 0 0 @@ -379,7 +362,7 @@ 2 - 10 + 9 1 0 0 @@ -391,7 +374,7 @@ 2 - 11 + 10 1 0 0 @@ -403,7 +386,7 @@ 2 - 12 + 11 1 0 0 @@ -415,7 +398,7 @@ 2 - 13 + 12 1 0 0 @@ -427,7 +410,7 @@ 2 - 14 + 13 1 0 0 @@ -447,7 +430,7 @@ 0 3 - 15 + 14 1 0 0 @@ -459,7 +442,7 @@ 3 - 16 + 15 1 0 0 @@ -471,7 +454,7 @@ 3 - 17 + 16 1 0 0 @@ -483,7 +466,7 @@ 3 - 18 + 17 1 0 0 @@ -495,7 +478,7 @@ 3 - 19 + 18 1 0 0 @@ -507,7 +490,7 @@ 3 - 20 + 19 1 0 0 @@ -519,7 +502,7 @@ 3 - 21 + 20 1 0 0 @@ -531,7 +514,7 @@ 3 - 22 + 21 1 0 0 @@ -543,7 +526,7 @@ 3 - 23 + 22 1 0 0 @@ -555,7 +538,7 @@ 3 - 24 + 23 1 0 0 @@ -567,7 +550,7 @@ 3 - 25 + 24 1 0 0 @@ -579,7 +562,7 @@ 3 - 26 + 25 1 0 0 @@ -591,7 +574,7 @@ 3 - 27 + 26 1 0 0 @@ -603,7 +586,7 @@ 3 - 28 + 27 1 0 0 @@ -615,7 +598,7 @@ 3 - 29 + 28 1 0 0 @@ -627,7 +610,7 @@ 3 - 30 + 29 1 0 0 @@ -639,7 +622,7 @@ 3 - 31 + 30 1 0 0 @@ -651,7 +634,7 @@ 3 - 32 + 31 1 0 0 @@ -663,7 +646,7 @@ 3 - 33 + 32 1 0 0 @@ -675,7 +658,7 @@ 3 - 34 + 33 1 0 0 @@ -687,7 +670,7 @@ 3 - 35 + 34 1 0 0 @@ -707,7 +690,7 @@ 0 4 - 36 + 35 1 0 0 @@ -727,7 +710,7 @@ 0 5 - 37 + 36 1 0 0 @@ -739,7 +722,7 @@ 5 - 38 + 37 1 0 0 @@ -751,7 +734,7 @@ 5 - 39 + 38 2 0 0 @@ -771,7 +754,7 @@ 0 6 - 40 + 39 1 0 0 @@ -783,7 +766,7 @@ 6 - 41 + 40 1 0 0 @@ -795,7 +778,7 @@ 6 - 42 + 41 1 0 0 @@ -807,7 +790,7 @@ 6 - 43 + 42 1 0 0 @@ -819,7 +802,7 @@ 6 - 44 + 43 1 0 0 @@ -831,7 +814,7 @@ 6 - 45 + 44 1 0 0 @@ -843,7 +826,7 @@ 6 - 46 + 45 1 0 0 @@ -855,7 +838,7 @@ 6 - 47 + 46 1 0 0 @@ -867,7 +850,7 @@ 6 - 48 + 47 1 0 0 @@ -879,7 +862,7 @@ 6 - 49 + 48 1 0 0 @@ -891,7 +874,7 @@ 6 - 50 + 49 1 0 0 @@ -903,7 +886,7 @@ 6 - 51 + 50 1 0 0 @@ -915,7 +898,7 @@ 6 - 52 + 51 1 0 0 @@ -927,7 +910,7 @@ 6 - 53 + 52 1 0 0 @@ -939,7 +922,7 @@ 6 - 54 + 53 1 0 0 @@ -951,7 +934,7 @@ 6 - 55 + 54 1 0 0 @@ -963,7 +946,7 @@ 6 - 56 + 55 1 0 0 @@ -975,7 +958,7 @@ 6 - 57 + 56 1 0 0 @@ -987,7 +970,7 @@ 6 - 58 + 57 1 0 0 @@ -999,7 +982,7 @@ 6 - 59 + 58 1 0 0 @@ -1011,7 +994,7 @@ 6 - 60 + 59 1 0 0 @@ -1023,7 +1006,7 @@ 6 - 61 + 60 1 0 0 @@ -1035,7 +1018,7 @@ 6 - 62 + 61 1 0 0 @@ -1047,7 +1030,7 @@ 6 - 63 + 62 1 0 0 @@ -1059,7 +1042,7 @@ 6 - 64 + 63 1 0 0 @@ -1071,7 +1054,7 @@ 6 - 65 + 64 1 0 0 @@ -1083,7 +1066,7 @@ 6 - 66 + 65 1 0 0 @@ -1095,7 +1078,7 @@ 6 - 67 + 66 1 0 0 @@ -1115,7 +1098,7 @@ 0 7 - 68 + 67 1 0 0 @@ -1141,6 +1124,18 @@ 0 0 0 + + 9 + 68 + 1 + 0 + 0 + 0 + ..\..\BSP\Src\main.c + main.c + 0 + 0 + 9 69 @@ -1224,7 +1219,7 @@ - lorawan/pattern + Hardware 0 0 0 @@ -1236,14 +1231,34 @@ 0 0 0 + ..\..\BSP\Hardware\PM25\sensor_parser.c + sensor_parser.c + 0 + 0 + + + + + lorawan/pattern + 0 + 0 + 0 + 0 + + 12 + 76 + 1 + 0 + 0 + 0 ..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic\lora.c lora.c 0 0 - 11 - 76 + 12 + 77 1 0 0 @@ -1262,8 +1277,8 @@ 0 0 - 12 - 77 + 13 + 78 1 0 0 @@ -1274,8 +1289,8 @@ 0 - 12 - 78 + 13 + 79 1 0 0 @@ -1286,8 +1301,8 @@ 0 - 12 - 79 + 13 + 80 1 0 0 @@ -1298,8 +1313,8 @@ 0 - 12 - 80 + 13 + 81 1 0 0 @@ -1310,8 +1325,8 @@ 0 - 12 - 81 + 13 + 82 1 0 0 @@ -1322,8 +1337,8 @@ 0 - 12 - 82 + 13 + 83 1 0 0 @@ -1334,8 +1349,8 @@ 0 - 12 - 83 + 13 + 84 1 0 0 @@ -1346,8 +1361,8 @@ 0 - 12 - 84 + 13 + 85 1 0 0 @@ -1358,8 +1373,8 @@ 0 - 12 - 85 + 13 + 86 1 0 0 @@ -1370,8 +1385,8 @@ 0 - 12 - 86 + 13 + 87 1 0 0 @@ -1382,8 +1397,8 @@ 0 - 12 - 87 + 13 + 88 1 0 0 @@ -1402,8 +1417,8 @@ 0 0 - 13 - 88 + 14 + 89 1 0 0 @@ -1414,8 +1429,8 @@ 0 - 13 - 89 + 14 + 90 1 0 0 @@ -1426,8 +1441,8 @@ 0 - 13 - 90 + 14 + 91 1 0 0 @@ -1438,8 +1453,8 @@ 0 - 13 - 91 + 14 + 92 1 0 0 @@ -1450,8 +1465,8 @@ 0 - 13 - 92 + 14 + 93 1 0 0 @@ -1462,8 +1477,8 @@ 0 - 13 - 93 + 14 + 94 1 0 0 @@ -1474,8 +1489,8 @@ 0 - 13 - 94 + 14 + 95 1 0 0 @@ -1486,8 +1501,8 @@ 0 - 13 - 95 + 14 + 96 1 0 0 @@ -1498,8 +1513,8 @@ 0 - 13 - 96 + 14 + 97 1 0 0 @@ -1510,8 +1525,8 @@ 0 - 13 - 97 + 14 + 98 1 0 0 @@ -1522,8 +1537,8 @@ 0 - 13 - 98 + 14 + 99 1 0 0 @@ -1534,8 +1549,8 @@ 0 - 13 - 99 + 14 + 100 1 0 0 @@ -1546,8 +1561,8 @@ 0 - 13 - 100 + 14 + 101 1 0 0 @@ -1566,8 +1581,8 @@ 0 0 - 14 - 101 + 15 + 102 1 0 0 @@ -1586,8 +1601,8 @@ 0 0 - 15 - 102 + 16 + 103 1 0 0 @@ -1598,8 +1613,8 @@ 0 - 15 - 103 + 16 + 104 1 0 0 @@ -1618,8 +1633,8 @@ 0 0 - 16 - 104 + 17 + 105 1 0 0 @@ -1630,8 +1645,8 @@ 0 - 16 - 105 + 17 + 106 1 0 0 @@ -1642,8 +1657,8 @@ 0 - 16 - 106 + 17 + 107 1 0 0 diff --git a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx index 7c730423..b51035fe 100644 --- a/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx +++ b/board/RHF0M0E5_STM32WLE5xx/KEIL/lorawan/TencentOS_Tiny.uvprojx @@ -16,14 +16,14 @@ STM32WLE5JCIx STMicroelectronics - Keil.STM32WLxx_DFP.1.0.2.OEM - http://www.keil.com/pack - IRAM(0x20000000,0x10000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") FPU2 CLOCK(12000000) ELITTLE + Keil.STM32WLxx_DFP.1.0.0 + http://www.keil.com/pack/ + IRAM(0x20000000,0x10000) IROM(0x08000000,0x40000) CPUTYPE("Cortex-M4") CLOCK(12000000) ELITTLE - UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4 -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$Drivers\CMSIS\Flash\STM32WLxx_CM4.FLM)) + UL2CM3(-S0 -C0 -P0 -FD20000000 -FC1000 -FN1 -FF0STM32WLxx_CM4 -FS08000000 -FL040000 -FP0($$Device:STM32WLE5JCIx$CMSIS\Flash\STM32WLxx_CM4.FLM)) 0 - $$Device:STM32WLE5JCIx$Drivers\CMSIS\Device\ST\STM32WLxx\Include\stm32wlxx.h + $$Device:STM32WLE5JCIx$Drivers\Device\ST\STM32WLxx\Include\stm32wlxx.h @@ -33,7 +33,7 @@ - $$Device:STM32WLE5JCIx$Drivers\CMSIS\SVD\STM32WL5x_CM4.svd + $$Device:STM32WLE5JCIx$CMSIS\SVD\STM32WLE5_CM4.svd 0 0 @@ -52,9 +52,9 @@ TencentOS_Tiny 1 0 - 0 + 1 1 - 0 + 1 .\List\ 1 0 @@ -183,7 +183,7 @@ 1 0 0 - 1 + 0 0 0 0 @@ -339,7 +339,7 @@ USE_HAL_DRIVER,STM32WLE5xx,CORE_CM4 - ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32WLxx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS_CONFIG;..\..\BSP\Middlewares\LoRaWAN\Conf;..\..\BSP\Middlewares\LoRaWAN\Crypto;..\..\BSP\Middlewares\LoRaWAN\Mac;..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic;..\..\BSP\Middlewares\LoRaWAN\Utilities;..\..\BSP\Middlewares\SubGHz_Phy;..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver;..\..\BSP\Inc;.\App;.\Target;..\..\BSP\Utilities\lpm\tiny_lpm;..\..\BSP\Utilities\misc + ..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc;..\..\..\..\platform\vendor_bsp\st\STM32WLxx_HAL_Driver\Inc\Legacy;..\..\..\..\platform\vendor_bsp\st\CMSIS\Device\ST\STM32WLxx\Include;..\..\..\..\platform\vendor_bsp\st\CMSIS\Include;..\..\..\..\arch\arm\arm-v7m\common\include;..\..\..\..\arch\arm\arm-v7m\cortex-m4\armcc;..\..\..\..\kernel\core\include;..\..\..\..\kernel\pm\include;..\..\..\..\osal\cmsis_os;..\..\TOS_CONFIG;..\..\BSP\Middlewares\LoRaWAN\Conf;..\..\BSP\Middlewares\LoRaWAN\Crypto;..\..\BSP\Middlewares\LoRaWAN\Mac;..\..\BSP\Middlewares\LoRaWAN\Patterns\Basic;..\..\BSP\Middlewares\LoRaWAN\Utilities;..\..\BSP\Middlewares\SubGHz_Phy;..\..\BSP\Middlewares\SubGHz_Phy\stm32_radio_driver;..\..\BSP\Inc;.\App;.\Target;..\..\BSP\Utilities\lpm\tiny_lpm;..\..\BSP\Utilities\misc;..\..\BSP\Hardware\PM25 @@ -413,11 +413,6 @@ 1 ..\..\BSP\Src\gpio.c - - main.c - 1 - ..\..\BSP\Src\main.c - mcu_init.c 1 @@ -761,6 +756,11 @@ TOS-CONFIG + + main.c + 1 + ..\..\BSP\Src\main.c + tos_config.h 5 @@ -798,6 +798,16 @@ + + Hardware + + + sensor_parser.c + 1 + ..\..\BSP\Hardware\PM25\sensor_parser.c + + + lorawan/pattern @@ -998,8 +1008,8 @@ - - + +