229 lines
8.8 KiB
C
229 lines
8.8 KiB
C
/**
|
|
*********************************************************************************************************
|
|
* Copyright(c) 2022, Realtek Semiconductor Corporation. All rights reserved.
|
|
*********************************************************************************************************
|
|
* @file board.h
|
|
* @brief header file of FindMy demo
|
|
* @details
|
|
* @author Scarlett_liang
|
|
* @date 2023-4-17
|
|
* @version v2.0.0
|
|
* *********************************************************************************************************
|
|
*/
|
|
|
|
#ifndef _BOARD_H_
|
|
#define _BOARD_H_
|
|
|
|
#ifdef __cplusplus
|
|
extern "C" {
|
|
#endif
|
|
|
|
#define USE_UARP
|
|
|
|
#define COMMON_FMNA 0 /* Common Demo FMNA */
|
|
#define E_DEMO_FMNA 1 /* E Customer Demo FMNA */
|
|
|
|
#define FMNA_HD_PLATFORM_SEL E_DEMO_FMNA /* FMNA Hardware Platform selection */
|
|
|
|
/*******************************************************
|
|
* Feature Config
|
|
*******************************************************/
|
|
#define APP_MAX_LINKS 2 /* Config APP LE link number */
|
|
|
|
#define DEBUG /* enable debug control point procedures */
|
|
|
|
#define FEAUTRE_SUPPORT_FLASH_2_BIT_MODE 1 /* set 1 to enable flash 2-bit mode */
|
|
|
|
/* Notice: This feature requires upperstack image at version 1.0.63.0 or higher! */
|
|
#define SUPPORT_DYNAMIC_SERVICE 0 /* set 1 to support Service Availability feature */
|
|
|
|
/*******************************************************
|
|
* Custom APP Config
|
|
*******************************************************/
|
|
#define SUPPORT_CUSTOMIZED_APP 1 /* set 1 to support customized app, not GFPS */
|
|
|
|
#define CUST_APP_ONLY_CONN 0 //Custom APP only connects but does not pair
|
|
#define CUST_APP_PAIRED 1 //Custom APP needs to be paired
|
|
|
|
#if SUPPORT_CUSTOMIZED_APP
|
|
#define CUST_APP_TYPE CUST_APP_ONLY_CONN //Select one of the above custom APP types
|
|
/* If the custom APP needs HID service, set it to 1.
|
|
And CUST_APP_TYPE must be set to CUST_APP_PAIRED */
|
|
#define CUST_HID_SERVICE 0
|
|
#endif
|
|
#define ONE_SHOT_ADV_EN (1 && (SUPPORT_CUSTOMIZED_APP || GFPS_FEATURE_SUPPORT)) /* set 1 to support ONE SHOT ADV function */
|
|
|
|
/*******************************************************
|
|
* OTA Config
|
|
*******************************************************/
|
|
//#define USE_UARP /* enable firmware update function */
|
|
#define DFU_TEMP_BUFFER_SIZE 512 /* dfu max buffer size */
|
|
|
|
/*******************************************************
|
|
* Log Config
|
|
*******************************************************/
|
|
#define IS_RELEASE_VERSION 0 /* 1: close all log 0: open log */
|
|
#define FMNA_DISABLE_LOGS 0 /* 1: close fmna log 0: open fmna log */
|
|
#define IS_PRINT_REMAINING_RAM_SIZE 0 /* 1: print 0: not print */
|
|
|
|
/*******************************************************
|
|
* KEY Config
|
|
*******************************************************/
|
|
#if (FMNA_HD_PLATFORM_SEL == COMMON_FMNA)
|
|
#define TRIGGER_BUTTON P1_1
|
|
#define GPIO_TRIG_PIN GPIO_GetPin(TRIGGER_BUTTON)
|
|
#define TRIG_BUTTON_IRQ GPIO9_IRQn
|
|
#define trig_button_handler GPIO9_Handler
|
|
|
|
#elif (FMNA_HD_PLATFORM_SEL == E_DEMO_FMNA)
|
|
#define TRIGGER_BUTTON P1_1
|
|
#define GPIO_TRIG_PIN GPIO_GetPin(TRIGGER_BUTTON)
|
|
#define TRIG_BUTTON_IRQ GPIO9_IRQn
|
|
#define trig_button_handler GPIO9_Handler
|
|
#endif
|
|
|
|
/* customized adv trig pin define*/
|
|
#if SUPPORT_CUSTOMIZED_APP
|
|
#define CUST_ADV_PIN P4_1
|
|
#define GPIO_CUST_ADV_PIN GPIO_GetPin(CUST_ADV_PIN)
|
|
#define CUST_ADV_PIN_IRQ GPIO29_IRQn
|
|
#define cust_adv_pin_handler GPIO29_Handler
|
|
#endif
|
|
|
|
/*******************************************************
|
|
* BUZZER Module Config
|
|
*******************************************************/
|
|
#if (FMNA_HD_PLATFORM_SEL == COMMON_FMNA)
|
|
#define USE_ACTIVE_BUZZER 1 /* set 1 to use active buzzer function */
|
|
|
|
#elif (FMNA_HD_PLATFORM_SEL == E_DEMO_FMNA)
|
|
#define USE_PAM8904_BUZZER 1 /* set 1 to use PAM8904 & buzzer function */
|
|
#endif
|
|
|
|
#define SOUND_LED_EN 0 /* set 1 to enable LED to simulate SOUND feature */
|
|
|
|
#define PWM_FREQ 0
|
|
#define PWM_DEFAULT_FREQ 4000
|
|
#define PWM_LOW_FREQ 4000
|
|
#define PWM_MEDIUM_FREQ PWM_DEFAULT_FREQ
|
|
#define PWM_HIGH_FREQ 4000
|
|
|
|
#if SOUND_LED_EN
|
|
#define SOUND_LED_PIN P0_1
|
|
|
|
#elif USE_ACTIVE_BUZZER
|
|
#define PWM_OUT_PIN P0_1
|
|
#undef PWM_FREQ
|
|
#define PWM_FREQ PWM_DEFAULT_FREQ /* unit: Hz*/
|
|
|
|
#elif USE_PAM8904_BUZZER
|
|
#define PAM8904_DIN P4_0
|
|
#define PAM8904_EN P2_7
|
|
#define PWM_OUT_PIN PAM8904_DIN
|
|
#undef PWM_FREQ
|
|
#define PWM_FREQ PWM_DEFAULT_FREQ /* unit: Hz*/
|
|
#endif
|
|
|
|
/*******************************************************
|
|
* G-Sensor Module Config
|
|
*******************************************************/
|
|
#if (FMNA_HD_PLATFORM_SEL == COMMON_FMNA)
|
|
#define USE_DA213B_SENSOR 1 /* set 1 to use DA213B to detect motion */
|
|
#define ACTIVE_DUR 9 /* active duration time = (ACTIVE_DUR + 1)* 1ms */
|
|
#define ACTIVE_TH 2 /* Threshold of active interrupt = ACTIVE_TH * 3.91mg (2g range) */
|
|
|
|
#elif (FMNA_HD_PLATFORM_SEL == E_DEMO_FMNA)
|
|
#define USE_DA213B_SENSOR 1 /* set 1 to use DA213B to detect motion */
|
|
#define ACTIVE_DUR 99 /* active duration time = (ACTIVE_DUR + 1)* 1ms */
|
|
#define ACTIVE_TH 60 /* Threshold of active interrupt = ACTIVE_TH * 3.91mg (2g range) */
|
|
#endif
|
|
|
|
#if USE_DA213B_SENSOR
|
|
#define I2C_DA213B_SCL_PIN P2_4
|
|
#define I2C_DA213B_SDA_PIN P2_5
|
|
#endif
|
|
|
|
/*******************************************************
|
|
* Battery Module Config
|
|
*******************************************************/
|
|
#define SUPPORT_BAT_DETECT_FEATURE 1 /* set 1 to enable battery detect feature */
|
|
|
|
#if SUPPORT_BAT_DETECT_FEATURE
|
|
|
|
/* Note: make sure BAT_ENTER_NORMAL_MODE_THRESHOLD > BAT_ENTER_NORMAL_MODE_THRESHOLD */
|
|
#define BAT_ENTER_LOW_POWER_THRESHOLD 2000 /* enter low power mode threshold, unit: mV */
|
|
#define BAT_ENTER_NORMAL_MODE_THRESHOLD 2200 /* enter normal mode threshold, unit: mV */
|
|
#define BAT_ENTER_OTA_MODE_THRESHOLD 2500 /* enter ota mode threshold, unit: mV */
|
|
|
|
#define SUPPORT_LITHIUM_BAT_DETECT_FEATURE 0 /* set 1 to detect the lithium battery power */
|
|
|
|
/* Change the ADC sampling pin here! */
|
|
/** ADC sample channel config:P2_2,P2_3,P2_6,P2_7 and VBAT
|
|
* If ADC_PIN = P2_2, then ADC_CHANNEL = 0;
|
|
* If ADC_PIN = P2_3, then ADC_CHANNEL = 1;
|
|
* If ADC_PIN = P2_6, then ADC_CHANNEL = 2;
|
|
* If ADC_PIN = P2_7, then ADC_CHANNEL = 3;
|
|
*/
|
|
#if SUPPORT_LITHIUM_BAT_DETECT_FEATURE
|
|
#define ADC_PIN P2_6
|
|
#define ADC_CHANNEL 2
|
|
#define VOLTAGE_DIVIDER 4.0 /* Vbat:Vadc = 4:1 */
|
|
#endif
|
|
|
|
#endif
|
|
|
|
/*******************************************************
|
|
* NFC Module Config
|
|
*******************************************************/
|
|
/* This feature is not complete yet, it will be added in the future. */
|
|
#define SUPPORT_NFC 0 /* set 1 to support NFC */
|
|
|
|
/*******************************************************
|
|
* DLPS Module Config
|
|
*******************************************************/
|
|
/** @brief Config DLPS: 0-Disable DLPS, 1-Enable DLPS */
|
|
#define DLPS_EN 1
|
|
|
|
/** @defgroup IO Driver Config
|
|
* @note user must config it firstly!! Do not change macro names!!
|
|
* @{
|
|
*/
|
|
/* if use user define dlps enter/dlps exit callback function */
|
|
#define USE_USER_DEFINE_DLPS_EXIT_CB 1
|
|
#define USE_USER_DEFINE_DLPS_ENTER_CB 1
|
|
|
|
/* if use any peripherals below, #define it 1 */
|
|
#define USE_I2C0_DLPS 1
|
|
#define USE_I2C1_DLPS 0
|
|
#define USE_TIM_DLPS 1
|
|
#define USE_QDECODER_DLPS 0
|
|
#define USE_IR_DLPS 0
|
|
#define USE_ADC_DLPS 1
|
|
#define USE_CTC_DLPS 0
|
|
#define USE_SPI0_DLPS 0
|
|
#define USE_SPI1_DLPS 0
|
|
#define USE_SPI2W_DLPS 0
|
|
#define USE_KEYSCAN_DLPS 0
|
|
#define USE_GPIO_DLPS 1
|
|
#define USE_CODEC_DLPS 0
|
|
#define USE_I2S0_DLPS 0
|
|
#define USE_ENHTIM_DLPS 0
|
|
#define USE_UART0_DLPS 0
|
|
#define USE_UART1_DLPS 0
|
|
|
|
/* do not modify USE_IO_DRIVER_DLPS macro */
|
|
#define USE_IO_DRIVER_DLPS (USE_I2C0_DLPS | USE_I2C1_DLPS | USE_TIM_DLPS | USE_QDECODER_DLPS\
|
|
| USE_IR_DLPS | USE_ADC_DLPS | USE_CTC_DLPS | USE_SPI0_DLPS\
|
|
| USE_SPI1_DLPS | USE_SPI2W_DLPS | USE_KEYSCAN_DLPS\
|
|
| USE_GPIO_DLPS | USE_CODEC_DLPS | USE_I2S0_DLPS\
|
|
| USE_ENHTIM_DLPS | USE_UART0_DLPS | USE_UART1_DLPS\
|
|
| USE_USER_DEFINE_DLPS_ENTER_CB\
|
|
| USE_USER_DEFINE_DLPS_EXIT_CB)
|
|
|
|
#ifdef __cplusplus
|
|
}
|
|
#endif
|
|
|
|
#endif
|
|
|