📄 global.h
字号:
//////////////////////////////////////////////////////////////////////////
// /src/global.h
//////////////////////////////////////////////////////////////////////////
//Added by Chen Hongquan.
//Well I'd like to define some usefull macro in order to control our valves
//and other component conveniently.
///////////////////////////////////////////////////////////////////////////
#ifndef __GLOBAL_H
#define __GLOBAL_H
//Here is keyboard code defination.
#define KEY1_PRESS_MASK 0x10
#define KEY2_PRESS_MASK 0x20
#define KEY3_PRESS_MASK 0x40
#define KEY4_PRESS_MASK 0x80
#define KEY1_RELEASE_MASK ~KEY1_PRESS_MASK
#define KEY2_RELEASE_MASK ~KEY2_PRESS_MASK
#define KEY3_RELEASE_MASK ~KEY3_PRESS_MASK
#define KEY4_RELEASE_MASK ~KEY4_PRESS_MASK
//Keyboard check delay.
//'cause I'd like to call _delay_ms function with this macro.
#define KEY_CHECK_DELAY 20
//LED control mask.
//We can just use PORTX | LEDX_OFF to turn off the LED.
//And use PORX & LEDX_ON to turn on the LED.
#define LED1_OFF 0x80
#define LED2_OFF 0x40
#define LED3_OFF 0x02
#define LED4_OFF 0x01
#define LED1_ON ~LED1_OFF
#define LED2_ON ~LED2_OFF
#define LED3_ON ~LED3_OFF
#define LED4_ON ~LED4_OFF
//Valve control mask.
//The usage is same to LED control.
//Because there isn't any symbol to tag the valve.
//So I assumpt the one use IN4148 D1 is the No.1 and No2, No3.....
#define VALVE1_OFF 0x01
#define VALVE2_OFF 0x02
#define VALVE3_OFF 0x04
#define VALVE4_OFF 0x08
#define VALVE1_ON ~VALVE1_OFF
#define VALVE2_ON ~VALVE2_OFF
#define VALVE3_ON ~VALVE3_OFF
#define VALVE4_ON ~VALVE4_OFF
//Timer value.
//These timer values need to be implemented.
#define ONE_SEC
//Valve related time periods.
#define VALVE_TS1
#define VALVE_TS2
#define VALVE_TS3
//AD.
//This is the period of one round ad sampling.
#define AD_SAMPLE_TICK_TIMER
//These macro are 2 referrence pressure digital value.
//They should be set properly under test.
#define AD_PV1
#define AD_PV2
//LED.
//At the beginning, I'd like to make LED flash twice to tell us LED's OK.
//So the flash time should be a short period.
#define LED_FLASH_PERIOD 2000
#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -