diff --git a/WiringPi/devLib/piFaceOld.c b/WiringPi/devLib/piFaceOld.c
new file mode 100644
index 0000000..1b1c0dd
--- /dev/null
+++ b/WiringPi/devLib/piFaceOld.c
@@ -0,0 +1,178 @@
+/*
+ * piFace.:
+ * Arduino compatable (ish) Wiring library for the Raspberry Pi
+ * Copyright (c) 2012-2013 Gordon Henderson
+ *
+ * This file to interface with the PiFace peripheral device which
+ * has an MCP23S17 GPIO device connected via the SPI bus.
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+
+#include
+#include
+
+#include
+#include
+
+#include "../wiringPi/mcp23x0817.h"
+
+#include "piFace.h"
+
+#define PIFACE_SPEED 4000000
+#define PIFACE_DEVNO 0
+
+
+
+/*
+ * writeByte:
+ * Write a byte to a register on the MCP23S17 on the SPI bus.
+ *********************************************************************************
+ */
+
+static void writeByte (uint8_t reg, uint8_t data)
+{
+ uint8_t spiData [4] ;
+
+ spiData [0] = CMD_WRITE ;
+ spiData [1] = reg ;
+ spiData [2] = data ;
+
+ wiringPiSPIDataRW (PIFACE_DEVNO, spiData, 3) ;
+}
+
+/*
+ * readByte:
+ * Read a byte from a register on the MCP23S17 on the SPI bus.
+ *********************************************************************************
+ */
+
+static uint8_t readByte (uint8_t reg)
+{
+ uint8_t spiData [4] ;
+
+ spiData [0] = CMD_READ ;
+ spiData [1] = reg ;
+
+ wiringPiSPIDataRW (PIFACE_DEVNO, spiData, 3) ;
+
+ return spiData [2] ;
+}
+
+
+/*
+ * myDigitalWrite:
+ * Perform the digitalWrite function on the PiFace board
+ *********************************************************************************
+ */
+
+void myDigitalWrite (struct wiringPiNodeStruct *node, int pin, int value)
+{
+ uint8_t mask, old ;
+
+ pin -= node->pinBase ;
+ mask = 1 << pin ;
+ old = readByte (MCP23x17_GPIOA) ;
+
+ if (value == 0)
+ old &= (~mask) ;
+ else
+ old |= mask ;
+
+ writeByte (MCP23x17_GPIOA, old) ;
+}
+
+
+/*
+ * myDigitalRead:
+ * Perform the digitalRead function on the PiFace board
+ *********************************************************************************
+ */
+
+int myDigitalRead (struct wiringPiNodeStruct *node, int pin)
+{
+ uint8_t mask, reg ;
+
+ mask = 1 << ((pin - node->pinBase) & 7) ;
+
+ if (pin < 8)
+ reg = MCP23x17_GPIOB ; // Input regsiter
+ else
+ reg = MCP23x17_OLATA ; // Output latch regsiter
+
+ if ((readByte (reg) & mask) != 0)
+ return HIGH ;
+ else
+ return LOW ;
+}
+
+
+/*
+ * myPullUpDnControl:
+ * Perform the pullUpDnControl function on the PiFace board
+ *********************************************************************************
+ */
+
+void myPullUpDnControl (struct wiringPiNodeStruct *node, int pin, int pud)
+{
+ uint8_t mask, old ;
+
+ mask = 1 << (pin - node->pinBase) ;
+ old = readByte (MCP23x17_GPPUB) ;
+
+ if (pud == 0)
+ old &= (~mask) ;
+ else
+ old |= mask ;
+
+ writeByte (MCP23x17_GPPUB, old) ;
+}
+
+
+/*
+ * piFaceSetup
+ * Setup the SPI interface and initialise the MCP23S17 chip
+ * We create one node with 16 pins - each if the first 8 pins being read
+ * and write - although the operations actually go to different
+ * hardware ports. The top 8 let you read the state of the output register.
+ *********************************************************************************
+ */
+
+int piFaceSetup (const int pinBase)
+{
+ int x ;
+ struct wiringPiNodeStruct *node ;
+
+ if ((x = wiringPiSPISetup (PIFACE_DEVNO, PIFACE_SPEED)) < 0)
+ return x ;
+
+// Setup the MCP23S17
+
+ writeByte (MCP23x17_IOCON, IOCON_INIT) ;
+ writeByte (MCP23x17_IODIRA, 0x00) ; // Port A -> Outputs
+ writeByte (MCP23x17_IODIRB, 0xFF) ; // Port B -> Inputs
+
+ node = wiringPiNewNode (pinBase, 16) ;
+ node->digitalRead = myDigitalRead ;
+ node->digitalWrite = myDigitalWrite ;
+ node->pullUpDnControl = myPullUpDnControl ;
+
+ return 0 ;
+}
diff --git a/WiringPi/devLib/piGlow.c b/WiringPi/devLib/piGlow.c
new file mode 100644
index 0000000..44e3db8
--- /dev/null
+++ b/WiringPi/devLib/piGlow.c
@@ -0,0 +1,118 @@
+/*
+ * piGlow.c:
+ * Easy access to the Pimoroni PiGlow board.
+ *
+ * Copyright (c) 2013 Gordon Henderson.
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wiringPi. If not, see .
+ ***********************************************************************
+ */
+
+#include
+#include
+
+#include "piGlow.h"
+
+#define PIGLOW_BASE 577
+
+static int leg0 [6] = { 6, 7, 8, 5, 4, 9 } ;
+static int leg1 [6] = { 17, 16, 15, 13, 11, 10 } ;
+static int leg2 [6] = { 0, 1, 2, 3, 14, 12 } ;
+
+
+/*
+ * piGlow1:
+ * Light up an individual LED
+ *********************************************************************************
+ */
+
+void piGlow1 (const int leg, const int ring, const int intensity)
+{
+ int *legLeds ;
+
+ if ((leg < 0) || (leg > 2)) return ;
+ if ((ring < 0) || (ring > 5)) return ;
+
+ /**/ if (leg == 0)
+ legLeds = leg0 ;
+ else if (leg == 1)
+ legLeds = leg1 ;
+ else
+ legLeds = leg2 ;
+
+ analogWrite (PIGLOW_BASE + legLeds [ring], intensity) ;
+}
+
+/*
+ * piGlowLeg:
+ * Light up all 6 LEDs on a leg
+ *********************************************************************************
+ */
+
+void piGlowLeg (const int leg, const int intensity)
+{
+ int i ;
+ int *legLeds ;
+
+ if ((leg < 0) || (leg > 2))
+ return ;
+
+ /**/ if (leg == 0)
+ legLeds = leg0 ;
+ else if (leg == 1)
+ legLeds = leg1 ;
+ else
+ legLeds = leg2 ;
+
+ for (i = 0 ; i < 6 ; ++i)
+ analogWrite (PIGLOW_BASE + legLeds [i], intensity) ;
+}
+
+
+/*
+ * piGlowRing:
+ * Light up 3 LEDs in a ring. Ring 0 is the outermost, 5 the innermost
+ *********************************************************************************
+ */
+
+void piGlowRing (const int ring, const int intensity)
+{
+ if ((ring < 0) || (ring > 5))
+ return ;
+
+ analogWrite (PIGLOW_BASE + leg0 [ring], intensity) ;
+ analogWrite (PIGLOW_BASE + leg1 [ring], intensity) ;
+ analogWrite (PIGLOW_BASE + leg2 [ring], intensity) ;
+}
+
+/*
+ * piGlowSetup:
+ * Initialise the board & remember the pins we're using
+ *********************************************************************************
+ */
+
+void piGlowSetup (int clear)
+{
+ sn3218Setup (PIGLOW_BASE) ;
+
+ if (clear)
+ {
+ piGlowLeg (0, 0) ;
+ piGlowLeg (1, 0) ;
+ piGlowLeg (2, 0) ;
+ }
+}
diff --git a/WiringPi/devLib/piGlow.h b/WiringPi/devLib/piGlow.h
new file mode 100644
index 0000000..d501c2c
--- /dev/null
+++ b/WiringPi/devLib/piGlow.h
@@ -0,0 +1,45 @@
+/*
+ * piglow.h:
+ * Easy access to the Pimoroni PiGlow board.
+ *
+ * Copyright (c) 2013 Gordon Henderson.
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with wiringPi. If not, see .
+ ***********************************************************************
+ */
+
+
+#define PIGLOW_RED 0
+#define PIGLOW_YELLOW 1
+#define PIGLOW_ORANGE 2
+#define PIGLOW_GREEN 3
+#define PIGLOW_BLUE 4
+#define PIGLOW_WHITE 5
+
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern void piGlow1 (const int leg, const int ring, const int intensity) ;
+extern void piGlowLeg (const int leg, const int intensity) ;
+extern void piGlowRing (const int ring, const int intensity) ;
+extern void piGlowSetup (int clear) ;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/WiringPi/wiringPi/max31855.c b/WiringPi/wiringPi/max31855.c
new file mode 100644
index 0000000..2185839
--- /dev/null
+++ b/WiringPi/wiringPi/max31855.c
@@ -0,0 +1,81 @@
+/*
+ * max31855.c:
+ * Extend wiringPi with the max31855 SPI Analog to Digital convertor
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#include
+#include
+
+#include "max31855.h"
+
+/*
+ * myAnalogRead:
+ * Return the analog value of the given pin
+ * Note: The chip really only has one read "channel", but we're faking it
+ * here so we can read the error registers. Channel 0 will be the data
+ * channel, and 1 is the error register code.
+ * Note: Temperature returned is temp in C * 4, so divide result by 4
+ *********************************************************************************
+ */
+
+static int myAnalogRead (struct wiringPiNodeStruct *node, int pin)
+{
+ unsigned int spiData ;
+ int temp ;
+ int chan = pin - node->pinBase ;
+
+ wiringPiSPIDataRW (node->fd, (unsigned char *)&spiData, 4) ;
+
+ if (chan == 0) // Read temp in C
+ {
+ spiData >>= 18 ;
+ temp = spiData & 0x3FFF ; // Bottom 13 bits
+ if ((spiData & 0x2000) != 0) // Negative
+ temp = -temp ;
+ return temp ;
+ }
+ else // Return error bits
+ return spiData & 0x7 ;
+}
+
+
+/*
+ * max31855Setup:
+ * Create a new wiringPi device node for an max31855 on the Pi's
+ * SPI interface.
+ *********************************************************************************
+ */
+
+int max31855Setup (const int pinBase, int spiChannel)
+{
+ struct wiringPiNodeStruct *node ;
+
+ if (wiringPiSPISetup (spiChannel, 5000000) < 0) // 5MHz - prob 4 on the Pi
+ return -1 ;
+
+ node = wiringPiNewNode (pinBase, 2) ;
+
+ node->fd = spiChannel ;
+ node->analogRead = myAnalogRead ;
+
+ return 0 ;
+}
diff --git a/WiringPi/wiringPi/max31855.h b/WiringPi/wiringPi/max31855.h
new file mode 100644
index 0000000..385c4bd
--- /dev/null
+++ b/WiringPi/wiringPi/max31855.h
@@ -0,0 +1,33 @@
+/*
+ * max31855.c:
+ * Extend wiringPi with the MAX31855 SPI Thermocouple driver
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int max31855Setup (int pinBase, int spiChannel) ;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/WiringPi/wiringPi/max5322.c b/WiringPi/wiringPi/max5322.c
new file mode 100644
index 0000000..b7cd6a9
--- /dev/null
+++ b/WiringPi/wiringPi/max5322.c
@@ -0,0 +1,84 @@
+/*
+ * max5322.c:
+ * Extend wiringPi with the MAX5322 SPI Digital to Analog convertor
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#include
+#include
+
+#include "max5322.h"
+
+/*
+ * myAnalogWrite:
+ * Write analog value on the given pin
+ *********************************************************************************
+ */
+
+static void myAnalogWrite (struct wiringPiNodeStruct *node, int pin, int value)
+{
+ unsigned char spiData [2] ;
+ unsigned char chanBits, dataBits ;
+ int chan = pin - node->pinBase ;
+
+ if (chan == 0)
+ chanBits = 0b01000000 ;
+ else
+ chanBits = 0b01010000 ;
+
+ chanBits |= ((value >> 12) & 0x0F) ;
+ dataBits = ((value ) & 0xFF) ;
+
+ spiData [0] = chanBits ;
+ spiData [1] = dataBits ;
+
+ wiringPiSPIDataRW (node->fd, spiData, 2) ;
+}
+
+/*
+ * max5322Setup:
+ * Create a new wiringPi device node for an max5322 on the Pi's
+ * SPI interface.
+ *********************************************************************************
+ */
+
+int max5322Setup (const int pinBase, int spiChannel)
+{
+ struct wiringPiNodeStruct *node ;
+ unsigned char spiData [2] ;
+
+ if (wiringPiSPISetup (spiChannel, 8000000) < 0) // 10MHz Max
+ return -1 ;
+
+ node = wiringPiNewNode (pinBase, 2) ;
+
+ node->fd = spiChannel ;
+ node->analogWrite = myAnalogWrite ;
+
+// Enable both DACs
+
+ spiData [0] = 0b11100000 ;
+ spiData [1] = 0 ;
+
+ wiringPiSPIDataRW (node->fd, spiData, 2) ;
+
+ return 0 ;
+}
diff --git a/WiringPi/wiringPi/max5322.h b/WiringPi/wiringPi/max5322.h
new file mode 100644
index 0000000..a217cf8
--- /dev/null
+++ b/WiringPi/wiringPi/max5322.h
@@ -0,0 +1,33 @@
+/*
+ * max5322.h:
+ * Extend wiringPi with the MAX5322 SPI Digital to Analog convertor
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int max5322Setup (int pinBase, int spiChannel) ;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/WiringPi/wiringPi/mcp3004.c b/WiringPi/wiringPi/mcp3004.c
new file mode 100644
index 0000000..82c73dd
--- /dev/null
+++ b/WiringPi/wiringPi/mcp3004.c
@@ -0,0 +1,76 @@
+/*
+ * mcp3004.c:
+ * Extend wiringPi with the MCP3004 SPI Analog to Digital convertor
+ * Copyright (c) 2012-2013 Gordon Henderson
+ *
+ * Thanks also to "ShorTie" on IRC for some remote debugging help!
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#include
+#include
+
+#include "mcp3004.h"
+
+/*
+ * myAnalogRead:
+ * Return the analog value of the given pin
+ *********************************************************************************
+ */
+
+static int myAnalogRead (struct wiringPiNodeStruct *node, int pin)
+{
+ unsigned char spiData [3] ;
+ unsigned char chanBits ;
+ int chan = pin - node->pinBase ;
+
+ chanBits = 0b10000000 | (chan << 4) ;
+
+ spiData [0] = 1 ; // Start bit
+ spiData [1] = chanBits ;
+ spiData [2] = 0 ;
+
+ wiringPiSPIDataRW (node->fd, spiData, 3) ;
+
+ return ((spiData [1] << 8) | spiData [2]) & 0x3FF ;
+}
+
+
+/*
+ * mcp3004Setup:
+ * Create a new wiringPi device node for an mcp3004 on the Pi's
+ * SPI interface.
+ *********************************************************************************
+ */
+
+int mcp3004Setup (const int pinBase, int spiChannel)
+{
+ struct wiringPiNodeStruct *node ;
+
+ if (wiringPiSPISetup (spiChannel, 1000000) < 0)
+ return -1 ;
+
+ node = wiringPiNewNode (pinBase, 8) ;
+
+ node->fd = spiChannel ;
+ node->analogRead = myAnalogRead ;
+
+ return 0 ;
+}
diff --git a/WiringPi/wiringPi/mcp3004.h b/WiringPi/wiringPi/mcp3004.h
new file mode 100644
index 0000000..a07c0bf
--- /dev/null
+++ b/WiringPi/wiringPi/mcp3004.h
@@ -0,0 +1,33 @@
+/*
+ * mcp3004.c:
+ * Extend wiringPi with the MCP3004 SPI Analog to Digital convertor
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int mcp3004Setup (int pinBase, int spiChannel) ;
+
+#ifdef __cplusplus
+}
+#endif
diff --git a/WiringPi/wiringPi/sn3218.c b/WiringPi/wiringPi/sn3218.c
new file mode 100644
index 0000000..7ceb156
--- /dev/null
+++ b/WiringPi/wiringPi/sn3218.c
@@ -0,0 +1,75 @@
+/*
+ * sn3218.c:
+ * Extend wiringPi with the SN3218 I2C LEd Driver
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#include
+#include
+
+#include "sn3218.h"
+
+/*
+ * myAnalogWrite:
+ * Write analog value on the given pin
+ *********************************************************************************
+ */
+
+static void myAnalogWrite (struct wiringPiNodeStruct *node, int pin, int value)
+{
+ int fd = node->fd ;
+ int chan = 0x01 + (pin - node->pinBase) ;
+
+ wiringPiI2CWriteReg8 (fd, chan, value & 0xFF) ; // Value
+ wiringPiI2CWriteReg8 (fd, 0x16, 0x00) ; // Update
+}
+
+/*
+ * sn3218Setup:
+ * Create a new wiringPi device node for an sn3218 on the Pi's
+ * SPI interface.
+ *********************************************************************************
+ */
+
+int sn3218Setup (const int pinBase)
+{
+ int fd ;
+ struct wiringPiNodeStruct *node ;
+
+ if ((fd = wiringPiI2CSetup (0x54)) < 0)
+ return fd ;
+
+// Setup the chip - initialise all 18 LEDs to off
+
+//wiringPiI2CWriteReg8 (fd, 0x17, 0) ; // Reset
+ wiringPiI2CWriteReg8 (fd, 0x00, 1) ; // Not Shutdown
+ wiringPiI2CWriteReg8 (fd, 0x13, 0x3F) ; // Enable LEDs 0- 5
+ wiringPiI2CWriteReg8 (fd, 0x14, 0x3F) ; // Enable LEDs 6-11
+ wiringPiI2CWriteReg8 (fd, 0x15, 0x3F) ; // Enable LEDs 12-17
+ wiringPiI2CWriteReg8 (fd, 0x16, 0x00) ; // Update
+
+ node = wiringPiNewNode (pinBase, 18) ;
+
+ node->fd = fd ;
+ node->analogWrite = myAnalogWrite ;
+
+ return 0 ;
+}
diff --git a/WiringPi/wiringPi/sn3218.h b/WiringPi/wiringPi/sn3218.h
new file mode 100644
index 0000000..580d5f9
--- /dev/null
+++ b/WiringPi/wiringPi/sn3218.h
@@ -0,0 +1,33 @@
+/*
+ * sn3218.c:
+ * Extend wiringPi with the SN3218 I2C LED driver board.
+ * Copyright (c) 2012-2013 Gordon Henderson
+ ***********************************************************************
+ * This file is part of wiringPi:
+ * https://projects.drogon.net/raspberry-pi/wiringpi/
+ *
+ * wiringPi is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * wiringPi is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with wiringPi.
+ * If not, see .
+ ***********************************************************************
+ */
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+extern int sn3218Setup (int pinBase) ;
+
+#ifdef __cplusplus
+}
+#endif