📄 stepper.h
字号:
//Copyright (C) Apr 5 ,2006 by chenggang SHan//function headers#ifndef _stepper_h#define _stepper_htypedef struct Stepper { /* status fields */ int current_phase; // the current phase position int total_steps; // the total number of steps eg: 200 for KP39 int current_step; // the step where the motor is positioned /* motor and control setup */ int sleep_mode; // 0 = usleep(), 1 = loop int delay; // busy loop how much times? int curve; //step by curve int turn; //turn left/right int half_stepping; // if true, enables smoother phase switching int short_path; // when going from step 199 to 1, move only 2 step instead of all the way around int accelerate; // if true, accelerate and decelerate motor when delay is over accelerate int accelerate_from; // the speed to start with when accelerating. eg: 10000 int accelerate_min; // the minimum speed to use acceleration. eg: 12000. //If delay<12000 then USE_ACCELERATION else START AT delay speed int accelerate_step; int accelerate_conststeps;//the mininum distance (steps) ,overrun it to use acceleration. unsigned int io_address; // PD[0-7] ioport} Stepper;#define Stepper_Driver "scg stepper driver v1.0"#define rPCOND 0x1d2001c#define rPDATD 0x1d20020#define rPUPD 0x1d20024#define rPCONC 0x1d20010#define rPDATC 0x1d20014#define rPUPC 0x1d20018 #define Major 254#include<linux/ioctl.h> /*幻数*/int steps,a;/* * Function command codes for io_ctl. */// IOCTL字应该是标准的,0, 1,3这样肯定不行的,有IOCTL幻数/* Use 'g' as magic number */#define STEPPER_IOC_MAGIC 'g'#define Stepper_On _IO(STEPPER_IOC_MAGIC, 0)#define Stepper_Off _IO(STEPPER_IOC_MAGIC, 1)#define Stepper_Front _IOW(STEPPER_IOC_MAGIC, 2, steps)#define Stepper_Back _IOW(STEPPER_IOC_MAGIC, 3, steps)#define Stepper_Left _IOW(STEPPER_IOC_MAGIC, 4, steps)#define Stepper_Right _IOW(STEPPER_IOC_MAGIC, 5, steps)#define Stepper_Left_Curve _IOW(STEPPER_IOC_MAGIC, 6, steps)#define Stepper_Right_Curve _IOW(STEPPER_IOC_MAGIC, 7, steps)#define Stepper_Half _IO(STEPPER_IOC_MAGIC, 8)#define Stepper_Full _IO(STEPPER_IOC_MAGIC, 9)#define Use_Accel _IOW(STEPPER_IOC_MAGIC, 10, a)#define Accel_From _IOW(STEPPER_IOC_MAGIC, 11, a)#define Accel_Min _IOW(STEPPER_IOC_MAGIC, 12, a)#define Accel_Step _IOW(STEPPER_IOC_MAGIC, 13, a)#define Limit_Speed _IOW(STEPPER_IOC_MAGIC, 14, a)#define Average_Speed _IOW(STEPPER_IOC_MAGIC, 15, a)#define Set_ShortPath _IOW(STEPPER_IOC_MAGIC, 16, a)#define Set_Zero _IO(STEPPER_IOC_MAGIC, 17)#define Goto_Step _IOW(STEPPER_IOC_MAGIC, 18, steps)#endif /* _stepper_h */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -