Compare commits
2 Commits
b80a30aebc
...
aa2cbe2709
Author | SHA1 | Date |
---|---|---|
|
aa2cbe2709 | |
|
fcd5f8b310 |
|
@ -55,28 +55,32 @@ void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
__HAL_RCC_GPIOB_CLK_DISABLE();
|
||||
__HAL_RCC_GPIOC_CLK_DISABLE();
|
||||
//__HAL_RCC_GPIOA_CLK_DISABLE();
|
||||
/*Configure GPIO pin Output Level */
|
||||
__HAL_RCC_GPIOB_CLK_ENABLE();
|
||||
__HAL_RCC_GPIOC_CLK_ENABLE();
|
||||
|
||||
GPIO_InitStruct.Pin = BUT1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
|
||||
#if 0
|
||||
/*Configure GPIO pin Output Level */
|
||||
HAL_GPIO_WritePin(GPIOB, LED1_Pin|LED2_Pin|PROB2_Pin|PROB1_Pin
|
||||
|LED3_Pin, GPIO_PIN_RESET);
|
||||
#endif
|
||||
#if 0
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = LED1_Pin|LED2_Pin|LED3_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
GPIO_InitStruct.Pull = GPIO_NOPULL;
|
||||
GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_HIGH;
|
||||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
#endif
|
||||
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = BUT1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||
GPIO_InitStruct.Pin = BUT1_Pin|BUT2_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
#if 0
|
||||
|
||||
/*Configure GPIO pins : PBPin PBPin */
|
||||
GPIO_InitStruct.Pin = PROB2_Pin|PROB1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
|
||||
|
|
|
@ -85,21 +85,18 @@ void PWR_EnterOffMode(void)
|
|||
void PWR_ExitOffMode(void)
|
||||
{
|
||||
/* USER CODE BEGIN ExitOffMode_1 */
|
||||
HAL_ResumeTick();
|
||||
|
||||
/* USER CODE END ExitOffMode_1 */
|
||||
}
|
||||
|
||||
void PWR_EnterStopMode(void)
|
||||
{
|
||||
/* USER CODE BEGIN EnterStopMode_1 */
|
||||
#if 0
|
||||
HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOC, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All|~GPIO_PIN_0, GPIO_PIN_RESET);
|
||||
|
||||
HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
#endif
|
||||
/* USER CODE END EnterStopMode_1 */
|
||||
//HAL_GPIO_WritePin(GPIOB, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
//HAL_GPIO_WritePin(GPIOC, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
//HAL_GPIO_WritePin(GPIOA, GPIO_PIN_All, GPIO_PIN_RESET);
|
||||
HAL_SuspendTick();
|
||||
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
||||
LL_PWR_ClearFlag_C1STOP_C1STB();
|
||||
|
@ -126,7 +123,7 @@ void PWR_ExitStopMode(void)
|
|||
SRAM ctrls, DMAx, DMAMux, AES, RNG, HSEM */
|
||||
|
||||
/* Resume not retained USARTx and DMA */
|
||||
//vcom_Resume();
|
||||
vcom_Resume();
|
||||
/* USER CODE BEGIN ExitStopMode_2 */
|
||||
|
||||
/* USER CODE END ExitStopMode_2 */
|
||||
|
|
|
@ -342,7 +342,7 @@ static UTIL_TIMER_Object_t JoinLedTimer;
|
|||
|
||||
/* Exported functions ---------------------------------------------------------*/
|
||||
/* USER CODE BEGIN EF */
|
||||
volatile uint8_t door_status=0, door_previous_status=0, door_change_flag=0;
|
||||
|
||||
/* USER CODE END EF */
|
||||
|
||||
void LoRaWAN_Init(void)
|
||||
|
@ -448,14 +448,7 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
||||
//if (EventType == TX_ON_EVENT)
|
||||
{
|
||||
door_status = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0);
|
||||
if (door_status != door_previous_status) {
|
||||
door_change_flag =1;
|
||||
door_previous_status = door_status;
|
||||
|
||||
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
}
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaSendOnTxTimerOrButtonEvent), CFG_SEQ_Prio_0);
|
||||
}
|
||||
break;
|
||||
case BUT2_Pin:
|
||||
|
@ -584,7 +577,6 @@ static void SendTxData(void)
|
|||
APP_LOG(TS_ON, VLEVEL_M, "temp: %d\r\n", (int16_t)(sensor_data.temperature));
|
||||
|
||||
AppData.Port = LORAWAN_USER_APP_PORT;
|
||||
AppData.Port = 2;
|
||||
|
||||
#ifdef CAYENNE_LPP
|
||||
CayenneLppReset();
|
||||
|
@ -618,10 +610,8 @@ static void SendTxData(void)
|
|||
{
|
||||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = batteryLevel;
|
||||
AppData.Buffer[i++] = door_status;
|
||||
AppData.Buffer[i++] = (uint8_t)(99*GetBatteryLevel()/255); /* 1 (very low) to 254 (fully charged) */
|
||||
AppData.Buffer[i++] = HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue