Skip to content

Commit

Permalink
Merge pull request #148 from dl1ycf/PR
Browse files Browse the repository at this point in the history
Some small corrections
  • Loading branch information
g0orx authored Oct 28, 2021
2 parents 6788bc0 + 3f8e1fa commit a7550d3
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 41 deletions.
28 changes: 5 additions & 23 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ LINK=gcc

ifeq ($(MIDI_INCLUDE),MIDI)
MIDI_OPTIONS=-D MIDI
MIDI_HEADERS= midi.h midi_menu.h
MIDI_HEADERS= midi.h midi_menu.h alsa_midi.h
ifeq ($(UNAME_S), Darwin)
MIDI_SOURCES= mac_midi.c midi2.c midi3.c
MIDI_SOURCES= mac_midi.c midi2.c midi3.c midi_menu.c
MIDI_OBJS= mac_midi.o midi2.o midi3.o midi_menu.o
MIDI_LIBS= -framework CoreMIDI -framework Foundation
endif
Expand Down Expand Up @@ -129,30 +129,12 @@ PTT_OPTIONS=-D PTT
endif

ifeq ($(GPIO_INCLUDE),GPIO)
GPIO_OPTIONS=-D GPIO
GPIOD_VERSION=$(shell pkg-config --modversion libgpiod)
ifeq ($(GPIOD_VERSION),1.2)
GPIOD_OPTIONS=-D OLD_GPIOD
GPIO_OPTIONS += -D OLD_GPIOD
endif
GPIO_OPTIONS=-D GPIO
GPIO_LIBS=-lgpiod -li2c
GPIO_SOURCES= \
configure.c \
i2c.c \
gpio.c \
encoder_menu.c \
switch_menu.c
GPIO_HEADERS= \
configure.h \
i2c.h \
gpio.h \
encoder_menu.h \
switch_menu.h
GPIO_OBJS= \
configure.o \
i2c.o \
gpio.o \
encoder_menu.o \
switch_menu.o
endif

#
Expand Down Expand Up @@ -207,7 +189,7 @@ endif
//CFLAGS= -g -Wno-deprecated-declarations -O3
CFLAGS= -g -Wno-deprecated-declarations
OPTIONS=$(SMALL_SCREEN_OPTIONS) $(MIDI_OPTIONS) $(PURESIGNAL_OPTIONS) $(REMOTE_OPTIONS) $(USBOZY_OPTIONS) \
$(GPIO_OPTIONS) $(GPIOD_OPTIONS) $(SOAPYSDR_OPTIONS) $(LOCALCW_OPTIONS) \
$(GPIO_OPTIONS) $(SOAPYSDR_OPTIONS) $(LOCALCW_OPTIONS) \
$(STEMLAB_OPTIONS) \
$(PTT_OPTIONS) \
$(SERVER_OPTIONS) \
Expand Down
12 changes: 4 additions & 8 deletions gpio.c
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,7 @@ SWITCH switches_controller1[MAX_FUNCTIONS][MAX_SWITCHES]={
{{TRUE,TRUE,27,MOX,0L},
{TRUE,TRUE,13,MENU_FREQUENCY,0L},
{TRUE,TRUE,12,MENU_MEMORY,0L},
{TRUE,TRUE,6,RIT,0L},
{TRUE,TRUE,6,RIT_ENABLE,0L},
{TRUE,TRUE,5,RIT_PLUS,0L},
{TRUE,TRUE,24,RIT_MINUS,0L},
{TRUE,TRUE,23,RIT_CLEAR,0L},
Expand All @@ -253,7 +253,7 @@ SWITCH switches_controller1[MAX_FUNCTIONS][MAX_SWITCHES]={
{{TRUE,TRUE,27,MOX,0L},
{TRUE,TRUE,13,MENU_FREQUENCY,0L},
{TRUE,TRUE,12,MENU_MEMORY,0L},
{TRUE,TRUE,6,XIT,0L},
{TRUE,TRUE,6,XIT_ENABLE,0L},
{TRUE,TRUE,5,XIT_PLUS,0L},
{TRUE,TRUE,24,XIT_MINUS,0L},
{TRUE,TRUE,23,XIT_CLEAR,0L},
Expand Down Expand Up @@ -1088,22 +1088,18 @@ void gpio_close() {
void gpio_cw_sidetone_set(int level) {
int rc;
if (ENABLE_GPIO_SIDETONE) {
#ifdef GPIO
#ifdef OLD_GPIOD
if((rc=gpiod_ctxless_set_value(gpio_device,SIDETONE_GPIO,level,FALSE,consumer,NULL,NULL))<0) {
#else
if((rc=gpiod_ctxless_set_value_ext(gpio_device,SIDETONE_GPIO,level,FALSE,consumer,NULL,NULL,0))<0) {
#endif
g_print("%s: err=%d\n",__FUNCTION__,rc);
}
#endif
}
}

int gpio_left_cw_key() {
}

int gpio_right_cw_key() {
}

int gpio_cw_sidetone_enabled() {
return ENABLE_GPIO_SIDETONE;
}
Expand Down
2 changes: 0 additions & 2 deletions gpio.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,8 +88,6 @@ extern int ENABLE_GPIO_SIDETONE;
extern int ENABLE_CW_BUTTONS;
extern int CW_ACTIVE_LOW;
extern void gpio_cw_sidetone_set(int level);
extern int gpio_left_cw_key();
extern int gpio_right_cw_key();
extern int gpio_cw_sidetone_enabled();
#endif

Expand Down
8 changes: 0 additions & 8 deletions iambic.c
Original file line number Diff line number Diff line change
Expand Up @@ -238,14 +238,6 @@ extern int clock_nanosleep(clockid_t __clock_id, int __flags,
struct timespec *__rem);
#endif

#ifndef GPIO
//
// Dummy functions if compiled without GPIO
//
int gpio_cw_sidetone_enabled() { return 0; }
void gpio_cw_sidetone_set(int level) {}
#endif

void keyer_update() {
//
// This function will take notice of changes in the following variables
Expand Down
1 change: 1 addition & 0 deletions mac_midi.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
#include "adc.h"
#include "dac.h"
#include "radio.h"
#include "actions.h"
#include "midi.h"
#include "midi_menu.h"

Expand Down

0 comments on commit a7550d3

Please sign in to comment.