WL55JC_AS923/Core/Inc/main.h

220 lines
5.8 KiB
C

/* USER CODE BEGIN Header */
/**
******************************************************************************
* @file : main.h
* @brief : Header for main.c file.
* This file contains the common defines of the application.
******************************************************************************
* @attention
*
* Copyright (c) 2021 STMicroelectronics.
* All rights reserved.
*
* This software is licensed under terms that can be found in the LICENSE file
* in the root directory of this software component.
* If no LICENSE file comes with this software, it is provided AS-IS.
*
******************************************************************************
*/
/* USER CODE END Header */
/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MAIN_H
#define __MAIN_H
#ifdef __cplusplus
extern "C" {
#endif
/* Includes ------------------------------------------------------------------*/
#include "stm32wlxx_hal.h"
/* Private includes ----------------------------------------------------------*/
/* USER CODE BEGIN Includes */
/* USER CODE END Includes */
/* Exported types ------------------------------------------------------------*/
/* USER CODE BEGIN ET */
/* USER CODE END ET */
/* Exported constants --------------------------------------------------------*/
/* USER CODE BEGIN EC */
/* USER CODE END EC */
/* Exported macro ------------------------------------------------------------*/
/* USER CODE BEGIN EM */
/* USER CODE END EM */
/* Exported functions prototypes ---------------------------------------------*/
void Error_Handler(void);
/* USER CODE BEGIN EFP */
/* USER CODE END EFP */
/* Private defines -----------------------------------------------------------*/
#define RTC_N_PREDIV_S 10
#define RTC_PREDIV_S ((1<<RTC_N_PREDIV_S)-1)
#define RTC_PREDIV_A ((1<<(15-RTC_N_PREDIV_S))-1)
#define LED1_Pin GPIO_PIN_15
#define LED1_GPIO_Port GPIOB
#define LED2_Pin GPIO_PIN_9
#define LED2_GPIO_Port GPIOB
#define BUT1_Pin GPIO_PIN_0
#define BUT1_GPIO_Port GPIOA
#define BUT1_EXTI_IRQn EXTI0_IRQn
#define PROB2_Pin GPIO_PIN_13
#define PROB2_GPIO_Port GPIOB
#define PROB1_Pin GPIO_PIN_12
#define PROB1_GPIO_Port GPIOB
#define BUT3_Pin GPIO_PIN_6
#define BUT3_GPIO_Port GPIOC
#define BUT3_EXTI_IRQn EXTI9_5_IRQn
#define BUT2_Pin GPIO_PIN_1
#define BUT2_GPIO_Port GPIOA
#define BUT2_EXTI_IRQn EXTI1_IRQn
#define LED3_Pin GPIO_PIN_11
#define LED3_GPIO_Port GPIOB
#define USARTx_RX_Pin GPIO_PIN_3
#define USARTx_RX_GPIO_Port GPIOA
#define USARTx_TX_Pin GPIO_PIN_2
#define USARTx_TX_GPIO_Port GPIOA
#define USART1_RX_Pin GPIO_PIN_7
#define USART1_RX_GPIO_Port GPIOB
#define USART1_TX_Pin GPIO_PIN_6
#define USART1_TX_GPIO_Port GPIOB
#ifdef RC
#define TIM1_PRESCALER_VALUE 47L // 1 us for stm32wle5xx 48Mhz
#define TIM1_PERIOD_VALUE 79L // 80 us
// REMOTE CONTROL EV1527/HS1527 LORA-WAN RELAY NODE
#define RC_K0_Pin GPIO_PIN_5
#define RC_K0_GPIO_Port GPIOA
#define RC_K1_Pin GPIO_PIN_6
#define RC_K1_GPIO_Port GPIOA
#define RC_K2_Pin GPIO_PIN_7
#define RC_K2_GPIO_Port GPIOA
#define RC_K3_Pin GPIO_PIN_4
#define RC_K3_GPIO_Port GPIOC
/*
#define RC_K4_Pin GPIO_PIN_6
#define RC_K4_GPIO_Port GPIOC
#define RC_K5_Pin GPIO_PIN_6
#define RC_K5_GPIO_Port GPIOC
#define RC_K6_Pin GPIO_PIN_6
#define RC_K6_GPIO_Port GPIOC
#define RC_K7_Pin GPIO_PIN_6
#define RC_K7_GPIO_Port GPIOC
*/
#define RC_D0_Pin GPIO_PIN_1
#define RC_D0_GPIO_Port GPIOB
#define RC_D1_Pin GPIO_PIN_2
#define RC_D1_GPIO_Port GPIOB
#define RC_D2_Pin GPIO_PIN_4
#define RC_D2_GPIO_Port GPIOB
#define RC_D3_Pin GPIO_PIN_14
#define RC_D3_GPIO_Port GPIOB
#define RC_D4_Pin GPIO_PIN_8
#define RC_D4_GPIO_Port GPIOB
#define RC_D5_Pin GPIO_PIN_5
#define RC_D5_GPIO_Port GPIOB
#define RC_D6_Pin GPIO_PIN_3
#define RC_D6_GPIO_Port GPIOB
#define RC_D7_Pin GPIO_PIN_12
#define RC_D7_GPIO_Port GPIOB
#define RC_VT_Pin GPIO_PIN_13
#define RC_VT_GPIO_Port GPIOB
#define RC_SET_Pin GPIO_PIN_6
#define RC_SET_GPIO_Port GPIOB
#define RC_NONE 0x00 // 0000
#define RC_POWER_ON 0x01 // 0001
#define RC_POWER_OFF 0x03 // 0011
#define RC_PIC_FIRST 0x02 // 0010
#define RC_PIC_NEXT 0x06 // 0110
#define RC_SHOW_5S 0x08 // 1000
#define RC_SHOW_10S 0x09 // 1001
#define RC_SHOW_15S 0x04 // 0100
#define RC_SHOW_30S 0x0C // 1100
#define DATA_433_PIN GPIO_PIN_9
#define DATA_433_GPIO_PORT GPIOA
#define DATA_433_GPIO_CLK_ENABLE() __HAL_RCC_GPIOA_CLK_ENABLE();
#define RF_Send_GPIO_Port GPIOA
#define RF_Send_GPIO_Pin GPIO_PIN_8
#define RF_Receive_GPIO_Port GPIOA
#define RF_Receive_GPIO_Pin GPIO_PIN_9
#define RF_Receive_GPIO_CLK_EN() __HAL_RCC_GPIOA_CLK_ENABLE();
#endif
#define I2C2_SCL_PIN GPIO_PIN_12
#define I2C2_SDA_PIN GPIO_PIN_11
#define I2C2_SCL_PORT GPIOA
#define I2C2_SDA_PORT GPIOA
#define COUNTOF(__BUFFER__) (sizeof(__BUFFER__) / sizeof(*(__BUFFER__)))
#define TXBUFFERSIZE (COUNTOF(aTxBuffer) - 1)
/* Size of Reception buffer */
#define RXBUFFERSIZE TXBUFFERSIZE
/*
* FOR STM32WLE5CCU6 UFQFPN48 PA12 PA11
*
#define I2C2_STANDARD_100K 0x00000E14
#define I2C2_FAST_400K 0x00000004
#define I2C2_FAST_PLUS_1M 0x00000000
*/
/*
* FOR STM32WL55JCIX UFBGA73 PA12 PA11
*/
#define I2C2_STANDARD_100K 0x10805D88
#define I2C2_FAST_400K 0x0090194B
#define I2C2_FAST_PLUS_1M 0x00700814
/* USER CODE BEGIN Private defines */
#ifdef STS_WS
#define HX711_SCK_PIN GPIO_PIN_5
#define HX711_DOUT_PIN GPIO_PIN_6
#define HX711_SCK_PORT GPIOA
#define HX711_DOUT_PORT GPIOA
#endif
/* USER CODE END Private defines */
#ifdef __cplusplus
}
#endif
#endif /* __MAIN_H */