1 #ifndef _FAST_GPIO_MAIN_H_
2 #define _FAST_GPIO_MAIN_H_
14 #include <fastgpioomega.h>
15 #include <fastgpioomega2.h>
17 #define FASTGPIO_VERBOSITY_QUIET (0)
18 #define FASTGPIO_VERBOSITY_NORMAL (1)
19 #define FASTGPIO_VERBOSITY_ALL (2)
20 #define FASTGPIO_VERBOSITY_JSON (3)
22 #define FASTGPIO_DEFAULT_VERBOSITY (FASTGPIO_VERBOSITY_NORMAL)
23 #define FASTGPIO_DEFAULT_DEBUG (0)
25 #define FASTGPIO_VERBOSE 0
26 #define FASTGPIO_DEBUG 0
28 #define PID_FILE "/tmp/pin%d_pwm_pid"
30 #define FASTGPIO_STDOUT_STRING "> %s GPIO%d: %s\n"
31 #define FASTGPIO_JSON_STRING "{\"cmd\":\"%s\", \"pin\":%d, \"val\":\"%s\"}\n"
33 #define FASTGPIO_CMD_STRING_SET "Set"
34 #define FASTGPIO_CMD_STRING_READ "Read"
35 #define FASTGPIO_CMD_STRING_SET_DIR "Set direction"
36 #define FASTGPIO_CMD_STRING_GET_DIR "Get direction"
37 #define FASTGPIO_CMD_STRING_PWM "Set PWM"
38 #define FASTGPIO_CMD_STRING_PULSES "Pulses"
43 typedef enum e_GpioCmd {
48 GPIO_CMD_SET_DIRECTION,
49 GPIO_CMD_GET_DIRECTION,
61 int pinDir; // 0 - input, 1 - output
63 unsigned long int bitMask;
83 // function definitions
84 void initGpioSetup (gpioSetup* obj);
86 void usage (const char* progName);
87 int parseArguments (const char* progName, int argc, char* argv[], gpioSetup *setup);
89 int gpioRun (gpioSetup* setup);
90 int pwmRun (gpioSetup* setup);
92 int noteChildPid (int pinNum, int pid);
93 int killOldProcess (int pinNum);
94 int checkOldProcess (gpioSetup *setup);
96 int pulseGpio(FastGpio *gpioObj,int pinNum, char* pathToFile, int repeats);
100 #endif // _FAST_GPIO_MAIN_H_