low power with TOF-1/TOF-2 range incorrect yet.
This commit is contained in:
parent
8e08f7dedf
commit
16c58cf05f
|
@ -106,7 +106,7 @@
|
|||
|
||||
#define MajorVer 24U
|
||||
#define MinorVer 05U
|
||||
#define SubMinorVer 23U
|
||||
#define SubMinorVer 28U
|
||||
#define FirmwareVersion 3U
|
||||
#define YUNHORN_STS_MAX_NVM_CFG_SIZE 64U
|
||||
#define YUNHORN_STS_AC_CODE_SIZE 20U
|
||||
|
|
|
@ -79,7 +79,7 @@ void MX_DMA_Init(void)
|
|||
HAL_NVIC_SetPriority(DMA1_Channel6_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel6_IRQn);
|
||||
#endif
|
||||
#if 0
|
||||
#if 1
|
||||
/* DMA1_Channel7_IRQn interrupt configuration */
|
||||
HAL_NVIC_SetPriority(DMA1_Channel7_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(DMA1_Channel7_IRQn);
|
||||
|
|
|
@ -50,18 +50,18 @@ void MX_GPIO_Init(void)
|
|||
__HAL_RCC_GPIOA_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
#if 1
|
||||
#if 0
|
||||
GPIO_InitStruct.Pin = GPIO_PIN_All;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
//HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
#endif
|
||||
|
||||
//__HAL_RCC_GPIOA_CLK_DISABLE();
|
||||
//__HAL_RCC_GPIOB_CLK_DISABLE();
|
||||
__HAL_RCC_GPIOC_CLK_DISABLE();
|
||||
|
||||
//__HAL_RCC_GPIOC_CLK_DISABLE();
|
||||
#endif
|
||||
/*Configure GPIO pin Output Level */
|
||||
#if defined(STM32WL55xx)
|
||||
HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin
|
||||
|
@ -70,7 +70,7 @@ void MX_GPIO_Init(void)
|
|||
/*Configure GPIO pin Output Level */
|
||||
|
||||
|
||||
HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET);
|
||||
//HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET);
|
||||
|
||||
#if defined(TOF_1)
|
||||
HAL_GPIO_WritePin(TOF_C_XSHUT_GPIO_Port, TOF_C_XSHUT_Pin, GPIO_PIN_SET);
|
||||
|
@ -99,16 +99,11 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(BUT3_GPIO_Port, &GPIO_InitStruct);
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
GPIO_InitStruct.Pin = BUT2_Pin;
|
||||
#ifdef TOF_2
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
#else
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
#endif
|
||||
HAL_GPIO_Init(BUT2_GPIO_Port, &GPIO_InitStruct);
|
||||
|
||||
/*Configure GPIO pin : PtPin */
|
||||
|
@ -116,8 +111,8 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(BUT1_GPIO_Port, &GPIO_InitStruct);
|
||||
#endif
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
|
||||
|
||||
/*Configure GPIO pins : TOF_C_INT_Pin */
|
||||
#if (defined(TOF_1) && defined(TOF_2))
|
||||
GPIO_InitStruct.Pin = TOF_C_INT_Pin;
|
||||
|
@ -149,9 +144,9 @@ void MX_GPIO_Init(void)
|
|||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
|
||||
HAL_GPIO_Init(TOF_C_XSHUT_GPIO_Port, &GPIO_InitStruct);
|
||||
#endif
|
||||
|
||||
/*Configure GPIO pins : TOF_L_XSHUT_Pin */
|
||||
#if (defined(TOF_2)&&defined(TOF_1))
|
||||
|
||||
GPIO_InitStruct.Pin = TOF_L_XSHUT_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLDOWN;
|
||||
|
@ -203,20 +198,20 @@ HAL_GPIO_Init(SOAP_SWITCH_GPIO_Port, &GPIO_InitStruct);
|
|||
/* ============== SOAP LEVEL DETECTION ========================= */
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
/* EXTI interrupt init*/
|
||||
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
||||
|
||||
HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
|
||||
#if (defined(TOF_1) && defined(TOF_2))
|
||||
HAL_NVIC_SetPriority(TOF_C_INT_EXTI_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(TOF_C_INT_EXTI_IRQn);
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if (defined(TOF_2)&&!defined(TOF_1))
|
||||
HAL_NVIC_SetPriority(TOF_L_INT_EXTI_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(TOF_L_INT_EXTI_IRQn);
|
||||
|
|
|
@ -108,34 +108,10 @@ int main(void)
|
|||
|
||||
/* Initialize all configured peripherals */
|
||||
MX_GPIO_Init();
|
||||
|
||||
|
||||
|
||||
while (1)
|
||||
|
||||
{
|
||||
HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_RESET);
|
||||
HAL_Delay(5000);
|
||||
HAL_GPIO_WritePin(MEMS_POWER_GPIO_Port, MEMS_POWER_Pin, GPIO_PIN_SET);
|
||||
HAL_Delay(5000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
MX_DMA_Init();
|
||||
|
||||
MX_I2C2_Init();
|
||||
|
||||
while (1)
|
||||
|
||||
{
|
||||
PME_OFF;
|
||||
HAL_Delay(5000);
|
||||
PME_ON;
|
||||
HAL_Delay(5000);
|
||||
}
|
||||
MX_LoRaWAN_Init();
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
|
|
@ -60,14 +60,14 @@ void MX_RTC_Init(void)
|
|||
/* USER CODE BEGIN Check_RTC_BKUP */
|
||||
|
||||
/* USER CODE END Check_RTC_BKUP */
|
||||
#if 1
|
||||
|
||||
/** Initialize RTC and set the Time and Date
|
||||
*/
|
||||
if (HAL_RTCEx_SetSSRU_IT(&hrtc) != HAL_OK)
|
||||
{
|
||||
Error_Handler();
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#if 0
|
||||
/** Enable the Alarm A
|
||||
|
|
|
@ -82,41 +82,23 @@ void PWR_EnterOffMode(void)
|
|||
{
|
||||
/* USER CODE BEGIN EnterOffMode_1 */
|
||||
|
||||
#if 0
|
||||
PME_OFF;
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All&(~GPIO_PIN_9), GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All&(~GPIO_PIN_5)&(~GPIO_PIN_3)&(~GPIO_PIN_4), GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
|
||||
HAL_SuspendTick();
|
||||
LL_PWR_ClearFlag_C1STOP_C1STB();
|
||||
HAL_PWR_EnterSTANDBYMode();
|
||||
#endif
|
||||
/* USER CODE END EnterOffMode_1 */
|
||||
}
|
||||
|
||||
void PWR_ExitOffMode(void)
|
||||
{
|
||||
/* USER CODE BEGIN ExitOffMode_1 */
|
||||
#if 0
|
||||
HAL_ResumeTick();
|
||||
return;
|
||||
#endif
|
||||
/* USER CODE END ExitOffMode_1 */
|
||||
|
||||
/* USER CODE END ExitOffMode_1 */
|
||||
}
|
||||
|
||||
void PWR_EnterStopMode(void)
|
||||
{
|
||||
/* USER CODE BEGIN EnterStopMode_1 */
|
||||
//WORKABLE CONFIG
|
||||
//PME_OFF;
|
||||
//HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All&(~GPIO_PIN_9), GPIO_PIN_RESET);
|
||||
//HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All&(~GPIO_PIN_5)&(~GPIO_PIN_3)&(~GPIO_PIN_4), GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
|
||||
/* USER CODE END EnterStopMode_1 */
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_SuspendTick();
|
||||
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
||||
LL_PWR_ClearFlag_C1STOP_C1STB();
|
||||
|
|
|
@ -234,7 +234,7 @@ void TAMP_STAMP_LSECSS_SSRU_IRQHandler(void)
|
|||
|
||||
/* USER CODE END TAMP_STAMP_LSECSS_SSRU_IRQn 1 */
|
||||
}
|
||||
#if 0
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI Line 0 Interrupt.
|
||||
*/
|
||||
|
@ -249,8 +249,8 @@ void EXTI0_IRQHandler(void)
|
|||
|
||||
/* USER CODE END EXTI0_IRQn 1 */
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function handles EXTI Line 1 Interrupt.
|
||||
*/
|
||||
|
@ -264,7 +264,7 @@ void EXTI1_IRQHandler(void)
|
|||
|
||||
/* USER CODE END EXTI1_IRQn 1 */
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 Channel 2 Interrupt.
|
||||
|
@ -329,7 +329,7 @@ void DMA1_Channel5_IRQHandler(void)
|
|||
/**
|
||||
* @brief This function handles DMA1 Channel 6 Interrupt.
|
||||
*/
|
||||
#if 0
|
||||
|
||||
void DMA1_Channel6_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN DMA1_Channel6_IRQn 0 */
|
||||
|
@ -342,8 +342,8 @@ void DMA1_Channel6_IRQHandler(void)
|
|||
|
||||
/* USER CODE END DMA1_Channel6_IRQn 1 */
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
|
||||
/**
|
||||
* @brief This function handles DMA1 Channel 7 Interrupt.
|
||||
*/
|
||||
|
@ -357,8 +357,8 @@ void DMA1_Channel7_IRQHandler(void)
|
|||
|
||||
/* USER CODE END DMA1_Channel7_IRQn 1 */
|
||||
}
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
|
||||
void EXTI3_IRQHandler(void)
|
||||
{
|
||||
/* USER CODE BEGIN EXTI3_IRQn 0 */
|
||||
|
@ -371,7 +371,7 @@ void EXTI3_IRQHandler(void)
|
|||
|
||||
/* USER CODE END EXTI3_IRQn 1 */
|
||||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
/**
|
||||
* @brief This function handles EXTI Lines [4] Interrupt.
|
||||
|
@ -426,7 +426,7 @@ void EXTI15_10_IRQHandler(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
#if 0
|
||||
|
||||
/**
|
||||
* @brief This function handles USART2 Interrupt.
|
||||
*/
|
||||
|
@ -440,7 +440,7 @@ void USART2_IRQHandler(void)
|
|||
|
||||
/* USER CODE END USART2_IRQn 1 */
|
||||
}
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief This function handles RTC Alarms (A and B) Interrupt.
|
||||
*/
|
||||
|
@ -449,9 +449,9 @@ void RTC_Alarm_IRQHandler(void)
|
|||
/* USER CODE BEGIN RTC_Alarm_IRQn 0 */
|
||||
|
||||
/* USER CODE END RTC_Alarm_IRQn 0 */
|
||||
#if 1
|
||||
|
||||
HAL_RTC_AlarmIRQHandler(&hrtc);
|
||||
#endif
|
||||
|
||||
/* USER CODE BEGIN RTC_Alarm_IRQn 1 */
|
||||
|
||||
/* USER CODE END RTC_Alarm_IRQn 1 */
|
||||
|
|
|
@ -116,11 +116,11 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
|||
GPIO_InitStruct.Pin = USARTx_RX_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_ANALOG;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
//GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
//GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
|
||||
GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
#if 0
|
||||
|
||||
/* USART2 DMA Init */
|
||||
/* USART2_TX Init */
|
||||
hdma_usart2_tx.Instance = DMA1_Channel7;
|
||||
|
@ -136,7 +136,7 @@ void HAL_UART_MspInit(UART_HandleTypeDef* uartHandle)
|
|||
{
|
||||
Error_Handler();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef STM32WL55xx
|
||||
if (HAL_DMA_ConfigChannelAttributes(&hdma_usart2_tx, DMA_CHANNEL_NPRIV) != HAL_OK)
|
||||
{
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-877539789554811708" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-752586124573436390" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
@ -16,7 +16,7 @@
|
|||
<provider copy-of="extension" id="org.eclipse.cdt.ui.UserLanguageSettingsProvider"/>
|
||||
<provider-reference id="org.eclipse.cdt.core.ReferencedProjectsLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider-reference id="org.eclipse.cdt.managedbuilder.core.MBSLanguageSettingsProvider" ref="shared-provider"/>
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-877539789554811708" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<provider class="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" console="false" env-hash="-752586124573436390" id="com.st.stm32cube.ide.mcu.toolchain.armnone.setup.CrossBuiltinSpecsDetector" keep-relative-paths="false" name="MCU ARM GCC Built-in Compiler Settings" parameter="${COMMAND} ${FLAGS} -E -P -v -dD "${INPUTS}"" prefer-non-shared="true">
|
||||
<language-scope id="org.eclipse.cdt.core.gcc"/>
|
||||
<language-scope id="org.eclipse.cdt.core.g++"/>
|
||||
</provider>
|
||||
|
|
Binary file not shown.
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue