aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Embedded_SW/Embedded/Drivers
diff options
context:
space:
mode:
authorShlomo Hecht <shlomo@twine-s.com>2018-03-06 12:09:02 +0200
committerShlomo Hecht <shlomo@twine-s.com>2018-03-06 12:09:02 +0200
commitfb2d080fbbcea3a91e598b4ea8837a230de6a319 (patch)
tree6b3ce09a252d2ebab8189a92b3326ffbba6dbe4b /Software/Embedded_SW/Embedded/Drivers
parentd734bb5cf08ba2433b74fc86a8858d2437d1a237 (diff)
downloadTango-fb2d080fbbcea3a91e598b4ea8837a230de6a319.tar.gz
Tango-fb2d080fbbcea3a91e598b4ea8837a230de6a319.zip
A new forlder for embedded software in our common structure
Diffstat (limited to 'Software/Embedded_SW/Embedded/Drivers')
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c317
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h49
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c488
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h6
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c60
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Heater/Heater.h7
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c127
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h31
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.c655
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.h136
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.c130
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.h37
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.ccsproject13
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.cproject141
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.project45
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.codan.core.prefs3
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.debug.core.prefs2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.core.resources.prefs8
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.c109
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.h32
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/.ccsproject14
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/.cproject147
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/.project40
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.codan.core.prefs3
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.debug.core.prefs2
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.core.resources.prefs8
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.c542
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.h73
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.c32
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.h20
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.c211
-rw-r--r--Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.h49
32 files changed, 3537 insertions, 0 deletions
diff --git a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c
new file mode 100644
index 000000000..a99ed7134
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.c
@@ -0,0 +1,317 @@
+//*****************************************************************************
+//
+// This is the data acquisition module. It performs acquisition of data from
+// selected channels, starting and stopping data logging, storing acquired
+// data, and running the strip chart display.
+//
+//*****************************************************************************
+
+#include "ADC.h"
+#include "include.h"
+#include <stdbool.h>
+
+#include <ti/sysbios/BIOS.h>
+#include <ti/sysbios/knl/Clock.h>
+#include <ti/sysbios/knl/Semaphore.h>
+
+#include <driverlib/adc.h>
+#include <driverlib/rom_map.h>
+#include <driverlib/interrupt.h>
+
+#include <inc/hw_memmap.h>
+#include <inc/hw_ints.h>
+#include "Drivers/I2C_Communication/I2C.h"
+
+//*****************************************************************************
+//
+// The following defines which ADC channel control should be used for each
+// kind of data item. Basically it maps how the ADC channels are connected
+// on the board. This is a hardware pinmap configuration.
+// Physical ADC connected channels in the TIVA
+//*****************************************************************************
+
+#define CHAN_AIR_PRESSURE_1 ADC_CTL_CH0
+#define CHAN_AIR_PRESSURE_2 ADC_CTL_CH1
+#define CHAN_DISPENSE_PRESSURE_1 ADC_CTL_CH2
+#define CHAN_DISPENSE_PRESSURE_2 ADC_CTL_CH3
+#define CHAN_DISPENSE_PRESSURE_3 ADC_CTL_CH4
+#define CHAN_DISPENSE_PRESSURE_4 ADC_CTL_CH5
+#define CHAN_DISPENSE_PRESSURE_5 ADC_CTL_CH6
+#define CHAN_DISPENSE_PRESSURE_6 ADC_CTL_CH7
+#define CHAN_DISPENSE_PRESSURE_7 ADC_CTL_CH8
+#define CHAN_DISPENSE_PRESSURE_8 ADC_CTL_CH9
+#define CHAN_LEFT_DANCER_1 ADC_CTL_CH13
+#define CHAN_LEFT_DANCER_2 ADC_CTL_CH14
+#define CHAN_RIGHT_DANCER ADC_CTL_CH15
+#define CHAN_DRYER_CURRENT_1 ADC_CTL_CH16
+#define CHAN_DRYER_CURRENT_2 ADC_CTL_CH17
+#define CHAN_DRYER_CURRENT_3 ADC_CTL_CH18
+
+//*****************************************************************************
+//
+// The following maps the order that items are acquired and stored by the
+// ADC sequencers. Note that 16 samples are specified, using 2 of the
+// 8 sample sequencers. The current is sampled multiple times deliberately
+// because that value tends to bounce around. It is sampled multiple
+// times and will be averaged.
+//
+//*****************************************************************************
+uint32_t g_pui32ADCSeq[] =
+{
+ CHAN_AIR_PRESSURE_1,CHAN_AIR_PRESSURE_2,
+ CHAN_DISPENSE_PRESSURE_1, CHAN_DISPENSE_PRESSURE_2, CHAN_DISPENSE_PRESSURE_3, CHAN_DISPENSE_PRESSURE_4,
+ CHAN_DISPENSE_PRESSURE_5, CHAN_DISPENSE_PRESSURE_6, CHAN_DISPENSE_PRESSURE_7, CHAN_DISPENSE_PRESSURE_8,
+ CHAN_LEFT_DANCER_1, CHAN_LEFT_DANCER_2, CHAN_RIGHT_DANCER,
+ CHAN_DRYER_CURRENT_1, CHAN_DRYER_CURRENT_2, CHAN_DRYER_CURRENT_3
+};
+
+#define NUM_ADC_CHANNELS (sizeof(g_pui32ADCSeq) / \
+ sizeof(g_pui32ADCSeq[0]))
+
+//#define SAMPLE_ARRAY_SIZE (NUM_ADC_CHANNELS + I2C_NUM_OF_CHANNELS)
+#define SAMPLE_ARRAY_SIZE NUM_ADC_CHANNELS
+#define DOUBLE_BUFFER 2
+
+static bool isInitialized = false;
+static bool adcCollectActive = false;
+static int bufferFlipFlop = 0;
+
+//*****************************************************************************
+//
+// Global _storage for most recent sampaled Sensor Data
+//
+//*****************************************************************************
+//
+// A buffer to hold one set of ADC data that is acquired per sample time.
+//
+//*****************************************************************************
+static uint32_t g_pui32ADCData[DOUBLE_BUFFER][SAMPLE_ARRAY_SIZE];
+
+//*****************************************************************************
+//configured in the cfg file and thats why should be defined as extern
+//*****************************************************************************
+extern Semaphore_Handle adcResultSem;
+
+static ProcessCallback processCallBack;
+
+//*****************************************************************************
+// ADCClockHandle: clock event handler - initiates trigger for the adc sampaling
+//*****************************************************************************
+// This function starts an ADC Conversion.
+//static void ADCClockHandle(UArg arg0)
+uint32_t ADC_TriggerCollection(void)
+{
+ //
+ // Kick off the next ADC acquisition. When these are done they will
+ // cause an ADC interrupt.
+ //
+ if (adcCollectActive == true)
+ {
+ MAP_ADCProcessorTrigger(ADC1_BASE, 0);
+ MAP_ADCProcessorTrigger(ADC0_BASE, 0);
+ }
+ return 0;
+}
+//*****************************************************************************
+//
+// ADC Data get for a single data read
+//
+//*****************************************************************************
+uint32_t ADC_GetReading(int DataItemId)
+{
+ int bufnotinuse;
+ assert (DataItemId<MAX_ADC_DEVICES);
+
+ if (bufferFlipFlop == 0) bufnotinuse = 1;
+ else bufnotinuse = 0;
+ return (g_pui32ADCData[bufnotinuse][DataItemId]);
+
+
+}
+
+//*****************************************************************************
+//
+// This is the handler for the ADC interrupt. Even though more than one
+// sequencer is used, they are configured so that this one runs last.
+// Therefor when this ADC sequencer interrupt occurs, we know all of the ADC
+// data has been acquired.
+//
+//*****************************************************************************
+void ADC0SS0Handler(void)
+{
+ //
+ // Clear the interrupts for all ADC sequencers that are used.
+ //
+ MAP_ADCIntClear(ADC0_BASE, 0);
+ MAP_ADCIntClear(ADC1_BASE, 0);
+
+ if (bufferFlipFlop == 0) bufferFlipFlop = 1;
+ else bufferFlipFlop = 0;
+ //
+ // Retrieve the data from all ADC sequencers
+ //
+ MAP_ADCSequenceDataGet(ADC0_BASE, 0, &g_pui32ADCData[bufferFlipFlop][0]);
+ //offset in the array calculated as sampling of 16 channels each one of 16 bits
+ MAP_ADCSequenceDataGet(ADC1_BASE, 0, &g_pui32ADCData[bufferFlipFlop][8]);
+
+ //
+ // Release adc result semaphore
+ //
+ //the ADC Process task is mot currently active. the results will be copied to a second buffer and supplied upon request
+ //Semaphore_post(adcResultSem);
+}
+
+//*****************************************************************************
+//
+//*****************************************************************************
+Void ADCProcessTask(UArg arg0, UArg arg1)
+{
+ while(1)
+ {
+ //
+ // Wait until new ADC data is available
+ //
+ Semaphore_pend(adcResultSem, BIOS_WAIT_FOREVER);
+
+ //
+ // Process the ADC data
+ //
+ if (processCallBack != NULL)
+ {
+ processCallBack(g_pui32ADCData[bufferFlipFlop]);
+ }
+ }
+}
+
+//*****************************************************************************
+//
+// This function initializes the ADC hardware in preparation for data
+// acquisition.
+//
+//*****************************************************************************
+void ADCAcquireInit(void)
+{
+ uint32_t ui32Chan, ui32Base, ui32Seq;
+
+ //Avaraging 8
+ MAP_ADCHardwareOversampleConfigure(ADC0_BASE, 8);
+ MAP_ADCHardwareOversampleConfigure(ADC1_BASE, 8);
+ //
+ // Initialize both ADC peripherals using sequencer 0 and processor trigger.
+ //
+ MAP_ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
+ MAP_ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
+
+
+ //
+ // Enter loop to configure all of the ADC sequencer steps needed to
+ // acquire the data for the data logger. Multiple ADC and sequencers
+ // will be used in order to acquire all the channels.
+ //
+ for(ui32Chan = 0; ui32Chan < NUM_ADC_CHANNELS; ui32Chan++)
+ {
+ //
+ // If this is the first ADC then set the base for ADC0
+ //
+ if(ui32Chan < 8)
+ {
+ ui32Base = ADC0_BASE;
+ ui32Seq = 0;
+ }
+ else if(ui32Chan < 16)
+ {
+ //
+ // Second ADC, set the base for ADC1
+ //
+ ui32Base = ADC1_BASE;
+ ui32Seq = 0;
+ }
+
+ //
+ // Get the channel control for each channel. Test to see if it is the
+ // last channel for the sequencer, and if so then also set the
+ // interrupt and "end" flags.
+ //
+ uint32_t ui32ChCtl = g_pui32ADCSeq[ui32Chan];
+ //TODO define all the numbers under #define and not here
+ if((ui32Chan == 7) || (ui32Chan == 15) || (ui32Chan == (NUM_ADC_CHANNELS - 1)))
+ {
+ ui32ChCtl |= ADC_CTL_IE | ADC_CTL_END;
+ }
+
+ //
+ // Configure the sequence step
+ //
+ MAP_ADCSequenceStepConfigure(ui32Base, ui32Seq, ui32Chan % 8, ui32ChCtl);
+ }
+
+ if (!isInitialized)
+ {
+ // Create a periodic Clock Instance with _period - triggers the ADC sampling
+ isInitialized = true;
+
+ //InitI2C();
+ }
+}
+
+//*****************************************************************************
+//
+// This function is called to start an acquisition running. It determines
+// which channels are to be logged, enables the ADC/I2C sequencers.
+// This will start the acquisition running.
+//
+//*****************************************************************************
+void ADCAcquireStart(ProcessCallback _callback, uint32_t _period)
+{
+ //
+ // Enable the ADC sequencers
+ //
+ MAP_ADCSequenceEnable(ADC0_BASE, 0);
+ MAP_ADCSequenceEnable(ADC1_BASE, 0);
+
+ //
+ // Flush the ADC sequencers to be sure there is no lingering/ trush data.
+ //
+ MAP_ADCSequenceDataGet(ADC0_BASE, 0, g_pui32ADCData[0]);
+ MAP_ADCSequenceDataGet(ADC1_BASE, 0, g_pui32ADCData[0]);
+
+ //
+ // Enable ADC interrupts
+ //
+ MAP_ADCIntClear(ADC0_BASE, 0);
+ MAP_ADCIntClear(ADC1_BASE, 0);
+ MAP_ADCIntEnable(ADC0_BASE, 0);
+ MAP_IntEnable(INT_ADC0SS0);
+
+ // Store process
+ processCallBack = _callback;
+ // Start a periodic Clock Instance with _period - triggers the ADC sampling
+ adcCollectActive = true;
+ //
+ // Logging data should now start running
+ //
+}
+
+//*****************************************************************************
+//
+// This function is called to stop an acquisition running. It disables the
+// ADC sequencers.
+//
+//*****************************************************************************
+void ADCAcquireStop(void)
+{
+ //Stop trigger adc sampling
+ adcCollectActive = false;
+ //
+ // Disable ADC interrupts
+ //
+ MAP_IntDisable(INT_ADC0SS0);
+ MAP_IntDisable(INT_ADC1SS0);
+
+ //
+ // Disable ADC sequencers
+ //
+ MAP_ADCSequenceDisable(ADC0_BASE, 0);
+ MAP_ADCSequenceDisable(ADC1_BASE, 0);
+}
+
diff --git a/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h
new file mode 100644
index 000000000..f4e17ad3f
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/ADC_Sampling/ADC.h
@@ -0,0 +1,49 @@
+
+#ifndef DRIVERS_ADC_H_
+#define DRIVERS_ADC_H_
+
+#include <stdint.h>
+
+//*****************************************************************************
+//
+// The following are indexes for values returned from the ADC's. These index's
+// map directly to g_pui32ADCSeq[], and inside this array there is a directly
+// ADC copied data
+//*****************************************************************************
+
+typedef enum
+{
+ AIR_PRESSURE_1,
+ AIR_PRESSURE_2,
+ DISPENSE_PRESSURE_1,
+ DISPENSE_PRESSURE_2,
+ DISPENSE_PRESSURE_3,
+ DISPENSE_PRESSURE_4,
+ DISPENSE_PRESSURE_5,
+ DISPENSE_PRESSURE_6,
+ DISPENSE_PRESSURE_7,
+ DISPENSE_PRESSURE_8,
+ LEFT_DANCER_1,
+ LEFT_DANCER_2,
+ RIGHT_DANCER,
+ DRYER_CURRENT_1,
+ DRYER_CURRENT_2,
+ DRYER_CURRENT_3,
+ MAX_ADC_DEVICES
+}ADC_DATA_DEVICES;
+//max potentiometer read in I2C protocol
+#define MAX_DIGITAL_POTENTIOMETER_READ 0x660D
+
+typedef void (*ProcessCallback)(uint32_t* adcData);
+
+void ADCAcquireInit(void);
+
+uint32_t ADC_TriggerCollection(void);
+
+uint32_t ADC_GetReading(int DataItemId);
+
+void ADCAcquireStart(ProcessCallback _callback, uint32_t _period);
+
+void ADCAcquireStop(void);
+
+#endif /* DRIVERS_ADC_H_ */
diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c
new file mode 100644
index 000000000..5eea54a1c
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.c
@@ -0,0 +1,488 @@
+//Avi Last update: 20/12/17
+//Based on TM4C129_SSI3_MacronixFlash.c
+//On board Quad SPI 512Mb Flash
+
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdbool.h>
+#include "inc/hw_memmap.h"
+#include "inc/hw_types.h"
+#include "inc/hw_gpio.h"
+#include "inc/hw_ssi.h"
+#include "inc/hw_sysctl.h"
+#include "inc/hw_epi.h"
+#include "inc/hw_ints.h"
+#include "inc/hw_nvic.h"
+
+#include "driverlib/debug.h"
+#include "driverlib/fpu.h"
+#include "driverlib/gpio.h"
+#include "driverlib/rom.h"
+#include "driverlib/rom_map.h"
+#include "driverlib/interrupt.h"
+#include "driverlib/pin_map.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/ssi.h"
+#include "driverlib/uart.h"
+#include "utils/uartstdio.h"
+
+#include "drivers/twine_graphicslib/graphics_adapter.h"
+#include "include.h"
+
+//#define NUM_SSI_DATA 20
+#define INS_WRITE_ENABLE 0x06
+#define INS_READ_STATUS_REGISTER1 0x05
+#define DUMMY_BYTE 0x00
+#define FLASH_BUSY_BIT 0x01
+#define FLASH_WRITE_EN_LATCH_BIT 0x02
+#define INS_SECTOR_ERASE_4KB 0x20
+#define INS_PAGE_PROGRAM 0x02
+#define INS_READ_DATA 0x03
+
+
+uint8_t g_ui8InstrReadID[] = {0x90,0x00,0x00,0x00};
+//uint32_t pui32DataTx[NUM_SSI_DATA];
+//uint32_t pui32DataRx[NUM_SSI_DATA];
+
+//*****************************************************************************
+//
+// This function sets up SSI External Flash ID Read
+//
+//*****************************************************************************
+uint32_t SSILibSendReadIDAdvMode(uint32_t ui32Base)
+{
+ uint32_t ui32Idx, ui32Receive;
+ uint32_t ui32MfgID;
+ uint32_t ui32DevID;
+ uint32_t ui32ReadID[]={0xaa,0xaa};
+ uint32_t ui32ReadIDFlash;
+
+ for(ui32Idx = 0; ui32Idx < sizeof(g_ui8InstrReadID) / sizeof(g_ui8InstrReadID[0]); ui32Idx++)
+ {
+ SSIDataPut(ui32Base, g_ui8InstrReadID[ui32Idx]);
+ }
+
+ SSIAdvModeSet(ui32Base,SSI_ADV_MODE_READ_WRITE);
+ SSIDataPut(ui32Base, 0x00);
+ SSIDataGet(ui32Base, &ui32Receive);
+ ui32ReadID[0] = ui32Receive;
+ SSIAdvDataPutFrameEnd(ui32Base,0x00);
+ SSIDataGet(ui32Base, &ui32Receive);
+ ui32ReadID[1] = ui32Receive;
+ ui32MfgID = ui32ReadID[0];
+ ui32DevID = ui32ReadID[1];
+ ui32ReadIDFlash = ui32MfgID;
+
+ ui32ReadIDFlash = ui32ReadIDFlash << 8;
+ ui32ReadIDFlash |= ui32DevID;
+
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+
+ return ui32ReadIDFlash;
+}
+
+uint8_t SSILibSendReadStatusRegister(uint32_t ui32Base, uint8_t ui8FlashCommand)
+{
+ uint32_t ui32Status = 0;
+ uint8_t ui8FlashStatus;
+
+ SSIAdvFrameHoldEnable(ui32Base);
+ SSIDataPut(ui32Base,ui8FlashCommand);
+ SSIAdvModeSet(ui32Base,SSI_ADV_MODE_READ_WRITE);
+ SSIAdvDataPutFrameEnd(ui32Base,DUMMY_BYTE);
+ while(SSIBusy(ui32Base));
+ SSIDataGet(ui32Base, &ui32Status);
+ ui8FlashStatus = (uint8_t)ui32Status;
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+
+ return ui8FlashStatus;
+}
+
+
+void SSILibDeviceBusyCheck(uint32_t ui32Base)
+{
+ uint8_t ui8TempData=0xFF;
+
+ ui8TempData = SSILibSendReadStatusRegister(ui32Base,INS_READ_STATUS_REGISTER1);
+
+ while((ui8TempData & FLASH_BUSY_BIT) == FLASH_BUSY_BIT)
+ {
+ ui8TempData = SSILibSendReadStatusRegister(ui32Base,INS_READ_STATUS_REGISTER1);
+ }
+}
+
+void SSILibSendPageProgram(uint32_t ui32Base, uint32_t ui32Address, uint8_t ui8FlashCommand)
+{
+ uint32_t ui32TempAddr, ui32TempData;
+ uint8_t ui8AddrByte1, ui8AddrByte2, ui8AddrByte3;
+
+ ui32TempAddr = ui32Address >> 16 ;
+ ui8AddrByte1 = (uint8_t)ui32TempAddr;
+ ui32TempAddr = ui32Address >> 8 ;
+ ui8AddrByte2 = (uint8_t)ui32TempAddr;
+ ui8AddrByte3 = (uint8_t)ui32Address;
+
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+ SSIAdvFrameHoldEnable(ui32Base);
+ SSIAdvDataPutFrameEnd(ui32Base,INS_WRITE_ENABLE);
+ while(SSIBusy(ui32Base));
+
+ ui32TempData = SSILibSendReadStatusRegister(ui32Base,INS_READ_STATUS_REGISTER1);
+ while((ui32TempData & FLASH_WRITE_EN_LATCH_BIT) != FLASH_WRITE_EN_LATCH_BIT) {
+ ui32TempData = SSILibSendReadStatusRegister(ui32Base,INS_READ_STATUS_REGISTER1);
+ }
+
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+ SSIAdvFrameHoldEnable(ui32Base);
+ SSIDataPut(ui32Base,ui8FlashCommand);
+ SSIDataPut(ui32Base,ui8AddrByte1);
+ SSIDataPut(ui32Base,ui8AddrByte2);
+ SSIDataPut(ui32Base,ui8AddrByte3);
+}
+
+void SSILibSendReadDataAdvBi(uint32_t ui32Base, uint32_t ui32Address, uint8_t ui8FlashCommand)
+{
+ uint32_t ui32TempAddr;
+ uint8_t ui8AddrByte1, ui8AddrByte2, ui8AddrByte3;
+
+ ui32TempAddr = ui32Address >> 16 ;
+ ui8AddrByte1 = (uint8_t)ui32TempAddr;
+ ui32TempAddr = ui32Address >> 8 ;
+ ui8AddrByte2 = (uint8_t)ui32TempAddr;
+ ui8AddrByte3 = (uint8_t)ui32Address;
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+ SSIAdvFrameHoldEnable(ui32Base);
+ SSIDataPut(ui32Base,ui8FlashCommand);
+ SSIDataPut(ui32Base,ui8AddrByte1);
+ SSIDataPut(ui32Base,ui8AddrByte2);
+ SSIDataPut(ui32Base,ui8AddrByte3);
+
+ SSIAdvModeSet(ui32Base,SSI_ADV_MODE_READ_WRITE);
+}
+
+
+//*****************************************************************************
+//
+// This function sets up SSI External Flash Erase
+//
+//*****************************************************************************
+void SSILibSendEraseCommand (uint32_t ui32Base, uint32_t ui32Address, uint8_t ui8FlashCommand)
+{
+ uint32_t ui32TempAddr, ui32TempData;
+ uint8_t ui8AddrByte1, ui8AddrByte2, ui8AddrByte3;
+
+ ui32TempAddr = ui32Address >> 16 ;
+
+ ui8AddrByte1 = (uint8_t)ui32TempAddr;
+ ui32TempAddr = ui32Address >> 8 ;
+ ui8AddrByte2 = (uint8_t)ui32TempAddr;
+ ui8AddrByte3 = (uint8_t)ui32Address;
+
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+ SSIAdvFrameHoldEnable(ui32Base);
+ SSIAdvDataPutFrameEnd(ui32Base,INS_WRITE_ENABLE);
+ while(SSIBusy(ui32Base));
+
+ ui32TempData = SSILibSendReadStatusRegister(ui32Base,INS_READ_STATUS_REGISTER1);
+ while((ui32TempData & FLASH_WRITE_EN_LATCH_BIT) != FLASH_WRITE_EN_LATCH_BIT) {
+ ui32TempData = SSILibSendReadStatusRegister(ui32Base,INS_READ_STATUS_REGISTER1);
+ }
+
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+ SSIAdvFrameHoldEnable(ui32Base);
+ SSIDataPut(ui32Base,ui8FlashCommand);
+ SSIDataPut(ui32Base,ui8AddrByte1);
+ SSIDataPut(ui32Base,ui8AddrByte2);
+ SSIAdvDataPutFrameEnd(ui32Base,ui8AddrByte3);
+ while(SSIBusy(ui32Base));
+ //wait till the erase is completed
+ SSILibDeviceBusyCheck(ui32Base);
+
+}
+
+
+int Init_Ext_Flash()
+{
+ uint32_t pui32Dummy[1];
+ uint32_t ui32SysClockFreq;
+
+ //
+ // Set the clocking to run directly from the external crystal/oscillator.
+ // TODO: The SYSCTL_XTAL_ value must be changed to match the value of the
+ // crystal on your board.
+ //
+ ui32SysClockFreq = SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
+ SYSCTL_OSC_MAIN |
+ SYSCTL_USE_PLL |
+ SYSCTL_CFG_VCO_480), 120000000);
+
+ // Display the setup on the console.
+ writeLine("SSI3 To DK-TM4C129 FLASH TRANSFER");
+
+ // The SSI3 peripheral must be enabled for use.
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI3);
+
+ //
+ // For this example SSI3 is used with PortA[5:2]. The actual port and pins
+ // used may be different on your part, consult the data sheet for more
+ // information. GPIO port A needs to be enabled so these pins can be used.
+ // TODO: change this to whichever GPIO port you are using.
+ //
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOQ);
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
+
+ //
+ // GPIO Port F0 Pin is Locked. So Unlock and write the CR bit
+ //
+ HWREG(GPIO_PORTF_BASE+GPIO_O_LOCK) = GPIO_LOCK_KEY;
+ HWREG(GPIO_PORTF_BASE+GPIO_O_CR) |= GPIO_PIN_0;
+
+ //
+ // Configure the pin muxing for SSI3 functions on port Q0, Q1, Q2, F0,
+ // F4, F5
+ //
+ GPIOPinConfigure(GPIO_PQ0_SSI3CLK);
+ GPIOPinConfigure(GPIO_PQ1_SSI3FSS);
+ GPIOPinConfigure(GPIO_PQ2_SSI3XDAT0);
+ GPIOPinConfigure(GPIO_PF0_SSI3XDAT1);
+ GPIOPinConfigure(GPIO_PF4_SSI3XDAT2);
+ GPIOPinConfigure(GPIO_PF5_SSI3XDAT3);
+
+ //
+ // Configure the GPIO settings for the SSI pins. This function also gives
+ // control of these pins to the SSI hardware. Consult the data sheet to
+ // see which functions are allocated per pin.
+ // The pins are assigned as follows:
+ // PF5 - SSI3XDAT3
+ // PF4 - SSI3XDAT2
+ // PF0 - SSI3XDAT1
+ // PQ2 - SSI3XDAT0
+ // PQ1 - SSI3Fss
+ // PQ0 - SSI3CLK
+ // TODO: change this to select the port/pin you are using.
+ //
+ GPIOPinTypeSSI(GPIO_PORTQ_BASE, GPIO_PIN_2 | GPIO_PIN_1 |
+ GPIO_PIN_0);
+ GPIOPinTypeSSI(GPIO_PORTF_BASE, GPIO_PIN_5 | GPIO_PIN_4 |
+ GPIO_PIN_0);
+
+ //
+ // Configure and enable the SSI port for SPI master mode. Use SSI3,
+ // system clock supply, idle clock level low and active low clock in
+ // freescale SPI mode, master mode, 1MHz SSI frequency, and 8-bit data.
+ // For SPI mode, you can set the polarity of the SSI clock when the SSI
+ // unit is idle. You can also configure what clock edge you want to
+ // capture data on. Please reference the datasheet for more information on
+ // the different SPI modes.
+ //
+ SSIConfigSetExpClk(SSI3_BASE, ui32SysClockFreq, SSI_FRF_MOTO_MODE_0,
+ SSI_MODE_MASTER, 1000000, 8);
+
+ //
+ // Enable the SSI3 module.
+ //
+ SSIAdvModeSet(SSI3_BASE,SSI_ADV_MODE_WRITE);
+ SSIAdvFrameHoldEnable(SSI3_BASE);
+ SSIEnable(SSI3_BASE);
+
+ //
+ // Read any residual data from the SSI port. This makes sure the receive
+ // FIFOs are empty, so we don't read any unwanted junk. This is done here
+ // because the SPI SSI mode is full-duplex, which allows you to send and
+ // receive at the same time. The SSIDataGetNonBlocking function returns
+ // "true" when data was returned, and "false" when no data was returned.
+ // The "non-blocking" function checks if there is any data in the receive
+ // FIFO and does not "hang" if there isn't.
+ //
+ while(SSIDataGetNonBlocking(SSI3_BASE, &pui32Dummy[0]))
+ {
+ }
+
+ return 0;
+}
+
+int Init_TxBuf(uint32_t NumOfWords, uint32_t* TxBuf)
+{
+ uint32_t ui32Index;
+
+ for(ui32Index=0;ui32Index<NumOfWords;ui32Index++)
+ {
+ TxBuf[ui32Index] = rand()%256;
+ }
+
+ return 0;
+}
+
+int Init_RxBuf(uint32_t NumOfWords, uint32_t* RxBuf)
+{
+ uint32_t ui32Index;
+
+ for(ui32Index=0;ui32Index<NumOfWords;ui32Index++)
+ {
+ RxBuf[ui32Index] = 0x0;
+ }
+
+ return 0;
+}
+
+
+int Read_Ext_Flash_Device_ID()
+{
+ uint32_t ui32DeviceID;
+
+ ui32DeviceID = SSILibSendReadIDAdvMode(SSI3_BASE);
+ if(ui32DeviceID != 0xC219)
+ {
+ writeLine("No External Flash... Read Back:");
+ writeFloat(ui32DeviceID);
+ while(1);
+ }
+
+ writeLine("External Flash Detected with Device ID:");
+ writeFloat(ui32DeviceID);
+
+ return 0;
+}
+
+int Erase_Sector_before_writting_To_Ext_Flash()
+{
+ writeLine("Starting Erase Operations...");
+
+ SSILibSendEraseCommand(SSI3_BASE,0x0,INS_SECTOR_ERASE_4KB);
+
+ writeLine("Erase Completed...");
+
+ return 0;
+}
+
+int Write_Words_To_Ext_Flash(uint32_t NumOfWords, uint32_t* TxBuf)
+{
+
+ uint32_t ui32Index;
+
+ writeLine("Starting Write Operations...");
+
+ SSILibSendPageProgram(SSI3_BASE,0x0,INS_PAGE_PROGRAM);
+
+ for(ui32Index=0;ui32Index<NumOfWords-1;ui32Index++)
+ {
+ SSIDataPut(SSI3_BASE,TxBuf[ui32Index]);
+ }
+
+ SSIAdvDataPutFrameEnd(SSI3_BASE,TxBuf[NumOfWords-1]);
+
+ writeLine("Write Completed...");
+
+ return 0;
+}
+
+int Read_Words_From_Ext_Flash(uint32_t NumOfWords, uint32_t* RxBuf)
+{
+
+ uint32_t ui32Index;
+
+ writeLine("Starting Read Operations...");
+
+ SSILibSendReadDataAdvBi(SSI3_BASE,0x0,INS_READ_DATA);
+
+ for(ui32Index=0;ui32Index<NumOfWords-1;ui32Index++)
+ {
+ SSIDataPut(SSI3_BASE,DUMMY_BYTE);
+ SSIDataGet(SSI3_BASE,&RxBuf[ui32Index]);
+ }
+ SSIAdvDataPutFrameEnd(SSI3_BASE,DUMMY_BYTE);
+ SSIDataGet(SSI3_BASE,&RxBuf[NumOfWords-1]);
+
+ writeLine("Read Completed...");
+
+ return 0;
+}
+
+int Display_RX_TX_Ext_Flash_Data(uint32_t NumOfWords, uint32_t* TxBuf, uint32_t* RxBuf)
+{
+ uint32_t ui32Index;
+
+ for(ui32Index=0;ui32Index<NumOfWords;ui32Index++)
+ {
+ writeLine("#");
+ writeFloat(ui32Index);
+
+ if(TxBuf != NULL)
+ {
+ writeLine("Write: ");
+ writeFloat(TxBuf[ui32Index]);
+ }
+
+ if(RxBuf != NULL)
+ {
+ writeLine("Read: ");
+ writeFloat(RxBuf[ui32Index]);
+ }
+ }
+
+ return 0;
+}
+
+//*****************************************************************************
+//
+// Configure SSI3 in master Freescale (SPI) mode. This example will send out
+// 3 bytes of data, then wait for 3 bytes of data to come in. This will all be
+// done using the polling method.
+//
+//*****************************************************************************
+int Ext_Flash_Operation(uint32_t Operation, uint32_t NumOfWords, uint32_t* pui32DataTx, uint32_t* pui32DataRx )//main
+{
+
+/* uint32_t* pui32DataTx;
+ uint32_t* pui32DataRx;
+
+ pui32DataTx = (uint32_t*) malloc(NumOfWords*sizeof(uint32_t));
+ pui32DataRx = (uint32_t*) malloc(NumOfWords*sizeof(uint32_t));*/
+
+ Init_Ext_Flash();
+
+ // Read the DEVICE ID
+ Read_Ext_Flash_Device_ID();
+
+ if((Operation == TX) || (Operation == TXRX))
+ {
+ // --------------------------- TX ------------------------------------------
+ // Initialise the Transmit Buffer
+ //Init_TxBuf(NumOfWords, pui32DataTx);// with random numbers
+
+ // Display Data
+ Display_RX_TX_Ext_Flash_Data(NumOfWords, pui32DataTx, NULL);
+
+ // Erase the Sector before Program Operation...
+ Erase_Sector_before_writting_To_Ext_Flash();
+
+ // Write NUM_SSI_DATA words to the External Flash
+ Write_Words_To_Ext_Flash(NumOfWords, pui32DataTx);
+ }
+
+ if((Operation == RX) || (Operation == TXRX))
+ {
+ // --------------------------- RX ------------------------------------------
+
+ // Initialise the Receive Buffer
+ Init_RxBuf(NumOfWords, pui32DataRx);
+
+ // Read NUM_SSI_DATA words from the External Flash
+ Read_Words_From_Ext_Flash(NumOfWords, pui32DataRx);
+
+ if(Operation == RX)
+ {
+ // Display Data
+ Display_RX_TX_Ext_Flash_Data(NumOfWords, NULL, pui32DataRx);
+ }
+ else
+ {
+ // Display Data
+ Display_RX_TX_Ext_Flash_Data(NumOfWords, pui32DataTx, pui32DataRx);
+ }
+
+ }
+
+ return 0;
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h
new file mode 100644
index 000000000..3271c6abb
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/Flash_Memory/Flash_Memory.h
@@ -0,0 +1,6 @@
+#ifndef FLASHMEMORY_H
+#define FLASHMEMORY_H
+
+int Ext_Flash_Operation();
+
+#endif //FLASHMEMORY_H
diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c
new file mode 100644
index 000000000..0b85053c0
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.c
@@ -0,0 +1,60 @@
+/************************************************************************************************************************
+ * Heater.c
+ * Heater Driver
+ **************************************************************************************************************************/
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+
+#include "inc/hw_memmap.h"
+
+#include "driverlib/rom.h"
+#include "driverlib/gpio.h"
+#include "driverlib/sysctl.h"
+
+#include <Modules/Stubs_Handler/DataDef.h>
+#include <Modules/Stubs_Handler/User_Leds.h>
+#include "PMR/Hardware/HardwarePIDControl.pb-c.h"
+
+#define MAX_HEATERS_NUM HARDWARE_PID_CONTROL_TYPE__MixerHeater+1
+
+typedef struct
+{
+ uint32_t m_port;
+ uint32_t m_pin;
+ bool Active;
+} GPIOIntPortMap;
+
+static GPIOIntPortMap portMap[MAX_HEATERS_NUM] =
+{
+ {GPIO_PORTQ_BASE, GPIO_INT_PIN_7, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeater1000w
+ {GPIO_PORTQ_BASE, GPIO_INT_PIN_4, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeater200w1
+ {GPIO_PORTQ_BASE, GPIO_INT_PIN_4, false}, // HARDWARE_PID_CONTROL_TYPE__DryerHeater200w2
+ {GPIO_PORTN_BASE, GPIO_INT_PIN_5, false}, // HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ1
+ {GPIO_PORTN_BASE, GPIO_INT_PIN_5, false}, // HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ2
+ {GPIO_PORTN_BASE, GPIO_INT_PIN_5, false}, // HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ3
+ {GPIO_PORTN_BASE, GPIO_INT_PIN_5, false}, // HARDWARE_PID_CONTROL_TYPE__HeadHeaterZ4
+ {GPIO_PORTN_BASE, GPIO_INT_PIN_5, false}, // HARDWARE_PID_CONTROL_TYPE__MixerHeater
+};
+uint32_t ActivateHeater (int HeaterId)
+{
+ assert(HeaterId < MAX_HEATERS_NUM);
+ ROM_GPIOPinWrite(portMap[HeaterId].m_port, portMap[HeaterId].m_pin, ROM_GPIOPinRead(portMap[HeaterId].m_port, GPIO_BYTE)|portMap[HeaterId].m_pin); //Turn the Heater ON
+ portMap[HeaterId].Active = true;
+ return OK;
+}
+uint32_t DeActivateHeater (int HeaterId)
+{
+ assert(HeaterId < MAX_HEATERS_NUM);
+ ROM_GPIOPinWrite(portMap[HeaterId].m_port, portMap[HeaterId].m_pin, ROM_GPIOPinRead(portMap[HeaterId].m_port, GPIO_BYTE)&~portMap[HeaterId].m_pin); //Turn the Heater OFF
+ portMap[HeaterId].Active = false;
+ return OK;
+}
+bool GetHeaterState (int HeaterId)
+{
+ assert(HeaterId < MAX_HEATERS_NUM);
+ return portMap[HeaterId].Active;
+}
+
diff --git a/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.h b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.h
new file mode 100644
index 000000000..9292f10b7
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/Heater/Heater.h
@@ -0,0 +1,7 @@
+#define HEATER_ON true
+#define HEATER_OFF false
+
+
+uint32_t ActivateHeater (int HeaterId);
+uint32_t DeActivateHeater (int HeaterId);
+bool GetHeaterState (int HeaterId);
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c
new file mode 100644
index 000000000..22a01f6aa
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.c
@@ -0,0 +1,127 @@
+
+#include "Drivers/I2C_Communication/I2C.h"
+#include <driverlib/sysctl.h>
+#include <driverlib/rom_map.h>
+#include <inc/hw_memmap.h>
+#include <driverlib/i2c.h>
+#include "include.h"
+//#include "Common/Sys_Configuration/Configuration.h"
+
+#define CONFIG_REGISTER_ADDRESS 0x01
+#define LSB_BITMAP_CONFIGURATION_OF_CONFIG_REG 0x83
+
+#define MSB_BITMAP_CONFIG_REG_SAMPELING_CHANEL_A0 0xc4
+#define MSB_BITMAP_CONFIG_REG_SAMPELING_CHANEL_A1 0xd4
+#define MSB_BITMAP_CONFIG_REG_SAMPELING_CHANEL_A2 0xe4
+#define MSB_BITMAP_CONFIG_REG_SAMPELING_CHANEL_A3 0xf4
+
+#define START_DATA_DELAY 1500
+#define READ_DATA_DELAY 1000
+#define END_DATA_DELAY 100000
+
+#define SLAVE_ADDRESS_1 0x48
+#define SLAVE_ADDRESS_2 0x4a
+#define SLAVE_NUM_OF_CHAN 4
+#define I2C_FIRST_CHANNEL_ADDR 0xc3
+#define START_WRITING_TO_CONFIG_REG_IN_SLAVE 0x01
+#define START_READ_FROM_CONVERSION_REG_IN_SLAVE 0x00 //read sampled results
+
+void InitI2C(void)
+{
+ //
+ MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
+ //
+ // Stop the Clock, Reset and Enable I2C Module
+ // in Master Function
+ //
+ MAP_SysCtlPeripheralDisable(SYSCTL_PERIPH_I2C0);
+ MAP_SysCtlPeripheralReset(SYSCTL_PERIPH_I2C0);
+ MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
+
+ //
+ // Wait for the Peripheral to be ready for programming
+ //
+ while(!MAP_SysCtlPeripheralReady(SYSCTL_PERIPH_I2C0));
+ //
+ // Initialize the I2C master module.
+ //
+ I2CMasterInitExpClk (I2C0_BASE, SYS_CLK_FREQ, true);
+}
+
+//each entry into the function reads result from one sampled channel in the USB
+void SampleI2CData(uint32_t* resultData)
+{
+ uint8_t _resultData[2];
+ static uint8_t _currSlaveAddress = SLAVE_ADDRESS_1;
+ static uint8_t _currChannel = 0;
+ uint8_t dataIndex = 0;
+
+ // modulo calculation used to take specific channel from ADC each time - channel 0,1,2,3
+ _currChannel = (_currChannel+1) & 0x3;
+
+ //if finished reading first ADC channels , reset the channel index to next ADC
+ if ((_currSlaveAddress == SLAVE_ADDRESS_2) && (_currChannel == 3))
+ {
+ _currChannel = 0;
+ }
+
+ // reset slave addres to next ADC card
+ if (_currChannel == 0)
+ {
+ _currSlaveAddress = (_currSlaveAddress == SLAVE_ADDRESS_1) ? SLAVE_ADDRESS_2 : SLAVE_ADDRESS_1;
+ }
+
+ //calculate index of where to write result data in the resultData array
+ dataIndex = (_currSlaveAddress == SLAVE_ADDRESS_2) ? SLAVE_NUM_OF_CHAN + _currChannel : _currChannel;
+ // Send slave address and config reg address
+ I2CMasterSlaveAddrSet (I2C0_BASE, _currSlaveAddress, false);
+ I2CMasterDataPut(I2C0_BASE, START_WRITING_TO_CONFIG_REG_IN_SLAVE);
+ I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_START);
+ SysCtlDelay(1500);
+// while (!(I2CMasterBusy(I2C0_BASE))); //Wait till end of transaction
+// while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction
+
+ //Send MSB of config reg to current slave
+ uint32_t chanAddr = I2C_FIRST_CHANNEL_ADDR + 0x10*_currChannel;
+ I2CMasterDataPut(I2C0_BASE, chanAddr);
+ I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_CONT);
+ SysCtlDelay(15000);
+// while (!(I2CMasterBusy(I2C0_BASE))); //Wait till end of transaction
+// while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction
+
+ //Send LSB of config reg to current slave
+ I2CMasterDataPut(I2C0_BASE, 0xe3);
+ I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_BURST_SEND_FINISH);
+ SysCtlDelay(15000);
+// while (!(I2CMasterBusy(I2C0_BASE))); //Wait till end of transaction
+// while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction
+
+ // Send slave address and conversion reg address (reg for reading results)
+ I2CMasterSlaveAddrSet (I2C0_BASE, _currSlaveAddress, false);
+ I2CMasterDataPut(I2C0_BASE, START_READ_FROM_CONVERSION_REG_IN_SLAVE);
+ I2CMasterControl(I2C0_BASE,I2C_MASTER_CMD_SINGLE_SEND);
+ SysCtlDelay(15000);
+ // while (!(I2CMasterBusy(I2C0_BASE))); //Wait till end of transaction
+ //while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction
+
+ // Start Read from configured slave
+ I2CMasterSlaveAddrSet(I2C0_BASE, _currSlaveAddress, true);
+ I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START);
+ SysCtlDelay(15000);
+// while (!(I2CMasterBusy(I2C0_BASE))); //Wait till end of transaction
+// while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction
+ //each read result is represented in 16 bit this why we read twise
+ //each time in 8 bits
+ //read MSB byte
+ _resultData[0] = I2CMasterDataGet(I2C0_BASE);
+
+ I2CMasterControl(I2C0_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH);
+ SysCtlDelay(15000);
+// while (!(I2CMasterBusy(I2C0_BASE))); //Wait till end of transaction
+// while (I2CMasterBusy(I2C0_BASE)); //Wait till end of transaction
+ //read LSB byte
+ _resultData[1] = I2CMasterDataGet(I2C0_BASE);
+
+ //concutenate 2 reads of 8 bytes into one read of 16 bytes
+ resultData[dataIndex] = _resultData[0] << 8 | _resultData[1];
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h
new file mode 100644
index 000000000..c072ed156
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/I2C_Communication/I2C.h
@@ -0,0 +1,31 @@
+
+#ifndef DRIVERS_I2C_H_
+#define DRIVERS_I2C_H_
+
+
+#include <stdbool.h>
+#include <stdint.h>
+
+#define I2C_NUM_OF_CHANNELS 7 // 6 dispensers and feeder
+//front panel date saved in the same array of sampeled ADC data g_pui32ADCSeq[]
+
+#define I2C_START_INDEX 14
+#define I2C_ADC_DISP_1_POT 20
+#define I2C_ADC_DISP_2_POT 19
+#define I2C_ADC_DISP_3_POT 14
+#define I2C_ADC_DISP_4_POT 17
+#define I2C_ADC_DISP_5_POT 16
+#define I2C_ADC_DISP_6_POT 15
+#define I2C_ADC_FEEDER_POT 18
+
+
+/*********************************************************************************************
+ * this function is responsible for recieving a to d data of the potentiometers that connected
+ * to front panel and arrives in I2C communication protocol.
+ * input parameters - slave addres of I2C device
+ * buffer to write the result into
+ * index inside the beffer from where to atart writing
+ *********************************************************************************************/
+void SampleI2CData(uint32_t* _resultData);
+void InitI2C(void);
+#endif /* DRIVERS_I2C_H_ */
diff --git a/Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.c b/Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.c
new file mode 100644
index 000000000..0849538bf
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.c
@@ -0,0 +1,655 @@
+//*****************************************************************************
+//
+// Flashstore.c - Data logger module handles storage in flash.
+// this module is responsible for all memory interfacess in the system
+// each storage type can be defined here and to be accessed from this interface.
+// This module manages the storage of data logger of sampeled data and configuration into flash memory.
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <string.h>
+#include <inc/hw_types.h>
+#include <driverlib/flash.h>
+#include <utils/ustdlib.h>
+#include "Drivers/On_Chip_Flash/Flashstore.h"
+
+//*****************************************************************************
+//
+// This module manages the storage of data logger of sampeled data and configuration into flash memory.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Define the beginning and end of the flash storage area. You must make sure
+// that this area is well clear of any space occupied by the application
+// binary, and that this space is not used for any other purpose.
+// The start and end addresses must be 1K aligned. The end address is
+// exclusive - it is 1 value greater than the last valid location used for
+// storage.
+//
+//*****************************************************************************
+typedef struct
+{
+ uint32_t m_startAddress;
+ uint32_t m_endAddress;
+} DataSection_t;
+
+static DataSection_t g_ui32Addresses[NumOfDataTypes] = {{FLASH_STORE_START_ADDR,FLASH_STORE_END_ADDR},
+ {FLASH_CONFIG_START_ADDR,FLASH_CONFIG_END_ADDR}};
+
+//*****************************************************************************
+// This array holds pointer per memory section/type config each pointer represents
+// The next address in flash, that will be used for storing a data record.
+//
+//*****************************************************************************
+static uint32_t g_ui32StoreAddr[NumOfDataTypes];
+
+//*****************************************************************************
+//
+// A buffer used to assemble a complete record of data prior to storing it
+// in the flash.
+//
+//*****************************************************************************
+static uint32_t g_pui32RecordBuf[32];
+
+//*****************************************************************************
+//
+// Check for non cyclic section owerflow
+//
+//*****************************************************************************
+inline FlashStoreCheckCyclic(FlashDataType_t _dataType,uint32_t _currAddress)
+{
+ if ((_dataType == ConfigData) && (_currAddress > g_ui32Addresses[_dataType].m_endAddress))
+ {
+ //JigStopAllWithError("Internal: flash address owerflow");
+ }
+}
+
+//*****************************************************************************
+//
+// Initializes the flash storage. This is a stub because there is nothing
+// special to do.
+//
+//*****************************************************************************
+void FlashStoreInit(void)
+{
+}
+
+void FlashSendEndReq(FlashDataType_t _dataType)
+{
+/* if (_dataType == ADCData)
+ {
+ // Write last record
+ ((tLogRecord *)g_pui32RecordBuf)->m_itemMask = 0;
+ WriteLogRecord((tLogRecord *)g_pui32RecordBuf);
+ }*/
+}
+//*****************************************************************************
+//
+// Saves data records that are stored in the flash to an externally connected
+// USB memory storage device (USB stick).
+// The flash memory is scanned for the presence of store data records. When
+// records are found they are written in CSV format to the USB stick. This
+// function assumes a non-corrupted storage area, and that any records, once
+// found, are contiguous with all stored records. It will find the oldest
+// record and start with that when storing.
+//
+//*****************************************************************************
+int32_t FlashStoreSave(FlashDataType_t _dataType)
+{
+/* uint32_t ui32Addr, ui32OldestRecord, ui32OldestIndex, ui32Count, ui32PartialCount;
+ tLogRecord *p_sRecord;
+
+ //
+ // Initialize locals.
+ //
+ ui32OldestRecord = g_ui32Addresses[_dataType].m_startAddress;
+ ui32OldestIndex = FORMATED_FLASH_SIGNATURE;
+
+ //
+ // Show a message to the user.
+ //
+ //SetStatusText("SAVE\r\n", "SCANNING ", "FLASH\r\n", 0);
+
+ //
+ // Start at beginning of flash storage area
+ //
+ ui32Addr = g_ui32Addresses[_dataType].m_startAddress;
+
+ //
+ // Search all of flash area checking every stored record.
+ //
+ while(ui32Addr < g_ui32Addresses[_dataType].m_endAddress)
+ {
+ //
+ // If a record signature is found, check for oldest record, then
+ // increment to the next record
+ //
+ if((HWREG(ui32Addr) & CRC_SEED_MASK) == MAGIC_NUMBER_OF_FREE_REC_BEG)
+ {
+ //
+ // Get a pointer to the data record (account for flash header word)
+ //
+ p_sRecord = (tLogRecord *)(ui32Addr + RECORD_HEADER_SIZE);
+
+ //
+ // If the seconds in this record are older than any found so far
+ // then save the seconds value, and the address of this record
+ //
+ if(p_sRecord->m_recIndex < ui32OldestIndex)
+ {
+ ui32OldestIndex = p_sRecord->m_recIndex;
+ ui32OldestRecord = ui32Addr;
+ }
+
+ //
+ // Advance the address to the next record.
+ // jump to the begining of the next free page
+ ui32Addr += HWREG(ui32Addr) & RECORD_LENGTH_MASK;
+ }
+ else
+ {
+ //
+ // A record was not found so just advance to the next location in
+ // flash
+ //
+ ui32Addr += RECORD_HEADER_SIZE;
+ }
+ }
+
+ //
+ // If no "oldest" records was found, then there is no valid data stored
+ //
+ if(ui32OldestIndex == FORMATED_FLASH_SIGNATURE)
+ {
+ FlashSendEndReq(_dataType);
+ //SetStatusText("SAVE\r\n", "NO RECORDS ", "FOUND\r\n", 0);
+ return(1);
+ }
+
+ //
+ // Open the output file on the USB stick. It will return NULL if there
+ // was any problem.
+ // TODO open external flash
+// if(!USBStickOpenLogFile(0))
+// {
+// SetStatusText("SAVE", 0, "USB ERROR", "PRESS <");
+// return(1);
+// }
+
+ //
+ // Notify user we are saving data to USB
+ //
+ //SetStatusText("SAVE\r\n", "SAVING ", "TO USB\r\n", 0);
+
+ //
+ // Start reading records from flash, start at the address of the oldest
+ // record, as found above. We scan through records, assuming the flash
+ // store is not corrupted. Continue scanning until a blank space is
+ // found which should indicate the end of recorded data, or until we
+ // have read all the records.
+ //
+ ui32Addr = ui32OldestRecord;
+ while(HWREG(ui32Addr) != FORMATED_FLASH_SIGNATURE)
+ {
+ //
+ // If a record signature is found (which it should be), extract the
+ // record data and send it to USB stick.
+ //
+ if((HWREG(ui32Addr) & CRC_SEED_MASK) == MAGIC_NUMBER_OF_FREE_REC_BEG)
+ {
+ //
+ // Get byte count for this record
+ //
+ ui32Count = HWREG(ui32Addr) & RECORD_LENGTH_MASK;
+
+ //
+ // Adjust the count and the address to remove the flash header
+ //
+ ui32Count -= RECORD_HEADER_SIZE;
+ ui32Addr += RECORD_HEADER_SIZE;
+
+ //
+ // Adjust for memory wrap
+ //
+ if(ui32Addr >= g_ui32Addresses[_dataType].m_endAddress)
+ {
+ FlashStoreCheckCyclic(_dataType,ui32Addr);
+ ui32Addr = g_ui32Addresses[_dataType].m_startAddress;
+ }
+
+ //
+ // If the contents of this record go past the end of the memory
+ // storage area, then perform a partial copy first.
+ //
+ ui32PartialCount = 0;
+
+ if((ui32Addr + ui32Count) >= g_ui32Addresses[_dataType].m_endAddress)
+ {
+ FlashStoreCheckCyclic(_dataType,ui32Addr + ui32Count);
+ //
+ // Find how many bytes are left on this page
+ //
+ ui32PartialCount = g_ui32Addresses[_dataType].m_endAddress - ui32Addr;
+
+ //
+ // Copy the portion until the end of memory store, adjust
+ // remaining count and address
+ //
+ memcpy(g_pui32RecordBuf, (void *)ui32Addr, ui32PartialCount);
+ ui32Count -= ui32PartialCount;
+ ui32Addr = g_ui32Addresses[_dataType].m_startAddress;
+ }
+
+ //
+ // Copy entire record (or remaining part of record if memory wrap)
+ // into record buffer
+ //
+ memcpy(&g_pui32RecordBuf[ui32PartialCount / 4], (void *)ui32Addr,ui32Count);
+
+ //
+ // Update address pointer to next record
+ //
+ ui32Addr += ui32Count;
+
+ //
+ // Now we have an entire data logger record copied from flash
+ // storage into a local (contiguous) memory buffer. Pass it
+ // to the USB file writing function to write the record to the
+ // USB stick.
+ //
+ switch(_dataType)
+ {
+ case ConfigData:
+ {
+ //ConfigurationReadData((tLogRecord *)g_pui32RecordBuf); TODO fix
+ break;
+ }
+ case ADCData:
+ {
+ //WriteLogRecord((tLogRecord *)g_pui32RecordBuf); TODO fix
+ break;
+ }
+ }
+ }
+ else
+ {
+ //
+ // This should not happen, but it means we ended up in a non-blank
+ // location that is not the start of a record. In this case just
+ // advance through memory until either a blank location or another
+ // record is found.
+ //
+ // Increment to next word in flash, adjust for memory wrap.
+ //
+ ui32Addr += RECORD_HEADER_SIZE;
+ if(ui32Addr >= g_ui32Addresses[_dataType].m_endAddress)
+ {
+ FlashStoreCheckCyclic(_dataType,ui32Addr);
+ ui32Addr = g_ui32Addresses[_dataType].m_startAddress;
+ }
+ }
+ }
+
+ //
+ // Close the USB stick file so that any buffers will be flushed.
+ //
+ // TODO close extrnal flash USBStickCloseFile();
+
+ //
+ // Inform user that save is complete.
+ //
+ //SetStatusText("SAVE\r\n", "USB SAVE ", "COMPLETE\r\n", 0);
+ if (_dataType == ADCData)
+ {
+ FlashSendEndReq(_dataType);
+ }
+ //
+ // Return success
+ //
+ *
+ */
+ return(0);
+}
+
+//*****************************************************************************
+// function used to write into internal flash specific buffer
+//*****************************************************************************
+int32_t FlashStoreWriteBuffer(FlashDataType_t _dataType,uint32_t* _pui32Record,uint32_t _ui32ItemCount)
+{
+ //
+ // Check the arguments
+ //
+ if(!_pui32Record)
+ {
+ //JigStopAllWithError("Internal: empty flash record");
+ return(1);
+ }
+
+ //
+ // Check to see if the record is going to cross a page boundary.
+ //
+ if(((g_ui32StoreAddr[_dataType] & FLASH_PAGE_BOUNDARY_MASK) + _ui32ItemCount) > FLASH_PAGE_BOUNDARY_MASK)
+ {
+ //
+ // Find number of bytes remaining on this page
+ //
+ uint32_t ui32Idx = FLASH_PAGE_SIZE_IN_BYTES - (g_ui32StoreAddr[_dataType] & FLASH_PAGE_BOUNDARY_MASK);
+
+ //
+ // Program part of the record on the space remaining on the current
+ // page
+ //
+ FlashProgram(_pui32Record, g_ui32StoreAddr[_dataType], ui32Idx);
+
+ //
+ // Increment the store address by the amount just written, which
+ // should make the new store address be at the beginning of the next
+ // flash page.
+ //
+ g_ui32StoreAddr[_dataType] += ui32Idx;
+
+ //
+ // Adjust the remaining bytes to program, and the pointer to the
+ // remainder of the record data.
+ //
+ _ui32ItemCount -= ui32Idx;
+ _pui32Record = &_pui32Record[ui32Idx / NUMBER_OF_BYTES_IN_INT];
+
+ //
+ // Check to see if the new page is past the end of store and adjust
+ //
+ if(g_ui32StoreAddr[_dataType] >= g_ui32Addresses[_dataType].m_endAddress)
+ {
+ FlashStoreCheckCyclic(_dataType,g_ui32StoreAddr[_dataType]);
+ g_ui32StoreAddr[_dataType] = g_ui32Addresses[_dataType].m_startAddress;
+ }
+
+ //
+ // If new page is not blank, then erase it
+ //
+ if(HWREG(g_ui32StoreAddr[_dataType]) != FORMATED_FLASH_SIGNATURE)
+ {
+ FlashErase(g_ui32StoreAddr[_dataType]);
+ }
+ }
+
+ //
+ // Now program the remaining part of the record (if we crossed a page
+ // boundary above) or the full record to the current location in flash
+ //
+ FlashProgram(_pui32Record, g_ui32StoreAddr[_dataType], _ui32ItemCount);
+
+ //
+ // Increment the storage address to the next location.
+ //
+ g_ui32StoreAddr[_dataType] += _ui32ItemCount;
+
+ //
+ // Return success indication to caller.
+ //
+ return(0);
+}
+
+//*****************************************************************************
+//
+// This is called at the start of logging to prepare space in flash for
+// storage of logged data. It searches for the first blank area in the
+// flash storage to be used for storing records.
+//
+// If a starting address is specified then the search is skipped and it goes
+// directly to the new address. If the starting address is 0, then it performs
+// the search.
+//
+//*****************************************************************************
+int32_t FlashStoreOpenLogFile(FlashDataType_t _dataType,uint32_t _ui32StartAddr)
+{
+ uint32_t ui32Addr;
+
+ //
+ // If a valid starting address is specified, then just use that and skip
+ // the search below.
+ //
+ if((_ui32StartAddr >= g_ui32Addresses[_dataType].m_startAddress) &&
+ (_ui32StartAddr < g_ui32Addresses[_dataType].m_endAddress))
+ {
+ g_ui32StoreAddr[_dataType] = _ui32StartAddr;
+ return(0);
+ }
+
+ //
+ // Start at beginning of flash storage area
+ //
+ ui32Addr = g_ui32Addresses[_dataType].m_startAddress;
+
+ //
+ // Search until a blank is found or the end of flash storage area
+ //
+ while((HWREG(ui32Addr) != FORMATED_FLASH_SIGNATURE) && (ui32Addr < g_ui32Addresses[_dataType].m_endAddress))
+ {
+ //
+ // If a record signature is found, then increment to the next record
+ //
+ if((HWREG(ui32Addr) & CRC_SEED_MASK) == MAGIC_NUMBER_OF_FREE_REC_BEG)
+ {
+ ui32Addr += HWREG(ui32Addr) & RECORD_LENGTH_MASK;
+ }
+ else
+ {
+ //
+ // Just advance to the next location in flash
+ //
+ ui32Addr += RECORD_HEADER_SIZE;
+ }
+ }
+
+ //
+ // If we are at the end of flash that means no blank area was found.
+ // So reset to the beginning and erase the first page.
+ //
+ if(ui32Addr >= g_ui32Addresses[_dataType].m_endAddress)
+ {
+ ui32Addr = g_ui32Addresses[_dataType].m_startAddress;
+ FlashErase(ui32Addr);
+ }
+
+ //
+ // When we reach here we either found a blank location, or made a new
+ // blank location by erasing the first page.
+ // To keep things simple we are making an assumption that the flash store
+ // is not corrupted and that the first blank location implies the start
+ // of a blank area suitable for storing data records.
+ //
+ g_ui32StoreAddr[_dataType] = ui32Addr;
+
+ //
+ // Return success indication to caller
+ //
+ return(0);
+}
+
+//*****************************************************************************
+//
+// This is called each time there is a new data record to log to the flash
+// storage area. A simple algorithm is used which rotates programming
+// data log records through an area of flash. It is assumed that the current
+// page is blank. Records are stored on the current page until a page
+// boundary is crossed. If the page boundary is crossed and the new page
+// is not blank (testing only the first location), then the new page is
+// erased. Finally the entire record is programmed into flash and the
+// storage pointers are updated.
+//
+// While storing and when crossing to a new page, if the flash page is not
+// blank it is erased. So this algorithm overwrites old data.
+//
+// The data is stored in flash as a record, with a flash header prepended,
+// and with the record length padded to be a multiple of 4 bytes. The flash
+// header is a 3-byte magic number and one byte of record length.
+//
+//*****************************************************************************
+ /*int32_t FlashStoreWriteRecord(FlashDataType_t _dataType,tLogRecord *_psRecord)
+{
+
+ uint32_t ui32Idx, _ui32ItemCount, *_pui32Record;
+
+ //
+ // Check the arguments
+ //
+ if(!_psRecord)
+ {
+ JigStopAllWithError("Internal: invalid flash record");
+ return(1);
+ }
+
+ //
+ // Determine how many channels are to be logged
+ //
+ ui32Idx = _psRecord->m_itemMask;
+ _ui32ItemCount = 0;
+ while(ui32Idx)
+ {
+ if(ui32Idx & 1)
+ {
+ _ui32ItemCount++;
+ }
+ ui32Idx >>= 1;
+ }
+
+ //
+ // Add 16-bit count equivalent of record header, time stamp, and
+ // selected items mask. This is the total number of 16 bit words
+ // of the record.
+ //
+ _ui32ItemCount += 6;
+
+ //
+ // Convert the count to bytes, be sure to pad to 32-bit alignment.
+ //
+ _ui32ItemCount = ((_ui32ItemCount * 2) + 3) & ~3;
+
+ //
+ // Create the flash record header, which is a 3-byte signature and a
+ // one byte count of bytes in the record. Save it at the beginning
+ // of the write buffer.
+ //
+ ui32Idx = MAGIC_NUMBER_OF_FREE_REC_BEG | (_ui32ItemCount & RECORD_LENGTH_MASK);
+ g_pui32RecordBuf[0] = ui32Idx;
+
+ //
+ // Copy the rest of the record to the buffer, and get a pointer to
+ // the buffer.
+ //
+ memcpy(&g_pui32RecordBuf[1], _psRecord, _ui32ItemCount - NUMBER_OF_BYTES_IN_INT);
+ _pui32Record = g_pui32RecordBuf;
+ int32_t result_of_flash_writing = FlashStoreWriteBuffer(_dataType,_pui32Record,_ui32ItemCount);
+ return result_of_flash_writing;
+ return 0;
+ }
+ */
+
+//*****************************************************************************
+//
+// Erase the data storage area of flash.
+//
+//*****************************************************************************
+void FlashStoreErase(FlashDataType_t _dataType)
+{
+ uint32_t ui32Addr;
+
+ //
+ // Inform user we are erasing
+ //
+ // SetStatusText("ERASE\r\n", 0, "ERASING\r\n", 0);
+
+ //
+ // Loop through entire storage area and erase each page.
+ //
+ for(ui32Addr = g_ui32Addresses[_dataType].m_startAddress; ui32Addr < g_ui32Addresses[_dataType].m_endAddress; ui32Addr += FLASH_PAGE_SIZE_IN_BYTES)
+ {
+ FlashErase(ui32Addr);
+ }
+
+ //
+ // Inform user the erase is done.
+ //
+ // SetStatusText("SAVE\r\n", "ERASE ", "COMPLETE\r\n", 0);
+}
+
+//*****************************************************************************
+//
+// Determine if the flash block that contains the address is blank.
+//
+//*****************************************************************************
+static int32_t IsBlockFree(uint32_t _ui32BaseAddr)
+{
+ uint32_t ui32Addr;
+
+ //
+ // Make sure we start at the beginning of a 1K block
+ //
+ _ui32BaseAddr &= ~FLASH_PAGE_BOUNDARY_MASK;
+
+ //
+ // Loop through every address in this block and test if it is blank.
+ //
+ for(ui32Addr = 0; ui32Addr < FLASH_PAGE_SIZE_IN_BYTES; ui32Addr += RECORD_HEADER_SIZE)
+ {
+ if(HWREG(_ui32BaseAddr + ui32Addr) != FORMATED_FLASH_SIGNATURE)
+ {
+ //
+ // Found a non-blank location, so return indication that block
+ // is not free.
+ //
+ return(0);
+ }
+ }
+
+ //
+ // If we made it to here then every location in this block is erased,
+ // so return indication that the block is free.
+ //
+ return(1);
+}
+
+//*****************************************************************************
+//
+// Report to the user the amount of free space and used space in the data
+// storage area.
+//
+//*****************************************************************************
+void FlashStoreReport(FlashDataType_t _dataType)
+{
+ uint32_t ui32Addr, ui32FreeBlocks, ui32UsedBlocks = 0;
+ static char p_cBufFree[16], p_cBufUsed[16];
+
+ //
+ // Initialize locals.
+ //
+ ui32FreeBlocks = 0;
+ ui32UsedBlocks = 0;
+
+ //
+ // Loop through each block of the storage area and count how many blocks
+ // are free and non-free.
+ //
+ for(ui32Addr = g_ui32Addresses[_dataType].m_startAddress; ui32Addr < g_ui32Addresses[_dataType].m_endAddress; ui32Addr += FLASH_PAGE_SIZE_IN_BYTES)
+ {
+ if(IsBlockFree(ui32Addr))
+ {
+ ui32FreeBlocks++;
+ }
+ else
+ {
+ ui32UsedBlocks++;
+ }
+ }
+
+ //
+ // Report the result to the user via a status display screen.
+ //
+ usnprintf(p_cBufFree, sizeof(p_cBufFree), "FREE: %3uK", ui32FreeBlocks);
+ usnprintf(p_cBufUsed, sizeof(p_cBufUsed), "USED: %3uK", ui32UsedBlocks);
+ //SetStatusText("FREE FLASH\r\n", p_cBufFree, p_cBufUsed, "\r\n");
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.h b/Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.h
new file mode 100644
index 000000000..31018b9cf
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/On_Chip_Flash/Flashstore.h
@@ -0,0 +1,136 @@
+//*****************************************************************************
+//
+// Flashstore.h - Prototypes and definitions for flash storage module.
+// this module is responsible for all memory interfacess in the system
+// each storage type can be defined here and to be accessed from this interface.
+// This module manages the storage of data logger of sampeled data and configuration
+// into on chip flash memory.
+//*****************************************************************************
+
+#ifndef DRIVERS_FLASHSTORE_H_
+#define DRIVERS_FLASHSTORE_H_
+
+
+//*****************************************************************************
+//
+// If building with a C++ compiler, make all of the definitions in this header
+// have a C binding.
+//
+//*****************************************************************************
+#ifdef __cplusplus
+extern "C"
+{
+#endif
+
+
+//memory sections currently defined for storage on internal flash
+#define FLASH_STORE_START_ADDR 0x20000
+#define FLASH_STORE_END_ADDR 0x40000
+
+#define FLASH_CONFIG_START_ADDR 0x40000
+#define FLASH_CONFIG_END_ADDR 0x50000
+
+#define MAGIC_NUMBER_OF_FREE_REC_BEG 0x53554100
+#define CRC_SEED_MASK 0xFFFFFF00 //used as crc seed and masking number for searching in flash records
+#define RECORD_LENGTH_MASK 0xFF
+#define FLASH_PAGE_BOUNDARY_MASK 0x3FF //beyond this mask begins new paging each page is of 1k - 0x3ff is the last addres
+#define FLASH_PAGE_SIZE_IN_BYTES 0x400
+#define NUMBER_OF_BYTES_IN_INT 4
+
+#define RECORD_HEADER_SIZE 4
+#define FORMATED_FLASH_SIGNATURE 0xFFFFFFFF
+
+typedef enum
+{
+ ADCData = 0,
+ ConfigData,
+ NumOfDataTypes
+} FlashDataType_t;
+
+//*****************************************************************************
+//
+// Module function prototypes.
+//
+//*****************************************************************************
+void FlashStoreInit(void);
+
+//*****************************************************************************
+//
+// This is called at the start of logging to prepare space in flash for
+// storage of logged data. It searches for the first blank area in the
+// flash storage to be used for storing records.
+//
+// If a starting address is specified then the search is skipped and it goes
+// directly to the new address. If the starting address is 0, then it performs
+// the search.
+//
+//*****************************************************************************
+int32_t FlashStoreOpenLogFile(FlashDataType_t _dataType,uint32_t _ui32StartAddr);
+
+//*****************************************************************************
+// function used to write into internal flash specific buffer
+//*****************************************************************************
+int32_t FlashStoreWriteBuffer(FlashDataType_t _dataType,uint32_t* _pui32Record,uint32_t _ui32ItemCount);
+
+//*****************************************************************************
+//
+// This is called each time there is a new data record to log to the flash
+// storage area. A simple algorithm is used which rotates programming
+// data log records through an area of flash. It is assumed that the current
+// page is blank. Records are stored on the current page until a page
+// boundary is crossed. If the page boundary is crossed and the new page
+// is not blank (testing only the first location), then the new page is
+// erased. Finally the entire record is programmed into flash and the
+// storage pointers are updated.
+//
+// While storing and when crossing to a new page, if the flash page is not
+// blank it is erased. So this algorithm overwrites old data.
+//
+// The data is stored in flash as a record, with a flash header prepended,
+// and with the record length padded to be a multiple of 4 bytes. The flash
+// header is a 3-byte magic number and one byte of record length.
+//
+//*****************************************************************************
+//int32_t FlashStoreWriteRecord(FlashDataType_t _dataType,tLogRecord *_psRecord);
+
+//*****************************************************************************
+//
+// Saves data records that are stored in the flash to an externally connected
+// USB memory storage device (USB stick).
+// The flash memory is scanned for the presence of store data records. When
+// records are found they are written in CSV format to the USB stick. This
+// function assumes a non-corrupted storage area, and that any records, once
+// found, are contiguous with all stored records. It will find the oldest
+// record and start with that when storing.
+//
+//*****************************************************************************
+int32_t FlashStoreSave(FlashDataType_t _dataType);
+
+//*****************************************************************************
+//
+// Erase the data storage area of flash.
+//
+//*****************************************************************************
+void FlashStoreErase(FlashDataType_t _dataType);
+
+
+void FlashStoreReport(FlashDataType_t _dataType);
+
+void FlashSendEndReq(FlashDataType_t _dataType);
+//*****************************************************************************
+//
+// Mark the end of the C bindings section for C++ compilers.
+//
+//*****************************************************************************
+#ifdef __cplusplus
+}
+#endif
+
+
+
+
+
+
+
+
+#endif /* DRIVERS_FLASHSTORE_H_ */
diff --git a/Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.c b/Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.c
new file mode 100644
index 000000000..158dd2e14
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.c
@@ -0,0 +1,130 @@
+
+#include <stdbool.h>
+#include <ti/sysbios/BIOS.h>
+#include <driverlib/rom.h>
+#include <inc/hw_memmap.h>
+#include "Drivers/Peripheral_GPIO/GPIO.h"
+
+//#define MAX_NUM_OF_REGISTRED_CALLBACKS 9 // screw,6 dispensers , 2 sw - start manual/stop manual
+#define MAX_NUM_OF_REGISTRED_CALLBACKS 7 // screw,6 dispensers , 2 sw - start manual/stop manual
+
+typedef struct
+{
+ uint32_t m_port;
+ uint32_t m_pin;
+} GPIOIntPortMap;
+
+static GPIOIntPortMap portMap[NUM_OF_GPIO_INT] =
+{
+ {GPIO_PORTG_BASE, GPIO_INT_PIN_0}, // Dispenser LSW 1
+ {GPIO_PORTG_BASE, GPIO_INT_PIN_1}, // Dispenser LSW 2
+ {GPIO_PORTP_BASE, GPIO_INT_PIN_4}, // Dispenser LSW 3
+ {GPIO_PORTP_BASE, GPIO_INT_PIN_5}, // Dispenser LSW 4
+ {GPIO_PORTQ_BASE, GPIO_INT_PIN_7}, // Dispenser LSW 5
+ {GPIO_PORTS_BASE, GPIO_INT_PIN_0}, // Dispenser LSW 6
+ {GPIO_PORTS_BASE, GPIO_INT_PIN_3}, // Screw LSW
+ {GPIO_PORTD_BASE, GPIO_INT_PIN_1}, // Start Manual Btn
+ {GPIO_PORTJ_BASE, GPIO_INT_PIN_3}, // End Manual Btn
+ {GPIO_PORTE_BASE, GPIO_INT_PIN_4}, //
+ {GPIO_PORTH_BASE, GPIO_INT_PIN_5}, //
+ {GPIO_PORTP_BASE, GPIO_INT_PIN_0}, //
+ {GPIO_PORTQ_BASE, GPIO_INT_PIN_5}, //
+};
+
+typedef struct
+{
+ bool m_isEnabled;
+ GPIOInt_t m_param;
+ GPIOIntCallback m_callback;
+}PortConfig_t;
+
+static PortConfig_t gpio_configuration[MAX_NUM_OF_REGISTRED_CALLBACKS];
+
+bool PollGPIO (uint8_t index)
+{
+ unsigned long ulStatus = ROM_GPIOPinRead(portMap[index].m_port, portMap[index].m_pin);
+ if ( ulStatus)
+ {
+ return true;
+ }
+ return false;
+}
+//********************************************************************************************************************
+//genneral interrupt handler for all GPIO's
+//********************************************************************************************************************
+void IntGPIO(UArg arg0)
+{
+ uint32_t port = (uint32_t)arg0;
+ unsigned long ulStatus = ROM_GPIOIntStatus(port, true);
+
+
+ uint8_t index;
+ for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index)
+ {
+ GPIOInt_t gpioInt = gpio_configuration[index].m_param;
+ if (gpio_configuration[index].m_isEnabled && (portMap[gpioInt].m_port == port) && (portMap[gpioInt].m_pin & ulStatus))
+ {
+ gpio_configuration[index].m_callback(gpio_configuration[index].m_param);
+ }
+ }
+ //
+ // Clear all the pin interrupts that are set
+ //
+ ROM_GPIOIntClear(port, ulStatus);
+}
+
+//********************************************************************************************************************
+void GPIOInit(void)
+{
+ uint8_t index;
+ for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index)
+ {
+ gpio_configuration[index].m_isEnabled = false;
+ }
+}
+
+//********************************************************************************************************************
+void GPIOEnableInterrupt(GPIOInt_t gpioInt, GPIOIntCallback callBack, uint32_t type)
+{
+ uint8_t index;
+ for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index)
+ {
+ if (!gpio_configuration[index].m_isEnabled)
+ {
+ gpio_configuration[index].m_isEnabled = true;
+ gpio_configuration[index].m_param = gpioInt;
+ gpio_configuration[index].m_callback = callBack;
+ ROM_GPIOIntTypeSet(portMap[gpioInt].m_port,portMap[gpioInt].m_pin, type);
+ ROM_GPIOIntClear(portMap[gpioInt].m_port,portMap[gpioInt].m_pin);
+ ROM_GPIOIntEnable(portMap[gpioInt].m_port,portMap[gpioInt].m_pin);
+ return;
+ }
+ else
+ {
+ if ((gpio_configuration[index].m_param == gpioInt) &&
+ (gpio_configuration[index].m_callback == callBack))
+ {
+ return;
+ }
+ }
+ }
+}
+
+//********************************************************************************************************************
+
+void GPIODisableInterrupt(GPIOInt_t gpioInt,GPIOIntCallback callBack)
+{
+ uint8_t index;
+ for (index = 0; index < MAX_NUM_OF_REGISTRED_CALLBACKS; ++index)
+ {
+ if (gpio_configuration[index].m_isEnabled &&
+ (gpio_configuration[index].m_param == gpioInt) &&
+ (gpio_configuration[index].m_callback == callBack))
+ {
+ ROM_GPIOIntDisable(portMap[gpioInt].m_port,portMap[gpioInt].m_pin);
+ ROM_GPIOIntClear(portMap[gpioInt].m_port,portMap[gpioInt].m_pin);
+ gpio_configuration[index].m_isEnabled = false;
+ return;
+ }
+ }
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.h b/Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.h
new file mode 100644
index 000000000..8a0c54df4
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/Peripheral_GPIO/GPIO.h
@@ -0,0 +1,37 @@
+
+#ifndef DRIVERS_GPIO_H_
+#define DRIVERS_GPIO_H_
+
+#include <stdint.h>
+#include <stdbool.h>
+#include <driverlib/gpio.h>
+
+typedef enum
+{
+ DISPENSER_1_LMS,
+ DISPENSER_2_LMS,
+ DISPENSER_3_LMS,
+ DISPENSER_4_LMS,
+ DISPENSER_5_LMS,
+ DISPENSER_6_LMS,
+ SCREW_LMS,
+ START_MANUAL_BTN,
+ END_MANUAL_BTN,
+ MANUAL_1_BTN,
+ MANUAL_2_BTN,
+ MANUAL_3_BTN,
+ MANUAL_4_BTN,
+ NUM_OF_GPIO_INT
+}GPIOInt_t;
+
+typedef void (*GPIOIntCallback)(GPIOInt_t arg);
+
+void GPIOInit(void);
+
+bool PollGPIO (uint8_t index);
+
+void GPIOEnableInterrupt(GPIOInt_t gpioInt, GPIOIntCallback callBack, uint32_t type);
+
+void GPIODisableInterrupt(GPIOInt_t gpioInt,GPIOIntCallback callBack);
+
+#endif /* DRIVERS_GPIO_H_ */
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.ccsproject b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.ccsproject
new file mode 100644
index 000000000..d132942b2
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.ccsproject
@@ -0,0 +1,13 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?ccsproject version="1.0"?>
+<projectOptions>
+ <ccsVersion value="7.2.0"/>
+ <deviceVariant value="Cortex M.TM4C129XNCZAD"/>
+ <deviceFamily value="TMS470"/>
+ <deviceEndianness value="little"/>
+ <codegenToolVersion value="16.3.0.STS"/>
+ <isElfFormat value="true"/>
+ <createSlaveProjects value=""/>
+ <templateProperties value="id=com.ti.common.project.core.emptyProjectTemplate,"/>
+ <filesToOpen value=""/>
+</projectOptions>
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.cproject b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.cproject
new file mode 100644
index 000000000..670f72289
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.cproject
@@ -0,0 +1,141 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.570777470">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.570777470" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="lib" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.570777470" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug">
+ <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.570777470." name="/" resourcePath="">
+ <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.libraryDebugToolchain.2032570844" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.libraryDebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug.2089916128">
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.471837303" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+ <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C129XNCZAD"/>
+ <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
+ <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>
+ <listOptionValue builtIn="false" value="OUTPUT_TYPE=staticLibrary"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.14452932" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.3.0.STS" valueType="string"/>
+ <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformDebug.2077799957" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformDebug"/>
+ <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderDebug.1862617755" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderDebug"/>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerDebug.965069148" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerDebug">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.1420295243" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.1973394165" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.1571358636" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.eabi" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.1058631933" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC.1533299340" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE.1304341340" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="ccs=&quot;ccs&quot;"/>
+ <listOptionValue builtIn="false" value="PART_TM4C129XNCZAD"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL.1401917836" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING.1812174325" name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING" useByScannerDiscovery="false" valueType="stringList">
+ <listOptionValue builtIn="false" value="225"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER.1748110206" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.515905302" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH.2081262530" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/grlib}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SW_ROOT}/examples/boards/dk-tm4c129x&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SW_ROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN.312422354" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS.77324950" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS.679207486" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS.61011931" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS.804002552" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS"/>
+ </tool>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug.2089916128" name="ARM Archiver" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE.1663408519" name="Output file" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE" useByScannerDiscovery="false" value="&quot;${ProjName}.lib&quot;" valueType="string"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2011248728">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2011248728" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="lib" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2011248728" name="Release" parent="com.ti.ccstudio.buildDefinitions.TMS470.Release">
+ <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.2011248728." name="/" resourcePath="">
+ <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.ReleaseToolchain.270241411" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianRelease.226377319">
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.658988475" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+ <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C129XNCZAD"/>
+ <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
+ <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>
+ <listOptionValue builtIn="false" value="OUTPUT_TYPE=staticLibrary"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1941138829" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.3.0.STS" valueType="string"/>
+ <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformRelease.573647717" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformRelease"/>
+ <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderRelease.1944619168" name="GNU Make.Release" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderRelease"/>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerRelease.494478037" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerRelease">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.48552291" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.1313168309" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.438530402" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.eabi" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.1147145429" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC.1045197456" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE.1608793976" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="ccs=&quot;ccs&quot;"/>
+ <listOptionValue builtIn="false" value="PART_TM4C129XNCZAD"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING.547667799" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING" useByScannerDiscovery="false" valueType="stringList">
+ <listOptionValue builtIn="false" value="225"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER.422231554" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.266800110" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH.861179576" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN.1730997241" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS.2059150249" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS.171152981" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS.546362320" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS.558515027" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS"/>
+ </tool>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianRelease.226377319" name="ARM Archiver" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianRelease">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE.2104237110" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE" useByScannerDiscovery="false" value="&quot;${ProjName}.lib&quot;" valueType="string"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="twine_graphicslib.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.504498469" name="ARM" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration"/>
+ <storageModule moduleId="org.eclipse.cdt.core.language.mapping">
+ <project-mappings>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
+ </project-mappings>
+ </storageModule>
+</cproject>
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.project b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.project
new file mode 100644
index 000000000..8736c1f5b
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.project
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>twine_graphicslib</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.ti.ccstudio.core.ccsNature</nature>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>drivers/frame.c</name>
+ <type>1</type>
+ <locationURI>SW_ROOT/examples/boards/dk-tm4c129x/drivers/frame.c</locationURI>
+ </link>
+ <link>
+ <name>drivers/kentec320x240x16_ssd2119.c</name>
+ <type>1</type>
+ <locationURI>SW_ROOT/examples/boards/dk-tm4c129x/drivers/kentec320x240x16_ssd2119.c</locationURI>
+ </link>
+ </linkedResources>
+ <variableList>
+ <variable>
+ <name>SW_ROOT</name>
+ <value>$%7BTI_PRODUCTS_DIR%7D/TivaWare_C_Series-2.1.4.178</value>
+ </variable>
+ </variableList>
+</projectDescription>
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.codan.core.prefs b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 000000000..f653028c5
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.debug.core.prefs b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 000000000..2adc7b1dd
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.cdt.debug.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.core.resources.prefs b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..3774f8b3e
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+encoding//Debug/drivers/subdir_rules.mk=UTF-8
+encoding//Debug/drivers/subdir_vars.mk=UTF-8
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.c b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.c
new file mode 100644
index 000000000..dde30df95
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.c
@@ -0,0 +1,109 @@
+/*
+ * graphics_adapter.c
+ *
+ * Created on: Sep 24, 2017
+ * Author: Roy
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <string.h>
+#include "graphics_adapter.h"
+#include "grlib/grlib.h"
+//#include "drivers/frame.h"
+//#include "drivers/kentec320x240x16_ssd2119.h"
+
+#define LINE_HEIGHT 12
+#define MAX_POSITION 240
+int current_position = 0;
+char current_line[100];
+
+void init_graphics(uint32_t ui32SysClock)
+{
+#ifdef USE_GRAPHICS
+ // Initialize the display driver.
+ Kentec320x240x16_SSD2119Init(ui32SysClock);
+
+ // Initialize the graphics context.
+ GrContextInit(&g_sContext, &g_sKentec320x240x16_SSD2119);
+
+ clear();
+
+#endif
+}
+
+void draw_image(uint8_t* data)
+{
+#ifdef USE_GRAPHICS
+ GrImageDraw(&g_sContext, data, 0, 0);
+#endif
+}
+
+void draw_string(char* data, size_t length)
+{
+#ifdef USE_GRAPHICS
+ tRectangle backRect;
+ backRect.i16XMin = 100;
+ backRect.i16XMax = 300;
+ backRect.i16YMin = 100;
+ backRect.i16YMax = 80;
+
+ GrContextForegroundSet(&g_sContext, ClrBlack);
+ GrRectFill(&g_sContext, &backRect);
+
+
+ GrStringDraw(&g_sContext, data, length, 0, 0, true);
+#endif
+}
+
+void writeLine(char* text)
+{
+#ifdef USE_GRAPHICS
+ if (current_position >= MAX_POSITION)
+ {
+ clear();
+ }
+
+ strcpy(current_line, text);
+ GrStringDraw(&g_sContext, current_line, strlen(current_line), 0, current_position, true);
+ current_position += LINE_HEIGHT;
+#endif
+}
+
+void writeFloat(float num)
+{
+#ifdef USE_GRAPHICS
+ char num_buf[10];
+ ltoa(num, num_buf);
+ strcat(current_line, num_buf);
+ GrStringDraw(&g_sContext, current_line, strlen(current_line), 0, current_position - LINE_HEIGHT, true);
+#endif
+}
+
+void writeString(char* text)
+{
+#ifdef USE_GRAPHICS
+ strcat(current_line,text);
+ GrStringDraw(&g_sContext, current_line, strlen(current_line), 0, current_position - LINE_HEIGHT, true);
+#endif
+}
+
+void clear()
+{
+#ifdef USE_GRAPHICS
+ tRectangle backRect;
+ backRect.i16XMin = 0;
+ backRect.i16XMax = 340;
+ backRect.i16YMin = 240;
+ backRect.i16YMax = 0;
+
+ GrContextForegroundSet(&g_sContext, ClrBlack);
+ GrRectFill(&g_sContext, &backRect);
+
+ GrContextFontSet(&g_sContext, TEXT_FONT);
+ GrContextForegroundSet(&g_sContext, ClrWhite);
+
+ current_position = 0;
+#endif
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.h b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.h
new file mode 100644
index 000000000..3242f9068
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_graphicslib/graphics_adapter.h
@@ -0,0 +1,32 @@
+/*
+ * graphics_adapter.h
+ *
+ * Created on: Sep 24, 2017
+ * Author: Roy
+ */
+
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include "grlib/grlib.h"
+//#include "drivers/frame.h"
+//#include "drivers/kentec320x240x16_ssd2119.h"
+
+//*****************************************************************************
+//
+// Graphics context used to show text on the color STN display.
+//
+//*****************************************************************************
+static tContext g_sContext;
+#define TEXT_FONT g_psFontCmss12
+#define TEXT_HEIGHT (GrFontHeightGet(TEXT_FONT))
+#define BUFFER_METER_HEIGHT TEXT_HEIGHT
+#define BUFFER_METER_WIDTH 150
+
+void init_graphics(uint32_t ui32SysClock);
+void draw_image(uint8_t* data);
+void draw_string(char* data, size_t length);
+void writeLine(char* text);
+void writeFloat(float num);
+void writeString(char* text);
+void clear();
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.ccsproject b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.ccsproject
new file mode 100644
index 000000000..83cc5ba74
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.ccsproject
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<?ccsproject version="1.0"?>
+<projectOptions>
+ <ccsVersion value="7.2.0"/>
+ <deviceVariant value="Cortex M.TM4C129XNCZAD"/>
+ <deviceFamily value="TMS470"/>
+ <deviceEndianness value="little"/>
+ <codegenToolVersion value="16.9.4.LTS"/>
+ <isElfFormat value="true"/>
+ <createSlaveProjects value=""/>
+ <templateProperties value="id=com.ti.common.project.core.emptyProjectTemplate,"/>
+ <filesToOpen value=""/>
+ <isTargetManual value="false"/>
+</projectOptions>
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.cproject b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.cproject
new file mode 100644
index 000000000..5c4201208
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.cproject
@@ -0,0 +1,147 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<?fileVersion 4.0.0?><cproject storage_type_id="org.eclipse.cdt.core.XmlProjectDescriptionStorage">
+ <storageModule configRelations="2" moduleId="org.eclipse.cdt.core.settings">
+ <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256" moduleId="org.eclipse.cdt.core.settings" name="Debug">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="lib" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256" name="Debug" parent="com.ti.ccstudio.buildDefinitions.TMS470.Debug">
+ <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Debug.1712794256." name="/" resourcePath="">
+ <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.libraryDebugToolchain.1857799670" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.libraryDebugToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug.933538578">
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.862048202" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+ <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C129XNCZAD"/>
+ <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
+ <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>
+ <listOptionValue builtIn="false" value="OUTPUT_TYPE=staticLibrary"/>
+ <listOptionValue builtIn="false" value="PRODUCTS="/>
+ <listOptionValue builtIn="false" value="PRODUCT_MACRO_IMPORTS={}"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.1818576343" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.3.0.STS" valueType="string"/>
+ <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformDebug.1280873394" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.targetPlatformDebug"/>
+ <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderDebug.1884472642" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.builderDebug"/>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerDebug.59496260" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.compilerDebug">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.1260871296" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.1373156313" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.CODE_STATE.16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.670678401" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.ABI.eabi" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.49785414" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC.171601804" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.GCC" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE.1580654289" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEFINE" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="ccs=&quot;ccs&quot;"/>
+ <listOptionValue builtIn="false" value="PART_TM4C129XNCZAD"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN.1354247189" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.LITTLE_ENDIAN" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH.1422314574" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.INCLUDE_PATH" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${SW_ROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${workspace_loc:/${ProjName}}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;C:\ti\xdctools_3_32_00_06_core\packages&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;C:\ti\tirtos_tivac_2_16_00_08\products\bios_6_45_01_29\packages&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${SW_ROOT}/examples/boards/dk-tm4c129x&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL.701920381" name="Debugging model" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DEBUGGING_MODEL.SYMDEBUG__DWARF" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING.18973611" name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WARNING" valueType="stringList">
+ <listOptionValue builtIn="false" value="225"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.651875503" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP" value="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER.2072182850" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compilerID.DISPLAY_ERROR_NUMBER" value="true" valueType="boolean"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS.62354248" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__C_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS.72641058" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__CPP_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS.533685650" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS.1840927405" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.compiler.inputType__ASM2_SRCS"/>
+ </tool>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug.933538578" name="ARM Archiver" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.library.librarianDebug">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE.1915375055" name="Output file" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.3.archiverID.OUTPUT_FILE" value="&quot;${ProjName}.lib&quot;" valueType="string"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ <sourceEntries>
+ <entry excluding="tm4c129xnczad.cmd" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
+ </sourceEntries>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ <cconfiguration id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617">
+ <storageModule buildSystemId="org.eclipse.cdt.managedbuilder.core.configurationDataProvider" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617" moduleId="org.eclipse.cdt.core.settings" name="Release">
+ <externalSettings/>
+ <extensions>
+ <extension id="com.ti.ccstudio.binaryparser.CoffParser" point="org.eclipse.cdt.core.BinaryParser"/>
+ <extension id="org.eclipse.cdt.core.GmakeErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.CoffErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.AsmErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ <extension id="com.ti.ccstudio.errorparser.LinkErrorParser" point="org.eclipse.cdt.core.ErrorParser"/>
+ </extensions>
+ </storageModule>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <configuration artifactExtension="lib" artifactName="${ProjName}" buildProperties="" cleanCommand="${CG_CLEAN_CMD}" description="" id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617" name="Release" parent="com.ti.ccstudio.buildDefinitions.TMS470.Release">
+ <folderInfo id="com.ti.ccstudio.buildDefinitions.TMS470.Release.935848617." name="/" resourcePath="">
+ <toolChain id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.ReleaseToolchain.1043243615" name="TI Build Tools" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.ReleaseToolchain" targetTool="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.librarianRelease.1688188836">
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS.1577349600" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_TAGS" valueType="stringList">
+ <listOptionValue builtIn="false" value="DEVICE_CONFIGURATION_ID=Cortex M.TM4C129XNCZAD"/>
+ <listOptionValue builtIn="false" value="DEVICE_ENDIANNESS=little"/>
+ <listOptionValue builtIn="false" value="OUTPUT_FORMAT=ELF"/>
+ <listOptionValue builtIn="false" value="CCS_MBS_VERSION=6.1.3"/>
+ <listOptionValue builtIn="false" value="OUTPUT_TYPE=staticLibrary"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION.729704881" name="Compiler version" superClass="com.ti.ccstudio.buildDefinitions.core.OPT_CODEGEN_VERSION" value="16.9.4.LTS" valueType="string"/>
+ <targetPlatform id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.targetPlatformRelease.13362800" name="Platform" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.targetPlatformRelease"/>
+ <builder buildPath="${BuildDirectory}" id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.builderRelease.595631804" keepEnvironmentInBuildfile="false" name="GNU Make" parallelBuildOn="true" parallelizationNumber="optimal" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.builderRelease"/>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.compilerRelease.749049297" name="ARM Compiler" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.compilerRelease">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION.2061789795" name="Target processor version (--silicon_version, -mv)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.SILICON_VERSION.7M4" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE.207874384" name="Designate code state, 16-bit (thumb) or 32-bit (--code_state)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.CODE_STATE.16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI.1005861488" name="Application binary interface. (--abi)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.ABI.eabi" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT.1412660008" name="Specify floating point support (--float_support)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.FLOAT_SUPPORT.FPv4SPD16" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.GCC.1794322910" name="Enable support for GCC extensions (DEPRECATED) (--gcc)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.GCC" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEFINE.1410522242" name="Pre-define NAME (--define, -D)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DEFINE" valueType="definedSymbols">
+ <listOptionValue builtIn="false" value="ccs=&quot;ccs&quot;"/>
+ <listOptionValue builtIn="false" value="PART_TM4C129XNCZAD"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING.993080532" name="Treat diagnostic &lt;id&gt; as warning (--diag_warning, -pdsw)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WARNING" useByScannerDiscovery="false" valueType="stringList">
+ <listOptionValue builtIn="false" value="225"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER.974177188" name="Emit diagnostic identifier numbers (--display_error_number, -pden)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DISPLAY_ERROR_NUMBER" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.1454860188" name="Wrap diagnostic messages (--diag_wrap)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP" useByScannerDiscovery="false" value="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.DIAG_WRAP.off" valueType="enumerated"/>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH.1916299080" name="Add dir to #include search path (--include_path, -I)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.INCLUDE_PATH" valueType="includePath">
+ <listOptionValue builtIn="false" value="&quot;${PROJECT_ROOT}&quot;"/>
+ <listOptionValue builtIn="false" value="&quot;${CG_TOOL_ROOT}/include&quot;"/>
+ </option>
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN.1995683267" name="Little endian code [See 'General' page to edit] (--little_endian, -me)" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compilerID.LITTLE_ENDIAN" useByScannerDiscovery="false" value="true" valueType="boolean"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS.1325065408" name="C Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__C_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__CPP_SRCS.1367371847" name="C++ Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__CPP_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM_SRCS.3623981" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM_SRCS"/>
+ <inputType id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM2_SRCS.638130892" name="Assembly Sources" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.compiler.inputType__ASM2_SRCS"/>
+ </tool>
+ <tool id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.librarianRelease.1688188836" name="ARM Archiver" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.library.librarianRelease">
+ <option id="com.ti.ccstudio.buildDefinitions.TMS470_16.9.archiverID.OUTPUT_FILE.668849754" name="Output file" superClass="com.ti.ccstudio.buildDefinitions.TMS470_16.9.archiverID.OUTPUT_FILE" useByScannerDiscovery="false" value="&quot;${ProjName}.lib&quot;" valueType="string"/>
+ </tool>
+ </toolChain>
+ </folderInfo>
+ </configuration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.externalSettings"/>
+ </cconfiguration>
+ </storageModule>
+ <storageModule moduleId="org.eclipse.cdt.core.LanguageSettingsProviders"/>
+ <storageModule moduleId="cdtBuildSystem" version="4.0.0">
+ <project id="twine_usblib.com.ti.ccstudio.buildDefinitions.TMS470.ProjectType.457322155" name="ARM" projectType="com.ti.ccstudio.buildDefinitions.TMS470.ProjectType"/>
+ </storageModule>
+ <storageModule moduleId="scannerConfiguration"/>
+ <storageModule moduleId="org.eclipse.cdt.core.language.mapping">
+ <project-mappings>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.asmSource" language="com.ti.ccstudio.core.TIASMLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cHeader" language="com.ti.ccstudio.core.TIGCCLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cSource" language="com.ti.ccstudio.core.TIGCCLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxHeader" language="com.ti.ccstudio.core.TIGPPLanguage"/>
+ <content-type-mapping configuration="" content-type="org.eclipse.cdt.core.cxxSource" language="com.ti.ccstudio.core.TIGPPLanguage"/>
+ </project-mappings>
+ </storageModule>
+</cproject>
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.project b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.project
new file mode 100644
index 000000000..3d83dab3e
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.project
@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>twine_usblib</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ <buildCommand>
+ <name>org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder</name>
+ <triggers>full,incremental,</triggers>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>com.ti.ccstudio.core.ccsNature</nature>
+ <nature>org.eclipse.cdt.core.cnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.managedBuildNature</nature>
+ <nature>org.eclipse.cdt.core.ccnature</nature>
+ <nature>org.eclipse.cdt.managedbuilder.core.ScannerConfigNature</nature>
+ </natures>
+ <linkedResources>
+ <link>
+ <name>utils/ustdlib.c</name>
+ <type>1</type>
+ <locationURI>SW_ROOT/utils/ustdlib.c</locationURI>
+ </link>
+ </linkedResources>
+ <variableList>
+ <variable>
+ <name>SW_ROOT</name>
+ <value>$%7BTI_PRODUCTS_DIR%7D/TivaWare_C_Series-2.1.4.178</value>
+ </variable>
+ </variableList>
+</projectDescription>
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.codan.core.prefs b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 000000000..f653028c5
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.debug.core.prefs b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 000000000..2adc7b1dd
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.cdt.debug.core.prefs
@@ -0,0 +1,2 @@
+eclipse.preferences.version=1
+org.eclipse.cdt.debug.core.toggleBreakpointModel=com.ti.ccstudio.debug.CCSBreakpointMarker
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.core.resources.prefs b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 000000000..67f3dce24
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,8 @@
+eclipse.preferences.version=1
+encoding//Debug/makefile=UTF-8
+encoding//Debug/objects.mk=UTF-8
+encoding//Debug/sources.mk=UTF-8
+encoding//Debug/subdir_rules.mk=UTF-8
+encoding//Debug/subdir_vars.mk=UTF-8
+encoding//Debug/utils/subdir_rules.mk=UTF-8
+encoding//Debug/utils/subdir_vars.mk=UTF-8
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.c b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.c
new file mode 100644
index 000000000..7869cf947
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.c
@@ -0,0 +1,542 @@
+//Twine USB Serial Communication Library
+
+//! Assuming you installed TivaWare in the default directory, a
+//! driver information (INF) file for use with Windows XP, Windows Vista and
+//! Windows7 can be found in C:/ti/TivaWare-for-C-Series/windows_drivers.
+//! For Windows 2000, the required INF file is in
+//! C:/ti/TivaWare-for-C-Series/windows_drivers/win2K.
+
+#include "include.h"
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include <ti/sysbios/hal/Hwi.h>
+#include <xdc/std.h>
+#include <xdc/runtime/Error.h>
+
+
+#include "inc/hw_ints.h"
+#include "inc/hw_memmap.h"
+#include "inc/hw_types.h"
+#include "inc/hw_uart.h"
+#include "driverlib/debug.h"
+#include "driverlib/gpio.h"
+#include "driverlib/interrupt.h"
+#include "driverlib/sysctl.h"
+
+#include "driverlib/systick.h"
+#include "driverlib/timer.h"
+#include "driverlib/uart.h"
+#include "driverlib/usb.h"
+#include "driverlib/rom.h"
+#include "driverlib/rom_map.h"
+#include "usblib/usblib.h"
+#include "usblib/usbcdc.h"
+#include "usblib/usb-ids.h"
+#include "usblib/device/usbdevice.h"
+#include "usblib/device/usbdcdc.h"
+#include <ti/sysbios/knl/Task.h>
+#include "utils/ustdlib.h"
+#include "usb_serial_structs.h"
+#include "usb_serial_buffer.h"
+#include "usb_serial_adapter.h"
+
+static SerialBuffer inBuffer;
+static int expected_message_size;
+static int current_message_size;
+
+//*****************************************************************************
+//
+// This function is called whenever serial data is received from the UART.
+// It is passed the accumulated error flags from each character received in
+// this interrupt and determines from them whether or not an interrupt
+// notification to the host is required.
+//
+// If a notification is required and the control interrupt endpoint is idle,
+// we send the notification immediately. If the endpoint is not idle, we
+// accumulate the errors in a global variable which will be checked on
+// completion of the previous notification and used to send a second one
+// if necessary.
+//
+//*****************************************************************************
+void CheckForSerialStateChange(const tUSBDCDCDevice *psDevice, uint32_t ui32Errors)
+{
+ uint16_t ui16SerialState;
+
+ //
+ // Clear our USB serial state. Since we are faking the handshakes, always
+ // set the TXCARRIER (DSR) and RXCARRIER (DCD) bits.
+ //
+ ui16SerialState = USB_CDC_SERIAL_STATE_TXCARRIER |
+ USB_CDC_SERIAL_STATE_RXCARRIER;
+
+ //
+ // Are any error bits set?
+ //
+ if(ui32Errors)
+ {
+ //
+ // At least one error is being notified so translate from our hardware
+ // error bits into the correct state markers for the USB notification.
+ //
+ if(ui32Errors & UART_DR_OE)
+ {
+ ui16SerialState |= USB_CDC_SERIAL_STATE_OVERRUN;
+ }
+
+ if(ui32Errors & UART_DR_PE)
+ {
+ ui16SerialState |= USB_CDC_SERIAL_STATE_PARITY;
+ }
+
+ if(ui32Errors & UART_DR_FE)
+ {
+ ui16SerialState |= USB_CDC_SERIAL_STATE_FRAMING;
+ }
+
+ if(ui32Errors & UART_DR_BE)
+ {
+ ui16SerialState |= USB_CDC_SERIAL_STATE_BREAK;
+ }
+
+ //
+ // Call the CDC driver to notify the state change.
+ //
+ USBDCDCSerialStateChange((void *)psDevice, ui16SerialState);
+ }
+}
+
+//*****************************************************************************
+//
+// Set the state of the RS232 RTS and DTR signals.
+//
+//*****************************************************************************
+void SetControlLineState(uint16_t ui16State)
+{
+ //
+ // TODO: If configured with GPIOs controlling the handshake lines,
+ // set them appropriately depending upon the flags passed in the wValue
+ // field of the request structure passed.
+ //
+}
+
+//*****************************************************************************
+//
+// Get the communication parameters in use on the UART.
+//
+//*****************************************************************************
+void GetLineCoding(tLineCoding *psLineCoding)
+{
+ psLineCoding->ui32Rate = 9600;
+ psLineCoding->ui8Databits = 8;
+ psLineCoding->ui8Parity = USB_CDC_PARITY_NONE;
+ psLineCoding->ui8Stop = USB_CDC_STOP_BITS_1;
+}
+
+//*****************************************************************************
+//
+// Handles CDC driver notifications related to control and setup of the device.
+//
+// \param pvCBData is the client-supplied callback pointer for this channel.
+// \param ulEvent identifies the event we are being notified about.
+// \param ulMsgValue is an event-specific value.
+// \param pvMsgData is an event-specific pointer.
+//
+// This function is called by the CDC driver to perform control-related
+// operations on behalf of the USB host. These functions include setting
+// and querying the serial communication parameters, setting handshake line
+// states and sending break conditions.
+//
+// \return The return value is event-specific.
+//
+//*****************************************************************************
+uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, void *pvMsgData)
+{
+ //
+ // Which event are we being asked to process?
+ //
+ switch(ui32Event)
+ {
+ //
+ // We are connected to a host and communication is now possible.
+ //
+ case USB_EVENT_CONNECTED:
+ {
+ //
+ // Now connected and ready for normal operation.
+ //
+ HWREGBITW(&g_ui32Flags, FLAG_USB_CONFIGURED) = 1;
+
+ //
+ // Flush our buffers.
+ //
+ USBBufferFlush(&g_sTxBuffer);
+ USBBufferFlush(&g_sRxBuffer);
+
+ //TODO: Notify connection!
+
+ //
+ // Set the command status update flag.
+ //
+ HWREGBITW(&g_ui32Flags, FLAG_STATUS_UPDATE) = 1;
+
+ break;
+ }
+
+ //
+ // The host has disconnected.
+ //
+ case USB_EVENT_DISCONNECTED:
+ {
+ //
+ // No longer connected.
+ //
+ HWREGBITW(&g_ui32Flags, FLAG_USB_CONFIGURED) = 0;
+
+ //TODO: Notify disconnection!
+
+ //
+ // Set the command status update flag.
+ //
+ HWREGBITW(&g_ui32Flags, FLAG_STATUS_UPDATE) = 1;
+
+ break;
+ }
+
+ //
+ // Return the current serial communication parameters.
+ //
+ case USBD_CDC_EVENT_GET_LINE_CODING:
+ {
+ GetLineCoding(pvMsgData);
+ break;
+ }
+
+ //
+ // Set the current serial communication parameters.
+ //
+ case USBD_CDC_EVENT_SET_LINE_CODING:
+ {
+ GetLineCoding(pvMsgData);
+ break;
+ }
+
+ //
+ // Set the current serial communication parameters.
+ //
+ case USBD_CDC_EVENT_SET_CONTROL_LINE_STATE:
+ {
+ SetControlLineState((uint16_t)ui32MsgValue);
+ break;
+ }
+
+ //
+ // Send a break condition on the serial line.
+ //
+ case USBD_CDC_EVENT_SEND_BREAK:
+ {
+ break;
+ }
+
+ //
+ // Clear the break condition on the serial line.
+ //
+ case USBD_CDC_EVENT_CLEAR_BREAK:
+ {
+ break;
+ }
+
+ //
+ // Ignore SUSPEND and RESUME for now.
+ //
+ case USB_EVENT_SUSPEND:
+ case USB_EVENT_RESUME:
+ {
+ break;
+ }
+
+ //
+ // We don't expect to receive any other events. Ignore any that show
+ // up in a release build or hang in a debug build.
+ //
+ default:
+ {
+#ifdef DEBUG
+ while(1);
+#else
+ break;
+#endif
+ }
+
+ }
+
+ return(0);
+}
+
+//*****************************************************************************
+//
+// Handles CDC driver notifications related to the transmit channel (data to
+// the USB host).
+//
+// \param pvCBData is the client-supplied callback pointer for this channel.
+// \param ui32Event identifies the event we are being notified about.
+// \param ui32MsgValue is an event-specific value.
+// \param pvMsgData is an event-specific pointer.
+//
+// This function is called by the CDC driver to notify us of any events
+// related to operation of the transmit data channel (the IN channel carrying
+// data to the USB host).
+//
+// \return The return value is event-specific.
+//
+//*****************************************************************************
+uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue, void *pvMsgData)
+{
+ //
+ // Which event have we been sent?
+ //
+ switch(ui32Event)
+ {
+ case USB_EVENT_TX_COMPLETE:
+ {
+ //
+ // Since we are using the USBBuffer, we don't need to do anything
+ // here.
+ //
+ break;
+ }
+
+ //
+ // We don't expect to receive any other events. Ignore any that show
+ // up in a release build or hang in a debug build.
+ //
+ default:
+ {
+#ifdef DEBUG
+ while(1);
+#else
+ break;
+#endif
+ }
+ }
+ return(0);
+}
+
+//*****************************************************************************
+//
+// Handles CDC driver notifications related to the receive channel (data from
+// the USB host).
+//
+// \param pvCBData is the client-supplied callback data value for this channel.
+// \param ui32Event identifies the event we are being notified about.
+// \param ui32MsgValue is an event-specific value.
+// \param pvMsgData is an event-specific pointer.
+//
+// This function is called by the CDC driver to notify us of any events
+// related to operation of the receive data channel (the OUT channel carrying
+// data from the USB host).
+//
+// \return The return value is event-specific.
+//
+//*****************************************************************************
+uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue,void *pvMsgData)
+{
+ //
+ // Which event are we being sent?
+ //
+ switch(ui32Event)
+ {
+ //
+ // A new packet has been received.
+ //
+ case USB_EVENT_RX_AVAILABLE:
+ {
+ //
+ // Feed some characters into the UART TX FIFO and enable the
+ // interrupt so we are told when there is more space.
+ //
+ handleRx();
+ break;
+ }
+
+ //
+ // We are being asked how much unprocessed data we have still to
+ // process. We return 0 if the UART is currently idle or 1 if it is
+ // in the process of transmitting something. The actual number of
+ // bytes in the UART FIFO is not important here, merely whether or
+ // not everything previously sent to us has been transmitted.
+ //
+ case USB_EVENT_DATA_REMAINING:
+ {
+ //
+ // Get the number of bytes in the buffer and add 1 if some data
+ // still has to clear the transmitter.
+ return(0);
+ }
+
+ //
+ // We are being asked to provide a buffer into which the next packet
+ // can be read. We do not support this mode of receiving data so let
+ // the driver know by returning 0. The CDC driver should not be sending
+ // this message but this is included just for illustration and
+ // completeness.
+ //
+ case USB_EVENT_REQUEST_BUFFER:
+ {
+ return(0);
+ }
+
+ //
+ // We don't expect to receive any other events. Ignore any that show
+ // up in a release build or hang in a debug build.
+ //
+ default:
+#ifdef DEBUG
+ while(1);
+#else
+ break;
+#endif
+ }
+
+ return(0);
+}
+
+void handleRx(void)
+{
+ uint32_t ui32Read;
+ uint8_t ui8Char;
+ uint8_t size[4];
+ int size_bar = 0;
+
+ if (expected_message_size == 0)
+ {
+ do
+ {
+ ui32Read = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, &ui8Char, 1);
+
+ if(ui32Read)
+ {
+ size[size_bar++] = ui8Char;
+ }
+
+ } while(size_bar < 4);
+
+ expected_message_size = *(int *)size;
+ }
+
+ do
+ {
+ ui32Read = USBBufferRead((tUSBBuffer *)&g_sRxBuffer, &ui8Char, 1);
+
+ // Did we get a character?
+ if(ui32Read)
+ {
+ insertArray(&inBuffer, ui8Char);
+ current_message_size++;
+ }
+
+ if (current_message_size == expected_message_size)
+ {
+ g_RxCount += current_message_size;
+ expected_message_size = 0;
+ current_message_size = 0;
+ break;
+ }
+
+ } while(ui32Read);
+}
+/********************************************************************
+ * ======== USBCDCD_hwiHandler ========
+ * This function calls the USB library's device interrupt handler.
+ ********************************************************************/
+static Void USBCDCD_hwiHandler(UArg arg0)
+{
+ USB0DeviceIntHandler();
+}
+
+//Execute this function on UART0 Interrupt;
+void InitUSB(void)
+{
+ CheckForSerialStateChange(&g_sCDCDevice, 0);
+}
+
+//Initialize USB.
+void StartUSB(uint32_t ui32SysClock)
+{
+ uint32_t ui32PLLRate, ui32RxCount;
+ Hwi_Handle hwi;
+ Error_Block eb;
+
+ Error_init(&eb);
+
+ /* Install interrupt handler */
+ hwi = Hwi_create(INT_USB0, USBCDCD_hwiHandler, NULL, &eb);
+ if (hwi == NULL)
+ {
+ LOG_ERROR(hwi,"Can't create USB Hwi");
+ }
+
+
+ ui32RxCount = 0;
+ g_RxCount = 0;
+
+ initArray(&inBuffer, 1);
+
+ // Save the PLL rate used by this application.
+ SysCtlVCOGet(SYSCTL_XTAL_25MHZ, &ui32PLLRate);
+
+ // Not configured initially.
+ g_ui32Flags = 0;
+
+ // Initialize the transmit and receive buffers.
+ USBBufferInit(&g_sTxBuffer);
+ USBBufferInit(&g_sRxBuffer);
+
+ // Set the USB stack mode to Device mode with VBUS monitoring.
+ USBStackModeSet(0, eUSBModeDevice, 0);
+
+ // Tell the USB library the CPU clock and the PLL frequency. This is a
+ // new requirement for TM4C129 devices.
+ USBDCDFeatureSet(0, USBLIB_FEATURE_CPUCLK, &ui32SysClock);
+ USBDCDFeatureSet(0, USBLIB_FEATURE_USBPLL, &ui32PLLRate);
+
+ // Pass our device information to the USB library and place the device
+ // on the bus.
+ USBDCDCInit(0, (tUSBDCDCDevice *)&g_sCDCDevice);
+
+ while (1)
+ {
+ if(ui32RxCount != g_RxCount)
+ {
+ ui32RxCount = g_RxCount;
+
+ if (callback != NULL)
+ {
+ callback(inBuffer.buffer,inBuffer.used);
+ }
+
+ freeArray(&inBuffer);
+ initArray(&inBuffer, 1);
+ }
+ }
+}
+
+//Send a sequence of chars to PC.
+uint32_t SendChars(char* buffer,size_t length)
+{
+ uint8_t size[4];
+ size[3] = (length>>24) & 0xFF;
+ size[2] = (length>>16) & 0xFF;
+ size[1] = (length>>8) & 0xFF;
+ size[0] = length & 0xFF;
+
+ USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, size, 4);
+ return USBBufferWrite((tUSBBuffer *)&g_sTxBuffer, (uint8_t*)buffer, length);
+}
+
+//Register for serial data receive callback.
+void RegisterReceiveCallback(void (*callback_ptr)(char* buffer, size_t length))
+{
+ callback = callback_ptr;
+}
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.h b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.h
new file mode 100644
index 000000000..64db33052
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_adapter.h
@@ -0,0 +1,73 @@
+#include <stdbool.h>
+#include <stdlib.h>
+#include <stdint.h>
+
+#include "inc/hw_ints.h"
+#include "inc/hw_memmap.h"
+#include "inc/hw_types.h"
+#include "inc/hw_uart.h"
+
+#include "driverlib/debug.h"
+#include "driverlib/gpio.h"
+#include "driverlib/interrupt.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/systick.h"
+#include "driverlib/timer.h"
+#include "driverlib/uart.h"
+#include "driverlib/usb.h"
+#include "driverlib/rom.h"
+#include "driverlib/rom_map.h"
+
+#include "usblib/usblib.h"
+#include "usblib/usbcdc.h"
+#include "usblib/usb-ids.h"
+#include "usblib/device/usbdevice.h"
+#include "usblib/device/usbdcdc.h"
+//#include <ti/sysbios/knl/Task.h>
+#include "utils/ustdlib.h"
+#include "usb_serial_structs.h"
+
+//*****************************************************************************
+//
+// The system tick rate expressed both as ticks per second and a millisecond
+// period.
+//
+//*****************************************************************************
+#define TICKS_PER_SECOND 1000
+
+//*****************************************************************************
+//
+// Variables tracking transmit and receive counts.
+//
+//*****************************************************************************
+static volatile uint32_t g_RxCount;
+
+#ifdef DEBUG
+uint32_t g_ui32UARTRxErrors;
+#endif
+
+//*****************************************************************************
+//
+// Flags used to pass commands from interrupt context to the main loop.
+//
+//*****************************************************************************
+#define FLAG_STATUS_UPDATE 0
+#define FLAG_USB_CONFIGURED 1
+#define FLAG_SENDING_BREAK 2
+static volatile uint32_t g_ui32Flags;
+
+static void (*callback)(char* buffer, size_t length);
+
+//*****************************************************************************
+//
+// Internal function prototypes.
+//
+//*****************************************************************************
+static void CheckForSerialStateChange(const tUSBDCDCDevice *psDevice, uint32_t ui32Errors);
+static void SetControlLineState(uint16_t ui16State);
+static void GetLineCoding(tLineCoding *psLineCoding);
+static void handleRx(void);
+void StartUSB(uint32_t ui32SysClock);
+void InitUSB(void);
+uint32_t SendChars(char* buffer,size_t length);
+void RegisterReceiveCallback(void (*callback_ptr)(char* buffer, size_t length));
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.c b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.c
new file mode 100644
index 000000000..5025bb772
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.c
@@ -0,0 +1,32 @@
+/*
+ * usb_serial_buffer.c
+ *
+ * Created on: Sep 24, 2017
+ * Author: Roy
+ */
+
+#include <stdlib.h>
+#include "usb_serial_buffer.h"
+
+void initArray(SerialBuffer *a, size_t initialSize) {
+ a->buffer = (char *)malloc(initialSize);
+ a->used = 0;
+ a->size = initialSize;
+}
+
+void insertArray(SerialBuffer *a, char element) {
+ // a->used is the number of used entries, because a->array[a->used++] updates a->used only *after* the array has been accessed.
+ // Therefore a->used can go up to a->size
+ if (a->used == a->size) {
+ a->size += 1;
+ a->buffer = (char *)realloc(a->buffer, a->size * sizeof(char));
+ }
+ a->buffer[a->used++] = element;
+}
+
+void freeArray(SerialBuffer *a) {
+ free(a->buffer);
+ a->buffer = NULL;
+ a->used = a->size = 0;
+}
+
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.h b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.h
new file mode 100644
index 000000000..561f84b29
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_buffer.h
@@ -0,0 +1,20 @@
+/*
+ * usb_serial_buffer.h
+ *
+ * Created on: Sep 24, 2017
+ * Author: Roy
+ */
+#include <stdlib.h>
+
+struct serialBuffer {
+ char *buffer;
+ size_t used;
+ size_t size;
+} typedef SerialBuffer;
+
+void initArray(SerialBuffer *a, size_t initialSize);
+
+void insertArray(SerialBuffer *a, char element);
+
+void freeArray(SerialBuffer *a);
+
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.c b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.c
new file mode 100644
index 000000000..eaf5eebf4
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.c
@@ -0,0 +1,211 @@
+//*****************************************************************************
+//
+// usb_serial_structs.c - Data structures defining this CDC USB device.
+//
+// Copyright (c) 2013-2017 Texas Instruments Incorporated. All rights reserved.
+// Software License Agreement
+//
+// Texas Instruments (TI) is supplying this software for use solely and
+// exclusively on TI's microcontroller products. The software is owned by
+// TI and/or its suppliers, and is protected under applicable copyright
+// laws. You may not combine this software with "viral" open-source
+// software in order to form a larger program.
+//
+// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
+// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
+// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
+// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
+// DAMAGES, FOR ANY REASON WHATSOEVER.
+//
+// This is part of revision 2.1.4.178 of the DK-TM4C129X Firmware Package.
+//
+//*****************************************************************************
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "inc/hw_types.h"
+#include "driverlib/usb.h"
+#include "usblib/usblib.h"
+#include "usblib/usbcdc.h"
+#include "usblib/usb-ids.h"
+#include "usblib/device/usbdevice.h"
+#include "usblib/device/usbdcdc.h"
+#include "usb_serial_structs.h"
+
+#define USB_BUFFER_SIZE 1024
+
+//*****************************************************************************
+//
+// The languages supported by this device.
+//
+//*****************************************************************************
+const uint8_t g_pui8LangDescriptor[] =
+{
+ 4,
+ USB_DTYPE_STRING,
+ USBShort(USB_LANG_EN_US)
+};
+
+//*****************************************************************************
+//
+// The manufacturer string.
+//
+//*****************************************************************************
+const uint8_t g_pui8ManufacturerString[] =
+{
+ (17 + 1) * 2,
+ USB_DTYPE_STRING,
+ 'T', 0, 'e', 0, 'x', 0, 'a', 0, 's', 0, ' ', 0, 'I', 0, 'n', 0, 's', 0,
+ 't', 0, 'r', 0, 'u', 0, 'm', 0, 'e', 0, 'n', 0, 't', 0, 's', 0,
+};
+
+//*****************************************************************************
+//
+// The product string.
+//
+//*****************************************************************************
+const uint8_t g_pui8ProductString[] =
+{
+ 2 + (16 * 2),
+ USB_DTYPE_STRING,
+ 'V', 0, 'i', 0, 'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0,
+ 'C', 0, 'O', 0, 'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0
+};
+
+//*****************************************************************************
+//
+// The serial number string.
+//
+//*****************************************************************************
+const uint8_t g_pui8SerialNumberString[] =
+{
+ 2 + (8 * 2),
+ USB_DTYPE_STRING,
+ '1', 0, '2', 0, '3', 0, '4', 0, '5', 0, '6', 0, '7', 0, '8', 0
+};
+
+//*****************************************************************************
+//
+// The control interface description string.
+//
+//*****************************************************************************
+const uint8_t g_pui8ControlInterfaceString[] =
+{
+ 2 + (21 * 2),
+ USB_DTYPE_STRING,
+ 'A', 0, 'C', 0, 'M', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0, 't', 0,
+ 'r', 0, 'o', 0, 'l', 0, ' ', 0, 'I', 0, 'n', 0, 't', 0, 'e', 0,
+ 'r', 0, 'f', 0, 'a', 0, 'c', 0, 'e', 0
+};
+
+//*****************************************************************************
+//
+// The configuration description string.
+//
+//*****************************************************************************
+const uint8_t g_pui8ConfigString[] =
+{
+ 2 + (26 * 2),
+ USB_DTYPE_STRING,
+ 'S', 0, 'e', 0, 'l', 0, 'f', 0, ' ', 0, 'P', 0, 'o', 0, 'w', 0,
+ 'e', 0, 'r', 0, 'e', 0, 'd', 0, ' ', 0, 'C', 0, 'o', 0, 'n', 0,
+ 'f', 0, 'i', 0, 'g', 0, 'u', 0, 'r', 0, 'a', 0, 't', 0, 'i', 0,
+ 'o', 0, 'n', 0
+};
+
+//*****************************************************************************
+//
+// The descriptor string table.
+//
+//*****************************************************************************
+const uint8_t * const g_pui8StringDescriptors[] =
+{
+ g_pui8LangDescriptor,
+ g_pui8ManufacturerString,
+ g_pui8ProductString,
+ g_pui8SerialNumberString,
+ g_pui8ControlInterfaceString,
+ g_pui8ConfigString
+};
+
+#define NUM_STRING_DESCRIPTORS (sizeof(g_pui8StringDescriptors) / \
+ sizeof(uint8_t *))
+
+//*****************************************************************************
+//
+// CDC device callback function prototypes.
+//
+//*****************************************************************************
+uint32_t RxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue,
+ void *pvMsgData);
+uint32_t TxHandler(void *pvCBData, uint32_t ui32Event, uint32_t ui32MsgValue,
+ void *pvMsgData);
+uint32_t ControlHandler(void *pvCBData, uint32_t ui32Event,
+ uint32_t ui32MsgValue, void *pvMsgData);
+
+//*****************************************************************************
+//
+// The CDC device initialization and customization structures. In this case,
+// we are using USBBuffers between the CDC device class driver and the
+// application code. The function pointers and callback data values are set
+// to insert a buffer in each of the data channels, transmit and receive.
+//
+// With the buffer in place, the CDC channel callback is set to the relevant
+// channel function and the callback data is set to point to the channel
+// instance data. The buffer, in turn, has its callback set to the application
+// function and the callback data set to our CDC instance structure.
+//
+//*****************************************************************************
+tCDCSerInstance g_sCDCInstance;
+tUSBDCDCDevice g_sCDCDevice =
+{
+ USB_VID_TI_1CBE,
+ USB_PID_SERIAL,
+ 0,
+ USB_CONF_ATTR_SELF_PWR,
+ ControlHandler,
+ (void *)&g_sCDCDevice,
+ USBBufferEventCallback,
+ (void *)&g_sRxBuffer,
+ USBBufferEventCallback,
+ (void *)&g_sTxBuffer,
+ g_pui8StringDescriptors,
+ NUM_STRING_DESCRIPTORS,
+};
+
+//*****************************************************************************
+//
+// Receive buffer (from the USB perspective).
+//
+//*****************************************************************************
+uint8_t g_pui8USBRxBuffer[USB_BUFFER_SIZE];
+tUSBBuffer g_sRxBuffer =
+{
+ false, // This is a receive buffer.
+ RxHandler, // pfnCallback
+ (void *)&g_sCDCDevice, // Callback data is our device pointer.
+ USBDCDCPacketRead, // pfnTransfer
+ USBDCDCRxPacketAvailable, // pfnAvailable
+ (void *)&g_sCDCDevice, // pvHandle
+ g_pui8USBRxBuffer, // pui8Buffer
+ USB_BUFFER_SIZE, // ui32BufferSize
+};
+
+//*****************************************************************************
+//
+// Transmit buffer (from the USB perspective).
+//
+//*****************************************************************************
+uint8_t g_pui8USBTxBuffer[USB_BUFFER_SIZE];
+tUSBBuffer g_sTxBuffer =
+{
+ true, // This is a transmit buffer.
+ TxHandler, // pfnCallback
+ (void *)&g_sCDCDevice, // Callback data is our device pointer.
+ USBDCDCPacketWrite, // pfnTransfer
+ USBDCDCTxPacketAvailable, // pfnAvailable
+ (void *)&g_sCDCDevice, // pvHandle
+ g_pui8USBTxBuffer, // pcBuffer
+ USB_BUFFER_SIZE, // ulBufferSize
+};
diff --git a/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.h b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.h
new file mode 100644
index 000000000..a02ac1c75
--- /dev/null
+++ b/Software/Embedded_SW/Embedded/Drivers/twine_usblib/usb_serial_structs.h
@@ -0,0 +1,49 @@
+//*****************************************************************************
+//
+// usb_serial_structs.h - Data structures defining this USB CDC device.
+//
+// Copyright (c) 2013-2017 Texas Instruments Incorporated. All rights reserved.
+// Software License Agreement
+//
+// Texas Instruments (TI) is supplying this software for use solely and
+// exclusively on TI's microcontroller products. The software is owned by
+// TI and/or its suppliers, and is protected under applicable copyright
+// laws. You may not combine this software with "viral" open-source
+// software in order to form a larger program.
+//
+// THIS SOFTWARE IS PROVIDED "AS IS" AND WITH ALL FAULTS.
+// NO WARRANTIES, WHETHER EXPRESS, IMPLIED OR STATUTORY, INCLUDING, BUT
+// NOT LIMITED TO, IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. TI SHALL NOT, UNDER ANY
+// CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR CONSEQUENTIAL
+// DAMAGES, FOR ANY REASON WHATSOEVER.
+//
+// This is part of revision 2.1.4.178 of the DK-TM4C129X Firmware Package.
+//
+//*****************************************************************************
+
+#ifndef _USB_SERIAL_STRUCTS_H_
+#define _USB_SERIAL_STRUCTS_H_
+
+//*****************************************************************************
+//
+// The size of the transmit and receive buffers used for the redirected UART.
+// This number should be a power of 2 for best performance. 256 is chosen
+// pretty much at random though the buffer should be at least twice the size of
+// a maximum-sized USB packet.
+//
+//*****************************************************************************
+#define UART_BUFFER_SIZE 256
+
+extern uint32_t RxHandler(void *pvCBData, uint32_t ui32Event,
+ uint32_t ui32MsgValue, void *pvMsgData);
+extern uint32_t TxHandler(void *pvlCBData, uint32_t ui32Event,
+ uint32_t ui32MsgValue, void *pvMsgData);
+
+extern tUSBBuffer g_sTxBuffer;
+extern tUSBBuffer g_sRxBuffer;
+extern tUSBDCDCDevice g_sCDCDevice;
+extern uint8_t g_pui8USBTxBuffer[];
+extern uint8_t g_pui8USBRxBuffer[];
+
+#endif