00001
00005 #ifndef _PINIO_H
00006 #define _PINIO_H
00007
00008 #include "config.h"
00009
00010
00011
00012
00013 #define _x_step(st) WRITE(X_STEP_PIN, st)
00014 #define x_step() _x_step(1);
00015 #ifndef X_INVERT_DIR
00016 #define x_direction(dir) WRITE(X_DIR_PIN, dir)
00017 #else
00018 #define x_direction(dir) WRITE(X_DIR_PIN, (dir)^1)
00019 #endif
00020 #ifdef X_MIN_PIN
00021 #ifndef X_INVERT_MIN
00022 #define x_min() (READ(X_MIN_PIN)?1:0)
00023 #else
00024 #define x_min() (READ(X_MIN_PIN)?0:1)
00025 #endif
00026 #else
00027 #define x_min() (0)
00028 #endif
00029
00030
00031
00032
00033 #define _y_step(st) WRITE(Y_STEP_PIN, st)
00034 #define y_step() _y_step(1);
00035 #ifndef Y_INVERT_DIR
00036 #define y_direction(dir) WRITE(Y_DIR_PIN, dir)
00037 #else
00038 #define y_direction(dir) WRITE(Y_DIR_PIN, (dir)^1)
00039 #endif
00040 #ifdef Y_MIN_PIN
00041 #ifndef Y_INVERT_MIN
00042 #define y_min() (READ(Y_MIN_PIN)?1:0)
00043 #else
00044 #define y_min() (READ(Y_MIN_PIN)?0:1)
00045 #endif
00046 #else
00047 #define y_min() (0)
00048 #endif
00049
00050
00051
00052
00053 #if defined Z_STEP_PIN && defined Z_DIR_PIN
00054 #define _z_step(st) WRITE(Z_STEP_PIN, st)
00055 #define z_step() _z_step(1);
00056 #ifndef Z_INVERT_DIR
00057 #define z_direction(dir) WRITE(Z_DIR_PIN, dir)
00058 #else
00059 #define z_direction(dir) WRITE(Z_DIR_PIN, (dir)^1)
00060 #endif
00061 #else
00062 #define _z_step(x) do { } while (0)
00063 #define z_step() do { } while (0)
00064 #define z_direction(x) do { } while (0)
00065 #endif
00066 #ifdef Z_MIN_PIN
00067 #ifndef Z_INVERT_MIN
00068 #define z_min() (READ(Z_MIN_PIN)?1:0)
00069 #else
00070 #define z_min() (READ(Z_MIN_PIN)?0:1)
00071 #endif
00072 #else
00073 #define z_min() (0)
00074 #endif
00075
00076 #ifndef ESTOP_INVERT_IN
00077 #define estop_hit() (READ(ESTOP_IN_PIN) ? 1 : 0)
00078 #else
00079 #define estop_hit() (READ(ESTOP_IN_PIN) ? 0 : 1)
00080 #endif
00081
00082
00083
00084
00085
00086
00087 #define unstep() do { _x_step(0); _y_step(0); _z_step(0); } while (0)
00088
00089 #endif