bad test...port 0 , current 90uA
This commit is contained in:
parent
87209a5205
commit
b80a30aebc
|
@ -57,10 +57,12 @@ void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
__HAL_RCC_GPIOB_CLK_DISABLE();
|
||||
__HAL_RCC_GPIOC_CLK_DISABLE();
|
||||
__HAL_RCC_GPIOA_CLK_DISABLE();
|
||||
//__HAL_RCC_GPIOA_CLK_DISABLE();
|
||||
/*Configure GPIO pin Output Level */
|
||||
#if 0
|
||||
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;
|
||||
|
@ -70,8 +72,8 @@ void MX_GPIO_Init(void)
|
|||
HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
|
||||
#endif
|
||||
/*Configure GPIO pins : PAPin PAPin */
|
||||
GPIO_InitStruct.Pin = BUT1_Pin|BUT2_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_FALLING;
|
||||
GPIO_InitStruct.Pin = BUT1_Pin;
|
||||
GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING_FALLING;
|
||||
GPIO_InitStruct.Pull = GPIO_PULLUP;
|
||||
HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
|
||||
#if 0
|
||||
|
@ -91,13 +93,13 @@ void MX_GPIO_Init(void)
|
|||
/* EXTI interrupt init*/
|
||||
HAL_NVIC_SetPriority(EXTI0_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI0_IRQn);
|
||||
|
||||
#if 0
|
||||
HAL_NVIC_SetPriority(EXTI1_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI1_IRQn);
|
||||
|
||||
HAL_NVIC_SetPriority(EXTI9_5_IRQn, 0, 0);
|
||||
HAL_NVIC_EnableIRQ(EXTI9_5_IRQn);
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
/* USER CODE BEGIN 2 */
|
||||
|
|
|
@ -85,18 +85,20 @@ 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_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_SuspendTick();
|
||||
/* Clear Status Flag before entering STOP/STANDBY Mode */
|
||||
|
@ -124,7 +126,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)
|
||||
|
@ -446,10 +446,17 @@ void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
|
|||
{
|
||||
case BUT1_Pin:
|
||||
/* Note: when "EventType == TX_ON_TIMER" this GPIO is not initialized */
|
||||
if (EventType == TX_ON_EVENT)
|
||||
//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);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case BUT2_Pin:
|
||||
UTIL_SEQ_SetTask((1 << CFG_SEQ_Task_LoRaStopJoinEvent), CFG_SEQ_Prio_0);
|
||||
|
@ -577,6 +584,7 @@ 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();
|
||||
|
@ -612,6 +620,8 @@ static void SendTxData(void)
|
|||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = 0;
|
||||
AppData.Buffer[i++] = batteryLevel;
|
||||
AppData.Buffer[i++] = door_status;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue