📄 hardware.h
字号:
/***************************************************************************************************************/
#define COM_DBG 0 //The COM port is occupied by the DEBUG interface
#define COM_WLM 1 //The COM port is occupied by the wireless module interface
#define COM_DBG_B 2 //The COM port is busy on a DEBUG session debug message
//In such state, a port switch is forbiden
#define COM_WLM_B 3 //The COM port is busy on a session with wireless module
//In such state, a port switch is forbiden
/***************************************************************************************************************/
//values for IO pins direction
#define P_INPUT 1
#define P_OUTPUT 0
//Defination for PORTA
#define RST_WL LATAbits.LATA0 //Reset wireless module
#define PA0_DIRECT P_OUTPUT
#define KSI4 LATAbits.LATA1 //Key scan output
#define PA1_DIRECT P_OUTPUT
#define EN_HS LATAbits.LATA2
#define PA2_DIRECT P_OUTPUT //Control the MIC of handset, 1 for enable
#define PA3_DIRECT P_INPUT //......
#define EN_HF LATAbits.LATA4 //Hand free amplifier control
#define PA4_DIRECT P_OUTPUT
#define RST_WL2 LATAbits.LATA5 //Secondary reset control pin of wirelless module, ON/OFF
#define PA5_DIRECT P_OUTPUT
//PortB
#define PB0_DIRECT P_INPUT //INT0
#define PB1_DIRECT P_INPUT //INT1
#define PB2_DIRECT P_INPUT //INT2
#define PB3_DIRECT P_INPUT //......
#define KEY_PRESS PORTBbits.RB4 //Key press state
#define PB4_DIRECT P_INPUT
#define HANDLE PORTBbits.RB5 //Handle state
#define PB5_DIRECT P_INPUT
//leave RB6, RB7 for debug pins
//PortC
#define RST_LCD LATCbits.LATC0 //Reset LCD
#define PC0_DIRECT P_OUTPUT
#define LED_CTL LATCbits.LATC1 //Control keypad leds and background light of LCD
#define PC1_DIRECT P_OUTPUT
#define PC2_DIRECT P_INPUT //......
//RC3, RC4 for I2C
#define WP LATCbits.LATC5 //Write protect control of serial EEPROM
#define PC5_DIRECT P_OUTPUT
//RC6, RC7 for USART
//PortD as system bus
//PortE as system bus
//PortF
#define KSO0 PORTFbits.RF0 //Key scan input
#define PF0_DIRECT P_INPUT
#define KSO1 PORTFbits.RF1 //Key scan input
#define PF1_DIRECT P_INPUT
#define KSI1 LATFbits.LATF2 //Key scan output
#define PF2_DIRECT P_OUTPUT
#define PF3_DIRECT P_INPUT //......
#define PF4_DIRECT P_INPUT //......
#define PF5_DIRECT P_INPUT //......
#define KSI2 LATFbits.LATF6 //Key scan output
#define PF6_DIRECT P_OUTPUT
#define KSI3 LATFbits.LATF7 //Key scan output
#define PF7_DIRECT P_OUTPUT
//PortG as system bus control
//PortH
#define KSI0 LATHbits.LATH4 //Key scan output
#define PH4_DIRECT P_OUTPUT
#define KSO4 PORTHbits.RH5 //Key scan input
#define PH5_DIRECT P_INPUT
#define KSO3 PORTHbits.RH6 //Key scan input
#define PH6_DIRECT P_INPUT
#define KSO2 PORTHbits.RH7 //Key scan input
#define PH7_DIRECT P_INPUT
//PortJ as system bus
#define BIT0 0b00000001
#define BIT1 0b00000010
#define BIT2 0b00000100
#define BIT3 0b00001000
#define BIT4 0b00010000
#define BIT5 0b00100000
#define BIT6 0b01000000
#define BIT7 0b10000000
#define Func_CloseLight() LED_CTL = 0
#define Func_OpenLight() LED_CTL = 1
//Public functions of FuncHW.c
void Func_Brd_Init(void);
void Func_SetVoiceCh(INT8U ctl);
void Func_ResetWM(void);
unsigned char Func_ReadCOMMode(void);
unsigned char Func_ChangeCOMMode(unsigned char mode);
//void Func_CloseLight(void);
//void Func_OpenLight(void);
void Func_Start_UART(void);
void HW_Bd_Test(void); //This function is in the funcRamTst.asm
void Func_Start_TMR1(void);
void Func_Receive_ISR(void);
void Func_RB_ISR(void);
void Func_TMR2_ISR(void);
void Func_TMR0_ISR(void);
void Func_INT2_ISR(void);
void Func_Transmit_ISR(void);
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -