/* USER CODE BEGIN Header */
|
/**
|
******************************************************************************
|
* @file : main.h
|
* @brief : Header for main.c file.
|
* This file contains the common defines of the application.
|
******************************************************************************
|
* @attention
|
*
|
* <h2><center>© Copyright (c) 2019 STMicroelectronics.
|
* All rights reserved.</center></h2>
|
*
|
* This software component is licensed by ST under BSD 3-Clause license,
|
* the "License"; You may not use this file except in compliance with the
|
* License. You may obtain a copy of the License at:
|
* opensource.org/licenses/BSD-3-Clause
|
*
|
******************************************************************************
|
*/
|
/* USER CODE END Header */
|
|
/* Define to prevent recursive inclusion -------------------------------------*/
|
#ifndef __MAIN_H
|
#define __MAIN_H
|
|
#ifdef __cplusplus
|
extern "C" {
|
#endif
|
|
/* Includes ------------------------------------------------------------------*/
|
#include "stm32l0xx_hal.h"
|
|
/* Private includes ----------------------------------------------------------*/
|
/* USER CODE BEGIN Includes */
|
#include "Usart.h"
|
#include "serial_at_cmd_app.h"
|
#include "led.h"
|
#include "dw_app.h"
|
#include "global_param.h"
|
/* USER CODE END Includes */
|
|
/* Exported types ------------------------------------------------------------*/
|
/* USER CODE BEGIN ET */
|
extern SPI_HandleTypeDef hspi1;
|
extern UART_HandleTypeDef huart1;
|
extern uint8_t g_start_send_flag,bat_percent,group_id;
|
extern ADC_HandleTypeDef hadc;
|
extern LPTIM_HandleTypeDef hlptim1;
|
extern uint16_t lastpoll_count,interval_count,slot_startcount,tag_frequency,tyncpoll_time,waitusart_timer;
|
typedef uint32_t u32;
|
typedef uint16_t u16;
|
typedef uint8_t u8;
|
extern uint16_t slottime,max_slotpos,current_slotnum;
|
void SetNextPollTime(u16 time);
|
void MX_ADC_Init(void);
|
void MX_ADC_DeInit(void);
|
/* USER CODE END ET */
|
|
/* Exported constants --------------------------------------------------------*/
|
/* USER CODE BEGIN EC */
|
#define LPTIMER_LSB 30.518 //1 puls=30.518us
|
#define LPTIMER_1S_COUNT 32767
|
#define USART_KEEPWAKE_TIME 2
|
#define KEY_KEEPRESET_TIME 5
|
/* USER CODE END EC */
|
|
/* Exported macro ------------------------------------------------------------*/
|
/* USER CODE BEGIN EM */
|
|
/* USER CODE END EM */
|
|
void HAL_TIM_MspPostInit(TIM_HandleTypeDef *htim);
|
|
/* Exported functions prototypes ---------------------------------------------*/
|
void Error_Handler(void);
|
|
/* USER CODE BEGIN EFP */
|
|
/* USER CODE END EFP */
|
|
/* Private defines -----------------------------------------------------------*/
|
#define BAT_MEAS_Pin GPIO_PIN_1
|
#define BAT_MEAS_GPIO_Port GPIOA
|
#define SPI_CS_Pin GPIO_PIN_4
|
#define SPI_CS_GPIO_Port GPIOA
|
#define BAT_MEAS_GND_Pin GPIO_PIN_0
|
#define BAT_MEAS_GND_GPIO_Port GPIOB
|
#define USER_KEY_Pin GPIO_PIN_1
|
#define USER_KEY_GPIO_Port GPIOB
|
#define USER_KEY_EXTI_IRQn EXTI0_1_IRQn
|
#define RADIO_BUSY_Pin GPIO_PIN_2
|
#define RADIO_BUSY_GPIO_Port GPIOB
|
#define INPUT_5V_Pin GPIO_PIN_11
|
#define INPUT_5V_GPIO_Port GPIOB
|
#define LED1_G_Pin GPIO_PIN_12
|
#define LED1_G_GPIO_Port GPIOB
|
#define LED1_R_Pin GPIO_PIN_13
|
#define LED1_R_GPIO_Port GPIOB
|
#define DW_CTRL_Pin GPIO_PIN_12
|
#define DW_CTRL_GPIO_Port GPIOA
|
#define LED2_G_Pin GPIO_PIN_15
|
#define LED2_G_GPIO_Port GPIOA
|
#define RADIO_DIO1_Pin GPIO_PIN_3
|
#define RADIO_DIO1_GPIO_Port GPIOB
|
#define RADIO_DIO1_EXTI_IRQn EXTI2_3_IRQn
|
#define RADIO_nRESET_Pin GPIO_PIN_4
|
#define RADIO_nRESET_GPIO_Port GPIOB
|
#define RADIO_NSS_Pin GPIO_PIN_5
|
#define RADIO_NSS_GPIO_Port GPIOB
|
#define SDA_Pin GPIO_PIN_8
|
#define SDA_GPIO_Port GPIOB
|
#define SCL_Pin GPIO_PIN_9
|
#define SCL_GPIO_Port GPIOB
|
/* USER CODE BEGIN Private defines */
|
#define GET_IMUINT HAL_GPIO_ReadPin(GPIOA,GPIO_PIN_0)
|
#define GET_USERKEY HAL_GPIO_ReadPin(USER_KEY_GPIO_Port,USER_KEY_Pin)
|
#define STATIONARY_TIME 3
|
|
//uint32_t PWR_CTL_Pin=GPIO_PIN_9;
|
#define RADIO_SCK_Pin GPIO_PIN_5
|
#define RADIO_SCK_GPIO_Port GPIOA
|
#define RADIO_MISO_Pin GPIO_PIN_6
|
#define RADIO_MISO_GPIO_Port GPIOA
|
#define RADIO_MOSI_Pin GPIO_PIN_7
|
#define RADIO_MOSI_GPIO_Port GPIOA
|
#define OUT1_Pin GPIO_PIN_12
|
#define OUT1_GPIO_Port GPIOB
|
#define LED1_Pin GPIO_PIN_13
|
#define LED1_GPIO_Port GPIOB
|
/* USER CODE END Private defines */
|
|
#ifdef __cplusplus
|
}
|
#endif
|
|
#endif /* __MAIN_H */
|
|
/************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
|