42 lines
1.3 KiB
C
Executable File
42 lines
1.3 KiB
C
Executable File
#if !defined(__IO_H__)
|
|
#define __IO_H__
|
|
|
|
#include <wiringPi.h>
|
|
#include <stdio.h>
|
|
#include <syslog.h>
|
|
|
|
#define GPIO_LED_MOTRUN 17 // GPIO Pin for LED motor is running
|
|
#define GPIO_OUT_PWRON 22 // GPIO Pin for output "Ignition Key"
|
|
|
|
#define GPIO_KEY_STOP 26 // GPIO Pin for Key "Stop"
|
|
#define GPIO_KEY_PWRUP 5 // GPIO Pin for Key "Increase Power"
|
|
#define GPIO_KEY_PWRDOWN 6 // GPIO Pin for Key "Decrease Power"
|
|
|
|
#define KEY_RISING_FILTERCYCLES 5 // filter value for input rising edge
|
|
#define KEY_FALLING_FILTERCYCLES 15 // filter value for input falling edge
|
|
#define KEY_START_REPEAT_CYCLECOUNT 50 // number of cycles when to start repeating key presses
|
|
#define KEY_REPEAT_CYCLECOUNT 50 // number of cycles how often to repeat key presses
|
|
|
|
// data structure for a key
|
|
struct GPIO_KEY_DATA
|
|
{
|
|
int iKeyPin;
|
|
int iKeyValue;
|
|
int iKeyRisingEdge;
|
|
int iKeyFallingEdge;
|
|
unsigned int nHighCycleCounter;
|
|
unsigned int nLowCycleCounter;
|
|
int iKeyPressedCycleCounter;
|
|
int iKeyRepeatCycleCounter;
|
|
};
|
|
|
|
extern int iPowerSupplyOn;
|
|
|
|
int IO_Init();
|
|
void IO_DoCyclic();
|
|
void SetupKeyPin(struct GPIO_KEY_DATA *pdata, int iKeyPin);
|
|
void SetupOutputPin(int iOutPin);
|
|
void WriteOutputPin(int iOutPin, int iValue);
|
|
|
|
#endif
|