Skip to content

Commit

Permalink
Merge pull request #4 from bloguetronica/v2.0
Browse files Browse the repository at this point in the history
V2.0
  • Loading branch information
samuelfmlourenco authored Jul 24, 2022
2 parents d614f15 + baba049 commit 933ed87
Show file tree
Hide file tree
Showing 120 changed files with 4,949 additions and 2,883 deletions.
7 changes: 4 additions & 3 deletions README.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,10 @@ to do is run "install.sh" by invoking "sudo ./install.sh" on a terminal
window, after changing your working directory to the current one. This script
will first obtain and install the required "build-essential" and
"libusb-1.0-0-dev" packages (if they are not installed yet). Then it will
compile the binaries and move them to "/usr/local/bin/". It will also copy
related man pages to "/usr/local/share/man/man1/". Finally, it will create the
necessary rules for accessing the device.
compile the binaries and move them to "/usr/local/bin/". Note that the build
process will also compress the respective man pages and copy them to
"/usr/local/share/man/man1/". Finally, it will create the necessary rules for
accessing the device.

The package also includes a test script named "test.sh". This will set up GF2
so that it generates a 1KHz triangle wave signal with its amplitude set to
Expand Down
122 changes: 63 additions & 59 deletions install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,71 +5,75 @@ apt-get -qq update
apt-get -qq install build-essential
apt-get -qq install libusb-1.0-0-dev
echo Copying source code files...
mkdir -p /usr/local/src/gf2
cp -f src/common.c /usr/local/src/gf2/.
cp -f src/common.h /usr/local/src/gf2/.
cp -f src/gf2-amp.c /usr/local/src/gf2/.
cp -f src/gf2-amp50.c /usr/local/src/gf2/.
cp -f src/gf2-clear.c /usr/local/src/gf2/.
cp -f src/gf2-clkoff.c /usr/local/src/gf2/.
cp -f src/gf2-clkon.c /usr/local/src/gf2/.
cp -f src/gf2-core.c /usr/local/src/gf2/.
cp -f src/gf2-core.h /usr/local/src/gf2/.
cp -f src/gf2-dacoff.c /usr/local/src/gf2/.
cp -f src/gf2-dacon.c /usr/local/src/gf2/.
cp -f src/gf2-freq.c /usr/local/src/gf2/.
cp -f src/gf2-freq0.c /usr/local/src/gf2/.
cp -f src/gf2-freq1.c /usr/local/src/gf2/.
cp -f src/gf2-list.c /usr/local/src/gf2/.
cp -f src/gf2-lockotp.c /usr/local/src/gf2/.
cp -f src/gf2-phase.c /usr/local/src/gf2/.
cp -f src/gf2-phase0.c /usr/local/src/gf2/.
cp -f src/gf2-phase1.c /usr/local/src/gf2/.
cp -f src/gf2-reset.c /usr/local/src/gf2/.
cp -f src/gf2-selfreq0.c /usr/local/src/gf2/.
cp -f src/gf2-selfreq1.c /usr/local/src/gf2/.
cp -f src/gf2-selphase0.c /usr/local/src/gf2/.
cp -f src/gf2-selphase1.c /usr/local/src/gf2/.
cp -f src/gf2-sine.c /usr/local/src/gf2/.
cp -f src/gf2-start.c /usr/local/src/gf2/.
cp -f src/gf2-status.c /usr/local/src/gf2/.
cp -f src/gf2-stop.c /usr/local/src/gf2/.
cp -f src/gf2-tri.c /usr/local/src/gf2/.
mkdir -p /usr/local/src/gf2/man
cp -f src/cp2130.cpp /usr/local/src/gf2/.
cp -f src/cp2130.h /usr/local/src/gf2/.
cp -f src/error.cpp /usr/local/src/gf2/.
cp -f src/error.h /usr/local/src/gf2/.
cp -f src/gf2-amp.cpp /usr/local/src/gf2/.
cp -f src/gf2-amp50.cpp /usr/local/src/gf2/.
cp -f src/gf2-clear.cpp /usr/local/src/gf2/.
cp -f src/gf2-clkoff.cpp /usr/local/src/gf2/.
cp -f src/gf2-clkon.cpp /usr/local/src/gf2/.
cp -f src/gf2-dacoff.cpp /usr/local/src/gf2/.
cp -f src/gf2-dacon.cpp /usr/local/src/gf2/.
cp -f src/gf2device.cpp /usr/local/src/gf2/.
cp -f src/gf2device.h /usr/local/src/gf2/.
cp -f src/gf2-freq.cpp /usr/local/src/gf2/.
cp -f src/gf2-freq0.cpp /usr/local/src/gf2/.
cp -f src/gf2-freq1.cpp /usr/local/src/gf2/.
cp -f src/gf2-info.cpp /usr/local/src/gf2/.
cp -f src/gf2-list.cpp /usr/local/src/gf2/.
cp -f src/gf2-lockotp.cpp /usr/local/src/gf2/.
cp -f src/gf2-phase.cpp /usr/local/src/gf2/.
cp -f src/gf2-phase0.cpp /usr/local/src/gf2/.
cp -f src/gf2-phase1.cpp /usr/local/src/gf2/.
cp -f src/gf2-reset.cpp /usr/local/src/gf2/.
cp -f src/gf2-selfreq0.cpp /usr/local/src/gf2/.
cp -f src/gf2-selfreq1.cpp /usr/local/src/gf2/.
cp -f src/gf2-selphase0.cpp /usr/local/src/gf2/.
cp -f src/gf2-selphase1.cpp /usr/local/src/gf2/.
cp -f src/gf2-sine.cpp /usr/local/src/gf2/.
cp -f src/gf2-start.cpp /usr/local/src/gf2/.
cp -f src/gf2-status.cpp /usr/local/src/gf2/.
cp -f src/gf2-stop.cpp /usr/local/src/gf2/.
cp -f src/gf2-tri.cpp /usr/local/src/gf2/.
cp -f src/GPL.txt /usr/local/src/gf2/.
cp -f src/LGPL.txt /usr/local/src/gf2/.
cp -f src/libusb-extra.c /usr/local/src/gf2/.
cp -f src/libusb-extra.h /usr/local/src/gf2/.
cp -f src/Makefile /usr/local/src/gf2/.
cp -f src/man/gf2-amp.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-amp50.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-clear.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-clkoff.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-clkon.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-dacoff.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-dacon.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-freq.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-freq0.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-freq1.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-info.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-list.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-lockotp.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-phase.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-phase0.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-phase1.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-reset.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-selfreq0.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-selfreq1.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-selphase0.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-selphase1.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-sine.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-start.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-status.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-stop.1 /usr/local/src/gf2/man/.
cp -f src/man/gf2-tri.1 /usr/local/src/gf2/man/.
cp -f src/README.txt /usr/local/src/gf2/.
echo Building and installing binaries...
make -C /usr/local/src/gf2 all install clean
echo Installing man pages...
mkdir -p /usr/local/share/man/man1
cp -f man/gf2-amp.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-amp50.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-clear.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-clkoff.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-clkon.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-dacoff.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-dacon.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-freq.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-freq0.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-freq1.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-list.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-lockotp.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-phase.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-phase0.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-phase1.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-reset.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-selfreq0.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-selfreq1.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-selphase0.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-selphase1.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-sine.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-start.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-status.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-stop.1.gz /usr/local/share/man/man1/.
cp -f man/gf2-tri.1.gz /usr/local/share/man/man1/.
cp -f src/utils.cpp /usr/local/src/gf2/.
cp -f src/utils.h /usr/local/src/gf2/.
echo Building and installing binaries and man pages...
make -C /usr/local/src/gf2 install clean
echo Applying configurations...
cat > /etc/udev/rules.d/70-bgtn-gf2.rules << EOF
SUBSYSTEM=="usb", ATTRS{idVendor}=="10c4", ATTRS{idProduct}=="8bf1", MODE="0666"
Expand Down
Binary file removed man/gf2-amp.1.gz
Binary file not shown.
Binary file removed man/gf2-amp50.1.gz
Binary file not shown.
Binary file removed man/gf2-clear.1.gz
Binary file not shown.
Binary file removed man/gf2-clkoff.1.gz
Binary file not shown.
Binary file removed man/gf2-clkon.1.gz
Binary file not shown.
Binary file removed man/gf2-dacoff.1.gz
Binary file not shown.
Binary file removed man/gf2-dacon.1.gz
Binary file not shown.
Binary file removed man/gf2-freq.1.gz
Binary file not shown.
Binary file removed man/gf2-freq0.1.gz
Binary file not shown.
Binary file removed man/gf2-freq1.1.gz
Binary file not shown.
Binary file removed man/gf2-list.1.gz
Binary file not shown.
Binary file removed man/gf2-lockotp.1.gz
Binary file not shown.
Binary file removed man/gf2-phase.1.gz
Binary file not shown.
Binary file removed man/gf2-phase0.1.gz
Binary file not shown.
Binary file removed man/gf2-phase1.1.gz
Binary file not shown.
Binary file removed man/gf2-reset.1.gz
Binary file not shown.
Binary file removed man/gf2-selfreq0.1.gz
Binary file not shown.
Binary file removed man/gf2-selfreq1.1.gz
Binary file not shown.
Binary file removed man/gf2-selphase0.1.gz
Binary file not shown.
Binary file removed man/gf2-selphase1.1.gz
Binary file not shown.
Binary file removed man/gf2-sine.1.gz
Binary file not shown.
Binary file removed man/gf2-start.1.gz
Binary file not shown.
Binary file removed man/gf2-status.1.gz
Binary file not shown.
Binary file removed man/gf2-stop.1.gz
Binary file not shown.
Binary file removed man/gf2-tri.1.gz
Binary file not shown.
42 changes: 32 additions & 10 deletions src/Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Makefile for all GF2 commands, Debian Linux (GCC)
# Copyright (c) 2018-2019 Samuel Lourenço
# Copyright (c) 2018-2022 Samuel Lourenço

# This program is free software: you can redistribute it and/or modify it
# under the terms of the GNU General Public License as published by the Free
Expand All @@ -18,28 +18,50 @@
# Please feel free to contact me via e-mail: samuel.fmlourenco@gmail.com


prefix = /usr/local

CC = gcc
CFLAGS = -O2 -std=gnu99 -Wall -pedantic
CFLAGS = -O2 -std=c11 -Wall -pedantic
CXX = g++
CXXFLAGS = -O2 -std=c++11 -Wall -pedantic
LDFLAGS = -s
LDLIBS = -lm -lusb-1.0
OBJECTS = common.o gf2-core.o libusb-extra.o
TARGETS = gf2-amp gf2-amp50 gf2-clear gf2-clkoff gf2-clkon gf2-dacoff gf2-dacon gf2-freq gf2-freq0 gf2-freq1 gf2-list gf2-lockotp gf2-phase gf2-phase0 gf2-phase1 gf2-reset gf2-selfreq0 gf2-selfreq1 gf2-selphase0 gf2-selphase1 gf2-sine gf2-start gf2-status gf2-stop gf2-tri
LDLIBS = -lusb-1.0
MANPAGES = gf2-amp.1 gf2-amp50.1 gf2-clear.1 gf2-clkoff.1 gf2-clkon.1 gf2-dacoff.1 gf2-dacon.1 gf2-freq.1 gf2-freq0.1 gf2-freq1.1 gf2-info.1 gf2-list.1 gf2-lockotp.1 gf2-phase.1 gf2-phase0.1 gf2-phase1.1 gf2-reset.1 gf2-selfreq0.1 gf2-selfreq1.1 gf2-selphase0.1 gf2-selphase1.1 gf2-sine.1 gf2-start.1 gf2-status.1 gf2-stop.1 gf2-tri.1
MANPAGESGZ = $(MANPAGES:=.gz)
MKDIR = mkdir -p
MV = mv -f
OBJECTS = cp2130.o error.o gf2device.o libusb-extra.o utils.o
RMDIR = rmdir --ignore-fail-on-non-empty
TARGETS = gf2-amp gf2-amp50 gf2-clear gf2-clkoff gf2-clkon gf2-dacoff gf2-dacon gf2-freq gf2-freq0 gf2-freq1 gf2-info gf2-list gf2-lockotp gf2-phase gf2-phase0 gf2-phase1 gf2-reset gf2-selfreq0 gf2-selfreq1 gf2-selphase0 gf2-selphase1 gf2-sine gf2-start gf2-status gf2-stop gf2-tri

.PHONY: all clean install uninstall

all: $(TARGETS)

$(TARGETS): % : %.o $(OBJECTS)
$(CC) $(LDFLAGS) $^ $(LDLIBS) -o $@
$(CXX) $(LDFLAGS) $^ $(LDLIBS) -o $@

%.o: %.c
$(CC) $(CFLAGS) -c $<

%.o: %.cpp
$(CXX) $(CXXFLAGS) -c $<

clean:
$(RM) *.o $(TARGETS)

install:
mv -f $(TARGETS) /usr/local/bin/.
install: all install-bin install-man

install-bin:
$(MKDIR) $(DESTDIR)$(prefix)/bin && $(MV) $(TARGETS) $(DESTDIR)$(prefix)/bin/.

install-man:
cd man && gzip -fknv9 $(MANPAGES) && $(MKDIR) $(DESTDIR)$(prefix)/share/man/man1 && $(MV) $(MANPAGESGZ) $(DESTDIR)$(prefix)/share/man/man1/.

uninstall: uninstall-man uninstall-bin clean

uninstall-bin:
cd $(DESTDIR)$(prefix)/bin && $(RM) $(TARGETS)

uninstall:
cd /usr/local/bin && $(RM) $(TARGETS)
uninstall-man:
if [ -d $(DESTDIR)$(prefix)/share/man/man1 ]; then cd $(DESTDIR)$(prefix)/share/man/man1 && $(RM) $(MANPAGESGZ) && $(RMDIR) $(DESTDIR)$(prefix)/share/man/man1; fi
97 changes: 64 additions & 33 deletions src/README.txt
Original file line number Diff line number Diff line change
@@ -1,45 +1,76 @@
This directory contains all source code files required for compiling the
commands for GF2 Function Generator. A list of relevant files follows:
– common.c;
– common.h;
– gf2-amp.c;
– gf2-amp50.c;
– gf2-clear.c;
– gf2-clkoff.c;
– gf2-clkon.c;
– gf2-core.c;
– gf2-core.h;
– gf2-dacoff.c;
– gf2-dacon.c;
– gf2-freq.c;
– gf2-freq0.c;
– gf2-freq1.c;
– gf2-list.c;
– gf2-lockotp.c;
– gf2-phase.c;
– gf2-phase0.c;
– gf2-phase1.c;
– gf2-reset.c;
– gf2-selfreq0.c;
– gf2-selfreq1.c;
– gf2-selphase0.c;
– gf2-selphase1.c;
– gf2-sine.c;
– gf2-start.c;
– gf2-status.c;
– gf2-stop.c;
– gf2-tri.c;
– cp2130.cpp;
– cp2130.h;
– error.cpp;
– error.h;
– gf2-amp.cpp;
– gf2-amp50.cpp;
– gf2-clear.cpp;
– gf2-clkoff.cpp;
– gf2-clkon.cpp;
– gf2-dacoff.cpp;
– gf2-dacon.cpp;
– gf2device.cpp;
– gf2device.h;
– gf2-freq.cpp;
– gf2-freq0.cpp;
– gf2-freq1.cpp;
– gf2-info.cpp;
– gf2-list.cpp;
– gf2-lockotp.cpp;
– gf2-phase.cpp;
– gf2-phase0.cpp;
– gf2-phase1.cpp;
– gf2-reset.cpp;
– gf2-selfreq0.cpp;
– gf2-selfreq1.cpp;
– gf2-selphase0.cpp;
– gf2-selphase1.cpp;
– gf2-sine.cpp;
– gf2-start.cpp;
– gf2-status.cpp;
– gf2-stop.cpp;
– gf2-tri.cpp;
– libusb-extra.c;
– libusb-extra.h;
– Makefile.
– Makefile;
– man/gf2-amp.1;
– man/gf2-amp50.1;
– man/gf2-clear.1;
– man/gf2-clkoff.1;
– man/gf2-clkon.1;
– man/gf2-dacoff.1;
– man/gf2-dacon.1;
– man/gf2-freq.1;
– man/gf2-freq0.1;
– man/gf2-freq1.1;
– man/gf2-info.1;
– man/gf2-list.1;
– man/gf2-lockotp.1;
– man/gf2-phase.1;
– man/gf2-phase0.1;
– man/gf2-phase1.1;
– man/gf2-reset.1;
– man/gf2-selfreq0.1;
– man/gf2-selfreq1.1;
– man/gf2-selphase0.1;
– man/gf2-selphase1.1;
– man/gf2-sine.1;
– man/gf2-start.1;
– man/gf2-status.1;
– man/gf2-stop.1;
– man/gf2-tri.1;
– utils.cpp;
– utils.h.

In order to compile successfully all commands, you must have the packages
"build-essential" and "libusb-1.0-0-dev" installed. Given that, if you wish to
simply compile, change your working directory to the current one on a terminal
window, and simply invoke "make" or "make all". If you wish to install besides
compiling, run "sudo make all install". Alternatively, if you wish to force a
rebuild, you should invoke "make clean all", or "sudo make clean all install"
if you prefer to install after rebuilding.
compiling, run "sudo make install". Alternatively, if you wish to force a
rebuild, you should invoke "make clean all", or "sudo make clean install" if
you prefer to install after rebuilding.

It may be necessary to undo any previous operations. Invoking "make clean"
will delete all object code generated (binaries included) during earlier
Expand Down
48 changes: 0 additions & 48 deletions src/common.c

This file was deleted.

Loading

0 comments on commit 933ed87

Please sign in to comment.