⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 irstate.h

📁 这是一个SIGMA方案的PMP播放器的UCLINUX程序,可播放DVD,VCD,CD MP3...有很好的参考价值.
💻 H
字号:
#ifndef _IR_STATE_H#define _IR_STATE_H#define IR_PIO              1       /* PIO0 pin used for ir sensor *//////////////////////////////////////////////////////////////////////////////////////////// ir state machine:// PIO 1 is high, we can proceed to state 2 only when PIO 1 goes low#define IR_STATE_WAIT_FOR_COMMAND_START		1// PIO 1 is low, save the time (t0) at this moment and go to state 3#define IR_STATE_COMMAND_START				2// PIO 1 is low, we can proceed to state 4 only when PIO 1 goes high#define IR_STATE_COMMAND					3  // PIO 1 is high, current time = t1, if (t1-t0) < 8ms go back to state 1,// else proceed to state 5#define IR_STATE_COMMAND_END				4// PIO 1 is high, save the time (t0) at this moment and go to state 6#define IR_STATE_LEADER_PULSE_START			5// PIO 1 is high, we can only proceed to state 7 when PIO 5 goes low#define IR_STATE_LEADER_PULSE				6// PIO 1 is low, current time = t1, if (t1-t0) < 3.5ms, then the last key was kept// pressed down, go to state 8, else go to state 12#define IR_STATE_LEADER_PULSE_END			7// PIO 1 is low, we can proceed to state 9 only when PIO 1 goes high#define IR_STATE_REPEAT_PULSE_START			8// PIO 1 is low, set bit_position to 31, go to state 13, save current time as t0#define IR_STATE_READ_SCAN_CODE				12// PIO 1 is low, we can only proceed to state 14 when PIO 1 goes high#define IR_SUBSTATE_READ_BIT_START			13// PIO 1 is high, we can only go to state 15 when PIO 1 goes low#define IR_SUBSTATE_READ_BIT_HIGH			14// PIO 1 is low, current time = t1, if (t1-t0) > 1.75ms // scan_code |= (1 << bit_position)// decrement bit position, if bit_posiion < 0, go to state 1, else go to state 13#define IR_SUBSTATE_READ_BIT_LOW			15 // error recovery state - ignore all input for 70ms#define IR_STATE_ERROR_RECOVERY				20typedef struct tagIR_STATE{	int state;		// initialize to 1	int timer_load;		// initialize to value in TIMER_LOAD_REG	int timer_scale;        // timer prescale value	int repeat;             // no initialization required	int scan_code;		// no initialization required	int bit_position;	// no initialization required	int t0;			// no initialization required	int error_recovery;	// no initialization required	int release_timeout;	// no initialization required} IR_STATE;extern IR_STATE ir_state;#define IR_REPEAT 4// call this function for each pio interrupt// return 0 or 1 idf a scancode has been received.int ir_pio();int ir_state_machine (IR_STATE *ir_state);//#define POLL_USING_TIMER 1//#define USE_FIQ	1#define USE_IRQ 1void ir_init(void);#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -