Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
41 commits
Select commit Hold shift + click to select a range
d681054
dont compile examples
jabdoa2 Feb 10, 2016
a87e5fb
use pkg-config
jabdoa2 Feb 10, 2016
69bd547
add debian control files
jabdoa2 Feb 10, 2016
dfe55cf
changes for latest yaml-cpp and CPP 11
darren5 May 29, 2019
5bb2146
do not flush after every write data call
jabdoa2 Jan 8, 2020
031109f
add new PRWriteDataUnbuffered to libpinproc
jabdoa2 Feb 22, 2020
ba938e2
add more error strings
jabdoa2 May 12, 2020
75bdb61
fix compiler warnings
jabdoa2 May 12, 2020
3e2aecd
Adding cross-compilation support
May 16, 2020
31e7b0b
Parsing of board ID for P3-ROC and P-ROC are now different. Both rea…
gstellenberg May 22, 2020
b991979
build: allow for setting EXTRA_INC and EXTRA_LINK
tomlogic Jun 24, 2020
fed1d7e
pinprocfw: add missing return to verifyP3ROCImage()
tomlogic Jun 24, 2020
f44cacd
pinprocfw: use correct checkPROCFile() return type
tomlogic Jun 24, 2020
60c6859
build: allow relative paths in LINK_DIRECTORIES
tomlogic Jun 24, 2020
213c69d
build: make non-MSVC executables statically linked
tomlogic Jun 24, 2020
26600a3
doc: yaml-cpp now hosted on GitHub
tomlogic Jun 24, 2020
acd55d6
pinprocfw: call PRDelete() even if file doesn't parse
tomlogic Jun 24, 2020
a14aaef
pinprocfw: always print an error if file parsing fails
tomlogic Jun 24, 2020
286cb1a
Merge remote-tracking branch 'preble/bug/pinprocfw_p3roc_rev' into dev
tomlogic Jun 25, 2020
ce7e4f0
Merge remote-tracking branch 'Compy/dev' into dev
tomlogic Jun 25, 2020
804eebf
Revert "dont compile examples"
tomlogic Jun 25, 2020
b3191b3
Revert "add debian control files"
tomlogic Jun 25, 2020
65044e3
Merge pull request #11 from tomlogic/dev
gstellenberg Jul 20, 2020
40b0d86
yaml: remove yaml-cpp dependency
tomlogic Jun 26, 2020
cc92bc1
pinproctest: fix kPRDriverGroupsMax overflow
tomlogic Jun 26, 2020
bcd526a
libpinproc: fix PRDevice::GetVersionInfo() API
tomlogic Jun 26, 2020
b2d9b4e
API: change private constants to public macros
tomlogic Jun 26, 2020
954084d
pinproctest: code cleanup
tomlogic Jun 26, 2020
83f8f11
pinprocfw: code cleanup
tomlogic Jun 26, 2020
caa09f6
cmake: remove CMAKE_CXX_STANDARD requirement
tomlogic Jun 26, 2020
624f778
cmake: update minimum required version to 2.8.1
tomlogic Jun 26, 2020
5ad464b
pinproctest: use standard strcmp() vs. strcmpi()
tomlogic Jun 26, 2020
705a2d2
pinproctest: more cleanup
tomlogic Jun 26, 2020
d415ac8
cmake: on Linux/macOS, link libusb-1.0 vs. libusb
tomlogic Jun 26, 2020
bb14a68
cleanup: move "\n" from start to end of printf() output
tomlogic Jun 26, 2020
c36d48b
cleanup: remove dead (#if 0) code
tomlogic Jun 26, 2020
ed65408
cleanup: unbuffered stdout to avoid fflush()
tomlogic Jun 26, 2020
7c202fc
doc: update README
tomlogic Jun 26, 2020
3b9d035
cleanup: quiet PRGetLastErrorText() compiler warning
tomlogic Jul 16, 2020
378b733
pinprocfw: leave out unnecessary checksum printf()
tomlogic Jul 20, 2020
286c566
build: advance version to 2.1
tomlogic Aug 4, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 17 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,26 +1,22 @@
###
### CMake settings
###
## Due to Mac OSX we need to keep compatibility with CMake 2.6
# see http://www.cmake.org/Wiki/CMake_Policies
cmake_minimum_required(VERSION 2.6)
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0012
if(POLICY CMP0012)
cmake_policy(SET CMP0012 OLD)
endif()
# see http://www.cmake.org/cmake/help/cmake-2-8-docs.html#policy:CMP0015
if(POLICY CMP0015)
cmake_policy(SET CMP0015 OLD)
endif()
# Version 2.8.1 was released 2010-03-16 and is a reasonable minimum.
cmake_minimum_required(VERSION 2.8.1)

# allow relative paths in link_directories()
# see https://cmake.org/cmake/help/v3.18/policy/CMP0081.html
if(POLICY CMP0081)
cmake_policy(SET CMP0081 OLD)
endif()

###
### Project settings
###
project(PINPROC)

set(PINPROC_VERSION_MAJOR "2")
set(PINPROC_VERSION_MINOR "0")
set(PINPROC_VERSION_MINOR "1")
set(PINPROC_VERSION "${PINPROC_VERSION_MAJOR}.${PINPROC_VERSION_MINOR}")


Expand All @@ -45,6 +41,7 @@ option(APPLE_UNIVERSAL_BIN "Apple: Build universal binary" OFF)
option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" ON)
option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF)

option(CROSS_ROOT "Cross-compilation root path" OFF)

###
### Sources, headers, directories and libs
Expand All @@ -69,11 +66,15 @@ if(VERBOSE)
endif()

# use -DEXTRA_INC="<path>;<path>" and -DEXTRA_LINK="<path>;<path>"
set(EXTRA_INC "" CACHE STRING "Extra include directories separated by ;")
set(EXTRA_LINK "" CACHE STRING "Extra link directories separated by ;")
if(CROSS_ROOT)
include_directories(${PINPROC_SOURCE_DIR}/include ${EXTRA_INC} ${CROSS_ROOT}/usr/local/include)
link_directories(${EXTRA_LINK} ${CROSS_ROOT}/usr/local/lib)
else()
include_directories(${PINPROC_SOURCE_DIR}/include ${EXTRA_INC} /usr/local/include)
link_directories(${EXTRA_LINK} /usr/local/lib)

set(YAML_CPP_LIB "yaml-cpp")
set(YAML_CPP_LIB_DBG "${YAML_CPP_LIB}")
endif()


###
Expand All @@ -100,7 +101,7 @@ if(WIN32)
set(CMAKE_INSTALL_PREFIX "C:/")
endif()
else()
set(lib_ftdi_usb usb ftdi1)
set(lib_ftdi_usb usb-1.0 ftdi1)
endif()

# GCC specialities
Expand Down Expand Up @@ -153,13 +154,7 @@ if(MSVC)

# c) Correct suffixes for static libraries
if(NOT BUILD_SHARED_LIBS)
### General stuff
set(LIB_TARGET_SUFFIX "${LIB_SUFFIX}${LIB_RT_SUFFIX}")

### Project stuff
# correct external library names
set(YAML_CPP_LIB "${CMAKE_STATIC_LIBRARY_PREFIX}${YAML_CPP_LIB}${LIB_RT_SUFFIX}")
set(YAML_CPP_LIB_DBG "${YAML_CPP_LIB}d")
endif()
endif()

Expand Down Expand Up @@ -244,8 +239,6 @@ add_executable(pinproctest
)
target_link_libraries(pinproctest
pinproc
optimized ${YAML_CPP_LIB}
debug ${YAML_CPP_LIB_DBG}
)

# Create a target for the firmware tool
Expand Down
3 changes: 1 addition & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ LIBPINPROC_DYLIB = bin/libpinproc.dylib
SRCS = src/pinproc.cpp src/PRDevice.cpp src/PRHardware.cpp
OBJS := $(SRCS:.cpp=.o)
INCLUDES = include/pinproc.h src/PRCommon.h src/PRDevice.h src/PRHardware.h
LIBS = usb ftdi

.PHONY: libpinproc
libpinproc: $(LIBPINPROC) $(LIBPINPROC_DYLIB)
Expand All @@ -20,7 +19,7 @@ $(LIBPINPROC): $(OBJS)
$(RANLIB) $@

$(LIBPINPROC_DYLIB): $(OBJS)
g++ -dynamiclib -o $@ /usr/local/lib/libftdi.dylib $(LDFLAGS) $(OBJS)
g++ -dynamiclib -o $@ `pkg-config --libs libftdi1` $(LDFLAGS) $(OBJS)

.cpp.o:
$(CC) $(LIBPINPROC_CFLAGS) $(CFLAGS) -o $@ $<
Expand Down
74 changes: 44 additions & 30 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -1,34 +1,20 @@
## libpinproc

Library for Gerry Stellenberg's [P-ROC](http://pinballcontrollers.com/) (Pinball Remote Operations Controller).
Library for [Multimorphic, Inc.'s](https://www.multimorphic.com/) P-ROC and P3-ROC pinball controller boards.

### Compiling

#### Prerequisites

libpinproc requires:

- [libusb-0.1.12](http://libusb.wiki.sourceforge.net/): Install with the default /usr/local prefix. Version 0.1.12 has been tested on Mac and Linux. Mac users: If you want to use libpinproc under Cocoa or pygame, you may wish to try libusb 1.0. See below.
- [libusb](https://github.com/libusb/libusb): Install with the default /usr/local prefix. Current builds of libftdi and libpinproc use libusb-1.0.

- [libftdi-0.16](http://www.intra2net.com/en/developer/libftdi/): Install with the default /usr/local prefix.
- [libftdi](https://www.intra2net.com/en/developer/libftdi/): Install with the default /usr/local prefix.

The pinproctest example requires [yaml-cpp](http://code.google.com/p/yaml-cpp/). Follow the build instructions, creating the build subdirectory. After building, from the main source directory, run the following commands to manually install it:
#### Building with CMake (Linux and macOS)

sudo cp lib/libyaml-cpp.a /usr/local/lib/
sudo mkdir /usr/local/include/yaml-cpp
sudo cp include/*.h /usr/local/include/yaml-cpp/

##### libusb-1.0 and libusb-compat

Version 1.0.2 does not work out of the box since libftdi is written against libusb-0.1. You can use the libusb-compat-0.1.2 project, however, which creates a library that provides the older libusb interface. Because Macs do not come with pkg-config, you may need to run configure for libusb-compat as follows:

./configure LIBUSB_1_0_CFLAGS=-I/usr/local/include/libusb-1.0 LIBUSB_1_0_LIBS="-L/usr/local/lib -lusb-1.0"

Note that libusb-1.0 must have been built and installed prior to this step. This also assumes that you installed libusb-1.0 with the default /usr/local prefix.

#### Building with CMake

Download and install [CMake](http://www.cmake.org/cmake/resources/software.html). Then:
Download and install [CMake](https://cmake.org/download/). Then:

cd libpinproc
mkdir bin; cd bin
Expand All @@ -37,33 +23,61 @@ Download and install [CMake](http://www.cmake.org/cmake/resources/software.html)

The CMakeLists.txt file is presently designed to be run from a directory inside the libpinproc directory. This will build both libpinproc and pinproctest. Binaries will be placed in the directory that make was run from. We recommend 'bin', as it is the path expected by pypinproc.

Note: On some systems, it may be necessary to build libpinproc with the '-fPIC' option. To do this with cmake, instead of running 'cmake ..', run 'cmake .. -DCMAKE_CXX_FLAGS="-fPIC"'. Compiling without '-fPIC' may cause problems when building the python extensions on some 64-bit Linux machines.
Note: On some systems, it may be necessary to build libpinproc with the '-fPIC' option. To do this with cmake, instead of running 'cmake ..', run 'cmake .. -DCMAKE_CXX_FLAGS="-fPIC"'. Compiling without '-fPIC' may cause problems when building the Python extensions on some 64-bit Linux machines.

Mac users may need to install [D2xxHelper](http://www.ftdichip.com/Drivers/D2XX.htm) to keep the Mac from claiming the P-ROC/P3-ROC and creating a `/dev/tty.usbserial` device for it. It may be necessary to install a second time, if you're asked to allowing the installation via the Security & Privacy System Preference. You will also need to reboot after installing D2xxHelper. Run a `ls /dev/tty.usbserial*` before and after connecting the P-ROC/P3-ROC. If you see a new entry, libpinproc will not be able to connect.

#### Building in Windows with MinGW/CMake

(Note that these instructions are outdated with the advent of of MSYS2/MinGW64. Recent attempts at building with these instructions result in builds with dependencies on DLLs from MinGW64. For users with MSYS/MinGW32 installations they should still be valid.)

Download and unzip [ftd2xx for Windows zip file](http://www.ftdichip.com/Drivers/D2XX.htm). Plug in a powered-up P-ROC and point the driver install wizard to the unzipped driver. Note, this is a two-step process. It will ask you to install a driver twice (once for USB and again for the FTDI specific stuff).

Download and install [CMake](http://www.cmake.org/cmake/resources/software.html).
Download and install [CMake](https://cmake.org/download/).

Download and install [MinGW](http://sourceforge.net/projects/mingw/files/). (Tested with MinGW 5.1.4)

Follow directions above for building yaml-cpp with the following exception:
add '-G "MinGW Makefiles"' to the cmake command line.
Follow directions above for Building with CMake with the following exception:
- Add `-G "MinGW Makefiles"` to the cmake command line.
- Use `-DEXTRA_INC="<path>"` and `-DEXTRA_LINK="<path>"` to add include/library paths for `ftd2xx.h` and `ftd2xx.sys`.
- Use mingw32-make instead of make.

To build libpinproc:
#### Building in Windows with CMake and Visual Studio 2019

- add the paths for ftd2xx.h (from the unzipped driver package) and the yaml-cpp/include/*.h files to the "include_directories" line in libpinproc/CMakeLists.txt.
Follow directions above for Building with CMake with the following exception:
- Add `-A Win32` to the cmake command line.
- Use `-DEXTRA_INC="<path>"` and `-DEXTRA_LINK="<path>"` to add include/library paths for `ftd2xx.h` and `ftd2xx.sys`.
- Open PINPROC.sln in Visual Studio, switch to the Debug or Release configuration and perform ALL_BUILD. It will place the libary and sample programs in `build/Debug` and `build/Release`.

- either create the directory c:\usr\local\lib and copy libyaml-cpp*.a from the yaml-cpp build directory and ftd2xx.sys to it or add the location of those files to the "link_directories" line in libpinproc/CMakeLists.txt.
Example:

cd libpinproc
mkdir bin; cd bin
cmake .. -A Win32
# configure paths for ftd2xxx; use `cmake .. -L` to list configured options
cmake .. -D EXTRA_INC="../ftd2xx"
cmake .. -D EXTRA_LINK="../ftd2xx/i386"
# Can now open PINPROC.sln in Visual Studio and build Debug and Release targets.

### Testing

Once built, run the `pinproctest` program with the appropriate "machine type" passed in (e.g., "wpc"). Run `pinproctest` without any parameters for a list of valid types.

Follow instructions above for building libpinproc with cmake with the following exceptions:
add '-G "MinGW Makefiles' to the cmake command line,
use mingw32-make instead of make

### License

Copyright (c) 2009 Gerry Stellenberg, Adam Preble

Copyright (c) 2020 Multimorphic, Inc.

Contributors:
- Adam Preble
- Gerry Stellenberg
- Jan Kantert
- Jimmy Lipham
- Koen Heltzel
- Roy Eltham
- Tom Collins

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
Expand Down
2 changes: 1 addition & 1 deletion examples/pinproctest/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SRCS = pinproctest.cpp drivers.cpp dmd.cpp switches.cpp
OBJS := $(SRCS:.cpp=.o)
INCLUDES = ../../include/pinproc.h

LIBS = usb pinproc yaml-cpp
LIBS = usb pinproc
ifneq ($(uname_s),Windows) # not Windows
LIBS += ftdi
endif
Expand Down
18 changes: 11 additions & 7 deletions examples/pinproctest/alphanumeric.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ void display(PRHandle proc, char * string_1, char * string_2)
segs_a = asciiSegments[char_a - 32];
segs_b = asciiSegments[char_b - 32];

printf("\nASCII Chars and associated segment values: %d", i);
printf("\nchar_a: %x, segs_a: %x", char_a, segs_a);
printf("\nchar_b: %x, segs_b: %x", char_b, segs_b);
printf("ASCII Chars and associated segment values: %d\n", i);
printf("char_a: %x, segs_a: %x\n", char_a, segs_a);
printf("char_b: %x, segs_b: %x\n", char_b, segs_b);

PRDriverAuxPrepareOutput(&(auxCommands[cmd_index++]), segs_a & 0xff, 0, STB_1, false, 0);
PRDriverAuxPrepareOutput(&(auxCommands[cmd_index++]), (segs_a >> 8) & 0xff, 0, STB_2, false, 0);
Expand All @@ -137,9 +137,11 @@ void display(PRHandle proc, char * string_1, char * string_2)

PRDriverAuxPrepareJump(&auxCommands[cmd_index++],1);

printf("\nAux commands being sent:");
printf("Aux commands being sent:\n");
for (i=0; i<cmd_index; i++) {
printf("\nCommand: %d\tdata: %8x\tenables: %4d\tdelay_time: %10d\tjumpAddr: %4d",auxCommands[i].command, auxCommands[i].data, auxCommands[i].enables, auxCommands[i].delayTime, auxCommands[i].jumpAddr);
printf("Command: %d\tdata: %8x\tenables: %4d\tdelay_time: %10d\tjumpAddr: %4d\n",
auxCommands[i].command, auxCommands[i].data, auxCommands[i].enables,
auxCommands[i].delayTime, auxCommands[i].jumpAddr);
}

// Send the commands.
Expand All @@ -150,9 +152,11 @@ void display(PRHandle proc, char * string_1, char * string_2)
PRDriverAuxPrepareJump(&auxCommands[cmd_index++],1);
PRDriverAuxSendCommands(proc, auxCommands, cmd_index, 0);

printf("\nAux commands being sent:");
printf("Aux commands being sent:\n");
for (i=0; i<cmd_index; i++) {
printf("\nCommand: %d\tdata: %x\tenables: %d\tdelay_time: %d\tjumpAddr: %d",auxCommands[i].command, auxCommands[i].data, auxCommands[i].enables, auxCommands[i].delayTime, auxCommands[i].jumpAddr);
printf("Command: %d\tdata: %x\tenables: %d\tdelay_time: %d\tjumpAddr: %d\n",
auxCommands[i].command, auxCommands[i].data, auxCommands[i].enables,
auxCommands[i].delayTime, auxCommands[i].jumpAddr);
}

}
Expand Down
4 changes: 1 addition & 3 deletions examples/pinproctest/drivers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ void ConfigureDriverGroups(PRHandle proc, bool driverPolarity)
// in the matrixRowEnableIndex variables.
const int mappedDriverGroupRowEnableSelect[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1};

for (i = 0; i <= kPRDriverGroupsMax; i++)
for (i = 0; i < kPRDriverGroupsMax; i++)
{
PRDriverGroupConfig group;
//memset(&group, 0x00, sizeof(PRDriverGroupConfig));
Expand Down Expand Up @@ -222,8 +222,6 @@ void ConfigureDriverGlobals(PRHandle proc, bool driverPolarity)

void ConfigureDrivers(PRHandle proc)
{
int i;

// First set up a bunch of constants to use later:

// The driverPolarity determines when the drivers go high or low when
Expand Down
Loading