#include <fcntl.h>
#include <poll.h>
#include <sched.h>
+#ifdef GPIO
#include <wiringPi.h>
+#endif
#include <semaphore.h>
#include "band.h"
return 0;
}
+#ifdef GPIO
static unsigned long e2debounce=0;
static void e2FunctionAlert() {
}
}
#endif
+#endif // GPIO
void gpio_set_defaults(int ctrlr) {
g_print("gpio_set_defaults: %d\n",ctrlr);
if(value) PTT_ACTIVE_LOW=atoi(value);
#endif
+#ifdef GPIO
if(controller!=CONTROLLER1) {
value=getProperty("i2c_device");
if(value) {
}
}
+#endif
#ifdef LOCALCW
if(controller==CONTROLLER2_V2) {
sprintf(value,"%d",E5_FUNCTION);
setProperty("E5_FUNCTION",value);
+#ifdef GPIO
if(controller!=CONTROLLER1) {
setProperty("i2c_device",i2c_device);
sprintf(value,"%ud",i2c_address_1);
sprintf(value,"%ud",i2c_sw[i]);
setProperty(name,value);
}
-
}
+#endif
#ifdef LOCALCW
sprintf(value,"%d",ENABLE_CW_BUTTONS);
}
+#ifdef GPIO
static void setup_pin(int pin, int up_down, void(*pAlert)(void)) {
int rc;
g_print("setup_pin: pin=%d up_down=%d\n",pin,up_down);
//fprintf(stderr,"cwr button : level=%d \n",level);
keyer_event(0, CW_ACTIVE_LOW ? (level==0) : level);
}
-
-//
-// The following functions are an interface for
-// other parts to access CW gpio functions
-// (query left and right paddle, set sidetone output)
-//
-int gpio_left_cw_key() {
- int val=digitalRead(CWL_BUTTON);
- return CW_ACTIVE_LOW? (val==0) : val;
-}
-
-int gpio_right_cw_key() {
- int val=digitalRead(CWR_BUTTON);
- return CW_ACTIVE_LOW? (val==0) : val;
-}
-
-int gpio_cw_sidetone_enabled() {
- return ENABLE_GPIO_SIDETONE;
-}
-
-void gpio_cw_sidetone_set(int level) {
- if (ENABLE_GPIO_SIDETONE) {
- digitalWrite(SIDETONE_GPIO, level);
- }
-}
#endif
+#endif // GPIO
int gpio_init() {
gpio_restore_state();
+#ifdef GPIO
wiringPiSetup(); // use WiringPi pin numbers
if(ENABLE_VFO_ENCODER) {
}
#endif
+#endif
return 0;
}