150 lines
4.1 KiB
C
150 lines
4.1 KiB
C
/*
|
||
******************************************************************************
|
||
*
|
||
* @file define.h
|
||
* @brief define module
|
||
*
|
||
*
|
||
* @version 1.0
|
||
* @date 2023/07/12 09:59:40
|
||
* @author Alex Xu
|
||
*
|
||
* Copyright (c) 2013-2099,Tkplusemi Technology Co.,Ltd.
|
||
* All Rights Reserved
|
||
*
|
||
* History:
|
||
* Revision Date Author Desc
|
||
* 1.0.0 2023/07/12 Alex build this file
|
||
******************************************************************************
|
||
*/
|
||
#ifndef __DEFINE_H__
|
||
#define __DEFINE_H__
|
||
|
||
#include "config.h"
|
||
|
||
/*程序版本,第一个数代表在硬件存在改动不能兼容之前版本时加1,
|
||
第二个数在功能存在改动时加1,第三个数在软件调试出现不同的
|
||
测试版本时改动;高位数字变动时,低位数字清零。*/
|
||
|
||
#define FW_VER0 0x01 //程序版本0:代表在硬件存在改动不能兼容之前版本时加1
|
||
#define FW_VER1 0x01 //程序版本1:代表在功能存在改动时加1
|
||
#define FW_VER2 0x02 //程序版本2:代表在软件调试出现不同的测试版本时改动时加1
|
||
|
||
/* 芯片类型选择:SY8836合封OVP芯片 */
|
||
//#define SY8836
|
||
|
||
/*Function Select,功能选择宏定义*/
|
||
|
||
/*VOX充放电功能选择:1、开关盖VOX充放电;2、Vox耳机插拔自适应充放电。二者只能选一。*/
|
||
|
||
#define VOX_ADT_ENABLE 1 //Vox自适应充放电,不带Hall(自选)(禁用KEY、HALL功能)486Bytes
|
||
|
||
/* 灯效功能选择;1、188数码管;2、4颗LED;3、呼吸灯 三者只能选一。选择LED显示,不需要Timer1。*/
|
||
|
||
#define LED_DISPLAY 1 //LED显示,3个灯显示,带呼吸 (814Bytes),具体灯个数和灯效需要在对应源码中选择更改。
|
||
|
||
/*呼吸灯功能,需要使用Timer1。*/
|
||
|
||
#if LED_DISPLAY
|
||
|
||
#define TIMER1_ENABLE
|
||
|
||
#define BREATHING_LIGHT //呼吸灯功能(自选),驱动函数置于Timer1中断处理函数中,调用周期100us,具体灯个数和灯效需要在对应源码中选择更改。
|
||
|
||
#endif
|
||
|
||
/* 公共功能选择宏定义,其中自选部分根据需求选择,必选部分勿动。 (其中需要调整参数的可在System_Init()中进行配置。)*/
|
||
|
||
#define VOX_ENABLE 1 //Vox功能配置(必选)
|
||
|
||
//#define VOX_TX //Vox发码功能(545Bytes)
|
||
|
||
#define UART0_ENABLE 0 //UART0功能,用于程序调试(自选)。(85Bytes)
|
||
|
||
#define WTG_ENABLE 1 //看门狗功能使能(必选)(7Bytes)
|
||
|
||
#define HALL_ENABLE //Hall功能(自选)(35Bytes)
|
||
|
||
#define KEY_ENABLE //Key功能(自选)(78Bytes)
|
||
|
||
#define CHARGER_ENABLE 1 //Charger功能(必选) 231Bytes
|
||
|
||
#define DISCHARGE_ENABLE 1 //Boost放电功能(必选)93Bytes
|
||
|
||
#define VOX_TX_PATTERN 1 //GPIO Pattern (227Bytes)
|
||
|
||
#define VOX_FOLLOW_CHG 1 //VOX跟随充(自选)ADT:356Bytes,HALL:165Bytes
|
||
|
||
#define SLEEP_ENABLE 1 //休眠功能(必选)91Bytes
|
||
|
||
#define ADC_ENABLE 1 //ADC功能(必选)476Bytes
|
||
|
||
#if ADC_ENABLE
|
||
#define NTC_ENABLE //NTC保护功能(自选)298Bytes
|
||
#endif
|
||
|
||
#define BAT_VALUE 1 //电量计功能(自选)147Bytes
|
||
|
||
//#define _DEBUG_ALL //打开打印功能
|
||
|
||
#ifdef _DEBUG_ALL
|
||
|
||
// #define _DEBUG_MAIN
|
||
// #define _DEBUG_KEY
|
||
// #define _DEBUG_VOX
|
||
// #define _DEBUG_HALL
|
||
// #define _DEBUG_ADC
|
||
// #define _DEBUG_DISCHARGE
|
||
// #define _DEBUG_CHARGER
|
||
// #define _DEBUG_SLEEP
|
||
// #define _DEBUG_BAT
|
||
|
||
//#define TEST_MODE
|
||
|
||
#include "stdio.h"
|
||
#include "string.h"
|
||
|
||
#endif
|
||
|
||
#define HIBYTE(v1) ((uint8_t)((v1)>>8)) //v1 is uint16_t
|
||
#define LOBYTE(v1) ((uint8_t)((v1)&0xFF))
|
||
|
||
typedef bit BIT;
|
||
typedef unsigned char uint8_t;
|
||
typedef unsigned int uint16_t;
|
||
typedef unsigned long uint32_t;
|
||
|
||
typedef unsigned char uint8;
|
||
typedef unsigned int uint16;
|
||
typedef unsigned long uint32;
|
||
|
||
typedef signed char int8_t;
|
||
typedef signed int int16_t;
|
||
typedef signed long int32_t;
|
||
|
||
typedef signed char int8;
|
||
typedef signed int int16;
|
||
typedef signed long int32;
|
||
|
||
typedef signed char s8;
|
||
typedef unsigned char u8;
|
||
typedef signed short int s16;
|
||
typedef unsigned short int u16;
|
||
typedef signed long int s32;
|
||
typedef unsigned long int u32;
|
||
|
||
typedef enum{false = 0, true = !false} bool;
|
||
|
||
#define FALSE false
|
||
#define TRUE true
|
||
#define ON true
|
||
#define OFF false
|
||
|
||
#include "reg3310.h"
|
||
#if UART0_ENABLE
|
||
#include "uart.h"
|
||
#endif
|
||
|
||
#endif
|
||
|