uplink message format improved with two hall states

This commit is contained in:
Yunhorn 2024-04-11 11:58:21 +08:00
parent 222e696f0b
commit 9a16dee3cc
9 changed files with 23640 additions and 23139 deletions

View File

@ -113,7 +113,8 @@ void MX_TOF_Init(void);
#define HALL2_VCC_Pin GPIO_PIN_4 #define HALL2_VCC_Pin GPIO_PIN_4
#define HALL2_VCC_GPIO_Port GPIOB #define HALL2_VCC_GPIO_Port GPIOB
#define HALLL_1_STATE HAL_GPIO_ReadPin(HALL1_OUT_GPIO_Port, HALL1_OUT_Pin)
#define HALLL_2_STATE HAL_GPIO_ReadPin(HALL2_OUT_GPIO_Port, HALL2_OUT_Pin)
#endif #endif
#if defined(STM32WL55xx) #if defined(STM32WL55xx)
#define BUT3_Pin GPIO_PIN_6 #define BUT3_Pin GPIO_PIN_6

View File

@ -47,12 +47,12 @@ extern "C" {
/** /**
* @brief Verbose level for all trace logs * @brief Verbose level for all trace logs
*/ */
#define VERBOSE_LEVEL VLEVEL_OFF #define VERBOSE_LEVEL VLEVEL_M
/** /**
* @brief Enable trace logs * @brief Enable trace logs
*/ */
#define APP_LOG_ENABLED 0 #define APP_LOG_ENABLED 1
/** /**
* @brief Activate monitoring (probes) of some internal RF signals for debug purpose * @brief Activate monitoring (probes) of some internal RF signals for debug purpose
@ -75,7 +75,7 @@ extern "C" {
* @brief Enable/Disable MCU Debugger pins (dbg serial wires) * @brief Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power * @note by HW serial wires are ON by default, need to put them OFF to save power
*/ */
#define DEBUGGER_ENABLED 0 #define DEBUGGER_ENABLED 1
/** /**
* @brief Disable Low Power mode * @brief Disable Low Power mode

View File

@ -101,31 +101,18 @@ void MX_GPIO_Init(void)
#endif #endif
#ifdef STS_O5 #ifdef STS_O5
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
GPIO_InitStruct.Pin = HALL1_OUT_Pin; GPIO_InitStruct.Pin = HALL1_OUT_Pin|HALL2_OUT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING; GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP; GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(HALL1_OUT_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(HALL1_OUT_GPIO_Port, &GPIO_InitStruct);
/*Configure GPIO pin : PtPin */ GPIO_InitStruct.Pin = HALL1_VCC_Pin|HALL2_VCC_Pin;
GPIO_InitStruct.Pin = HALL2_OUT_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
GPIO_InitStruct.Pull = GPIO_PULLUP;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(HALL2_OUT_GPIO_Port, &GPIO_InitStruct);
GPIO_InitStruct.Pin = HALL1_VCC_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP; GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_PULLDOWN;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(HALL1_VCC_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(HALL1_VCC_GPIO_Port, &GPIO_InitStruct);
GPIO_InitStruct.Pin = HALL2_VCC_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(HALL2_VCC_GPIO_Port, &GPIO_InitStruct);
#else #else
/*Configure GPIO pin : PtPin */ /*Configure GPIO pin : PtPin */
@ -145,6 +132,8 @@ void MX_GPIO_Init(void)
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH; GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct); HAL_GPIO_Init(MEMS_POWER_GPIO_Port, &GPIO_InitStruct);
HAL_GPIO_WritePin(GPIOB, MEMS_POWER_Pin|HALL1_VCC_Pin|HALL2_VCC_Pin,GPIO_PIN_RESET);
//turn on power //turn on power
//__HAL_RCC_GPIOB_CLK_DISABLE(); //__HAL_RCC_GPIOB_CLK_DISABLE();
__HAL_RCC_GPIOC_CLK_DISABLE(); __HAL_RCC_GPIOC_CLK_DISABLE();
@ -230,10 +219,10 @@ HAL_GPIO_Init(SOAP_SWITCH_GPIO_Port, &GPIO_InitStruct);
#ifdef STS_O5 #ifdef STS_O5
/* EXTI interrupt init*/ /* EXTI interrupt init*/
HAL_NVIC_SetPriority(HALL1_OUT_EXTI_IRQn, 0, 0); HAL_NVIC_SetPriority(HALL1_OUT_EXTI_IRQn, 4, 0);
HAL_NVIC_EnableIRQ(HALL1_OUT_EXTI_IRQn); HAL_NVIC_EnableIRQ(HALL1_OUT_EXTI_IRQn);
HAL_NVIC_SetPriority(HALL2_OUT_EXTI_IRQn, 0, 0); HAL_NVIC_SetPriority(HALL2_OUT_EXTI_IRQn, 4, 0);
HAL_NVIC_EnableIRQ(HALL2_OUT_EXTI_IRQn); HAL_NVIC_EnableIRQ(HALL2_OUT_EXTI_IRQn);
#else #else

View File

@ -244,7 +244,12 @@ void EXTI0_IRQHandler(void)
/* USER CODE END EXTI0_IRQn 0 */ /* USER CODE END EXTI0_IRQn 0 */
//HAL_EXTI_IRQHandler(&H_EXTI_0); //HAL_EXTI_IRQHandler(&H_EXTI_0);
#ifdef STS_O5
HAL_GPIO_EXTI_IRQHandler(HALL1_OUT_Pin);
#else
HAL_GPIO_EXTI_IRQHandler(BUT1_Pin); HAL_GPIO_EXTI_IRQHandler(BUT1_Pin);
#endif
/* USER CODE BEGIN EXTI0_IRQn 1 */ /* USER CODE BEGIN EXTI0_IRQn 1 */
/* USER CODE END EXTI0_IRQn 1 */ /* USER CODE END EXTI0_IRQn 1 */

View File

@ -116,6 +116,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
GPIO_InitStruct.Pin = USARTx_RX_Pin; GPIO_InitStruct.Pin = USARTx_RX_Pin;
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
GPIO_InitStruct.Pull = GPIO_NOPULL; GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
/* USART2 DMA Init */ /* USART2 DMA Init */

View File

@ -582,10 +582,10 @@ void STS_O5_SENSOR_Read(STS_OO_SensorDataTypeDef *oo_data)
sts_reed_hall_result = (STS_Reed_Hall_State==0)?1:0; sts_reed_hall_result = (STS_Reed_Hall_State==0)?1:0;
#ifdef STS_O5
oo_data->state_sensor1_on_off = sts_reed_hall_result; oo_data->state_sensor1_on_off = HALLL_1_STATE;
oo_data->state_sensor2_on_off = HALLL_2_STATE;
#endif
sensor_data_ready = 1; sensor_data_ready = 1;
} }
#endif #endif

View File

@ -875,8 +875,9 @@ static void SendTxData(void)
AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#06 AppData.Buffer[i++] = (uint8_t)(r0_data.distance1_mm)&0xff; //#06
#elif defined(STS_O5) #elif defined(STS_O5)
AppData.Buffer[i++] = (uint8_t)(0x01)&0xff; // length of the following bytes AppData.Buffer[i++] = (uint8_t)(0x02)&0xff; // length of the following bytes
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff; AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor1_on_off)&0xff;
AppData.Buffer[i++] = (uint8_t)(oo_data.state_sensor2_on_off)&0xff;
#elif defined(YUNHORN_STS_R0_ENABLED) #elif defined(YUNHORN_STS_R0_ENABLED)
AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm >>8)&0xff; //#05 AppData.Buffer[i++] = (uint8_t)(r0_data.distance_mm >>8)&0xff; //#05

View File

@ -1,3 +1,3 @@
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/STS_RR_R125/Core/Src/usart.c:36:6:MX_USART2_UART_Init 4 D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/STS_RR_R125/Core/Src/usart.c:36:6:MX_USART2_UART_Init 4
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/STS_RR_R125/Core/Src/usart.c:81:6:HAL_UART_MspInit 4 D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/STS_RR_R125/Core/Src/usart.c:81:6:HAL_UART_MspInit 4
D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/STS_RR_R125/Core/Src/usart.c:178:6:HAL_UART_MspDeInit 2 D:/ONEDRIVE/STM32WLV13/Projects/NUCLEO-WL55JC/Applications/LoRaWAN/STS_RR_R125/Core/Src/usart.c:179:6:HAL_UART_MspDeInit 2

File diff suppressed because it is too large Load Diff