commit 35d1ee2387f89ddebf488d52fc9475d83629ea24
Author: Andy Killorin <37423245+Speedy6451@users.noreply.github.com>
Date: Thu Mar 20 11:20:21 2025 -0400
time formatting
diff --git a/.ccsproject b/.ccsproject
new file mode 100644
index 0000000..405b88a
--- /dev/null
+++ b/.ccsproject
@@ -0,0 +1,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.clangd b/.clangd
new file mode 100644
index 0000000..8c4daa2
--- /dev/null
+++ b/.clangd
@@ -0,0 +1,11 @@
+# This is an auto-generated file - do not add it to source-control
+
+CompileFlags:
+ CompilationDatabase: Debug/.clangd
+
+Diagnostics:
+ Suppress: '*'
+
+InlayHints:
+ Enabled: No
+
diff --git a/.cproject b/.cproject
new file mode 100644
index 0000000..a3499af
--- /dev/null
+++ b/.cproject
@@ -0,0 +1,205 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..3df573f
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1 @@
+/Debug/
diff --git a/.launches/ece3849_lab0_starter.launch b/.launches/ece3849_lab0_starter.launch
new file mode 100644
index 0000000..f08e02d
--- /dev/null
+++ b/.launches/ece3849_lab0_starter.launch
@@ -0,0 +1,16 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/.project b/.project
new file mode 100644
index 0000000..545c344
--- /dev/null
+++ b/.project
@@ -0,0 +1,33 @@
+
+
+ ece3849_lab0_starter
+
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.genmakebuilder
+
+
+
+
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
+ full,incremental,
+
+
+
+
+
+ com.ti.ccstudio.core.ccsNature
+ org.eclipse.cdt.core.cnature
+ org.eclipse.cdt.managedbuilder.core.managedBuildNature
+ org.eclipse.cdt.core.ccnature
+ org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
+
+
+
+ SW_ROOT
+ $%7BCOM_TI_RTSC_TIRTOSTIVAC__TIVAWARE_C_SERIES%7D
+
+
+
diff --git a/.settings/org.eclipse.cdt.codan.core.prefs b/.settings/org.eclipse.cdt.codan.core.prefs
new file mode 100644
index 0000000..98b6350
--- /dev/null
+++ b/.settings/org.eclipse.cdt.codan.core.prefs
@@ -0,0 +1,3 @@
+eclipse.preferences.version=1
+inEditor=false
+onBuild=false
diff --git a/.settings/org.eclipse.cdt.debug.core.prefs b/.settings/org.eclipse.cdt.debug.core.prefs
new file mode 100644
index 0000000..58d4fb2
--- /dev/null
+++ b/.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/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs
new file mode 100644
index 0000000..7c051cc
--- /dev/null
+++ b/.settings/org.eclipse.core.resources.prefs
@@ -0,0 +1,6 @@
+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
diff --git a/Crystalfontz128x128_ST7735.c b/Crystalfontz128x128_ST7735.c
new file mode 100644
index 0000000..4a11873
--- /dev/null
+++ b/Crystalfontz128x128_ST7735.c
@@ -0,0 +1,596 @@
+/* --COPYRIGHT--,BSD
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * --/COPYRIGHT--*/
+//*****************************************************************************
+//
+// Crystalfontz128x128.c - Display driver for the Crystalfontz
+// 128x128 display with ST7735 controller.
+//
+// Modified by Gene Bogdanov 8/30/2017
+//
+//*****************************************************************************
+
+#include "Crystalfontz128x128_ST7735.h"
+
+#include
+#include
+#include "grlib/grlib.h"
+#include "HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h"
+
+uint8_t Lcd_Orientation;
+uint16_t Lcd_ScreenWidth, Lcd_ScreenHeigth;
+uint8_t Lcd_PenSolid, Lcd_FontSolid, Lcd_FlagRead;
+uint16_t Lcd_TouchTrim;
+
+uint16_t Lcd_buffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX] = {0}; // Gene Bogdanov: LCD frame buffer in RAM
+
+static void Crystalfontz128x128_Flush(void *pvDisplayData);
+static uint32_t Crystalfontz128x128_ColorTranslate(void *pvDisplayData, uint32_t ulValue);
+
+//*****************************************************************************
+//
+//! Initializes the display driver.
+//!
+//! This function initializes the ST7735 display controller on the panel,
+//! preparing it to display data.
+//!
+//! \return None.
+//
+//*****************************************************************************
+void Crystalfontz128x128_Init(void)
+{
+ HAL_LCD_PortInit();
+ HAL_LCD_SpiInit();
+
+ HAL_LCD_writeCommand(CM_SLPOUT);
+ HAL_LCD_delay(120000);
+
+ HAL_LCD_writeCommand(CM_GAMSET);
+ HAL_LCD_writeData(0x04);
+
+ HAL_LCD_writeCommand(CM_SETPWCTR);
+ HAL_LCD_writeData(0x0A);
+ HAL_LCD_writeData(0x14);
+
+ HAL_LCD_writeCommand(CM_SETSTBA);
+ HAL_LCD_writeData(0x0A);
+ HAL_LCD_writeData(0x00);
+
+ HAL_LCD_writeCommand(CM_COLMOD);
+ HAL_LCD_writeData(0x05);
+ HAL_LCD_delay(10);
+
+ HAL_LCD_writeCommand(CM_MADCTL);
+ HAL_LCD_writeData(CM_MADCTL_BGR);
+
+ HAL_LCD_writeCommand(CM_NORON);
+
+ Lcd_ScreenWidth = LCD_HORIZONTAL_MAX;
+ Lcd_ScreenHeigth = LCD_VERTICAL_MAX;
+ Lcd_PenSolid = 0;
+ Lcd_FontSolid = 1;
+ Lcd_FlagRead = 0;
+ Lcd_TouchTrim = 0;
+
+ Crystalfontz128x128_Flush(0); // Gene Bogdanov: flush the RAM buffer instead of filling LCD memory with fixed values
+
+ HAL_LCD_delay(10);
+ HAL_LCD_writeCommand(CM_DISPON);
+}
+
+
+void Crystalfontz128x128_SetDrawFrame(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1)
+{
+ switch (Lcd_Orientation) {
+ case 0:
+ x0 += 2;
+ y0 += 3;
+ x1 += 2;
+ y1 += 3;
+ break;
+ case 1:
+ x0 += 3;
+ y0 += 2;
+ x1 += 3;
+ y1 += 2;
+ break;
+ case 2:
+ x0 += 2;
+ y0 += 1;
+ x1 += 2;
+ y1 += 1;
+ break;
+ case 3:
+ x0 += 1;
+ y0 += 2;
+ x1 += 1;
+ y1 += 2;
+ break;
+ default:
+ break;
+ }
+
+ HAL_LCD_writeCommand(CM_CASET);
+ HAL_LCD_writeData((uint8_t)(x0 >> 8));
+ HAL_LCD_writeData((uint8_t)(x0));
+ HAL_LCD_writeData((uint8_t)(x1 >> 8));
+ HAL_LCD_writeData((uint8_t)(x1));
+
+ HAL_LCD_writeCommand(CM_RASET);
+ HAL_LCD_writeData((uint8_t)(y0 >> 8));
+ HAL_LCD_writeData((uint8_t)(y0));
+ HAL_LCD_writeData((uint8_t)(y1 >> 8));
+ HAL_LCD_writeData((uint8_t)(y1));
+}
+
+
+//*****************************************************************************
+//
+//! Sets the LCD Orientation.
+//!
+//! \param orientation is the desired orientation for the LCD. Valid values are:
+//! - \b LCD_ORIENTATION_UP,
+//! - \b LCD_ORIENTATION_LEFT,
+//! - \b LCD_ORIENTATION_DOWN,
+//! - \b LCD_ORIENTATION_RIGHT,
+//!
+//! This function sets the orientation of the LCD
+//!
+//! \return None.
+//
+//*****************************************************************************
+void Crystalfontz128x128_SetOrientation(uint8_t orientation)
+{
+ Lcd_Orientation = orientation;
+ HAL_LCD_writeCommand(CM_MADCTL);
+ switch (Lcd_Orientation) {
+ case LCD_ORIENTATION_UP:
+ HAL_LCD_writeData(CM_MADCTL_MX | CM_MADCTL_MY | CM_MADCTL_BGR);
+ break;
+ case LCD_ORIENTATION_LEFT:
+ HAL_LCD_writeData(CM_MADCTL_MY | CM_MADCTL_MV | CM_MADCTL_BGR);
+ break;
+ case LCD_ORIENTATION_DOWN:
+ HAL_LCD_writeData(CM_MADCTL_BGR);
+ break;
+ case LCD_ORIENTATION_RIGHT:
+ HAL_LCD_writeData(CM_MADCTL_MX | CM_MADCTL_MV | CM_MADCTL_BGR);
+ break;
+ }
+}
+
+
+//*****************************************************************************
+//
+//! Draws a pixel on the screen.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//! \param lX is the X coordinate of the pixel.
+//! \param lY is the Y coordinate of the pixel.
+//! \param ulValue is the color of the pixel.
+//!
+//! This function sets the given pixel to a particular color. The coordinates of
+//! the pixel are assumed to be within the extents of the display.
+//!
+//! Gene Bogdanov: Added local frame buffer.
+//!
+//! \return None.
+//
+//*****************************************************************************
+static void Crystalfontz128x128_PixelDraw(void *pvDisplayData, int32_t lX, int32_t lY,
+ uint32_t ulValue)
+{
+ Lcd_buffer[lY][lX] = ulValue;
+}
+
+
+//*****************************************************************************
+//
+//! Draws a horizontal sequence of pixels on the screen.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//! \param lX is the X coordinate of the first pixel.
+//! \param lY is the Y coordinate of the first pixel.
+//! \param lX0 is sub-pixel offset within the pixel data, which is valid for 1
+//! or 4 bit per pixel formats.
+//! \param lCount is the number of pixels to draw.
+//! \param lBPP is the number of bits per pixel; must be 1, 4, or 8.
+//! \param pucData is a pointer to the pixel data. For 1 and 4 bit per pixel
+//! formats, the most significant bit(s) represent the left-most pixel.
+//! \param pucPalette is a pointer to the palette used to draw the pixels.
+//!
+//! This function draws a horizontal sequence of pixels on the screen, using
+//! the supplied palette. For 1 bit per pixel format, the palette contains
+//! pre-translated colors; for 4 and 8 bit per pixel formats, the palette
+//! contains 24-bit RGB values that must be translated before being written to
+//! the display.
+//!
+//! \return None.
+//
+//*****************************************************************************
+static void Crystalfontz128x128_PixelDrawMultiple(void *pvDisplayData, int32_t lX,
+ int32_t lY, int32_t lX0, int32_t lCount,
+ int32_t lBPP,
+ const uint8_t *pucData,
+ const uint8_t *pucPalette)
+{
+ uint32_t Data, rgb, native;
+ uint16_t *pWrite = &Lcd_buffer[lY][lX]; // pointer to the write location in Lcd_buffer[]
+
+ //
+ // Determine how to interpret the pixel data based on the number of bits
+ // per pixel.
+ //
+ switch(lBPP)
+ {
+ // The pixel data is in 1 bit per pixel format
+ case 1:
+ {
+ // Loop while there are more pixels to draw
+ while(lCount > 0)
+ {
+ // Get the next byte of image data
+ Data = *pucData++;
+
+ // Loop through the pixels in this byte of image data
+ for(; (lX0 < 8) && lCount; lX0++, lCount--)
+ {
+ // Draw this pixel in the appropriate color
+ *pWrite++ = ((uint32_t *)pucPalette)[(Data >> (7 - lX0)) & 1];
+ }
+
+ // Start at the beginning of the next byte of image data
+ lX0 = 0;
+ }
+ // The image data has been drawn
+
+ break;
+ }
+
+ // The pixel data is in 4 bit per pixel format
+ case 4:
+ {
+ // Loop while there are more pixels to draw. "Duff's device" is
+ // used to jump into the middle of the loop if the first nibble of
+ // the pixel data should not be used. Duff's device makes use of
+ // the fact that a case statement is legal anywhere within a
+ // sub-block of a switch statement. See
+ // http://en.wikipedia.org/wiki/Duff's_device for detailed
+ // information about Duff's device.
+ switch(lX0 & 1)
+ {
+ case 0:
+
+ while(lCount)
+ {
+ // Get the upper nibble of the next byte of pixel data
+ // and extract the corresponding entry from the palette
+ Data = (*pucData >> 4);
+ rgb = *(uint32_t *)(pucPalette + 3*Data);
+ native = Crystalfontz128x128_ColorTranslate(pvDisplayData, rgb);
+ // Write to LCD screen
+ *pWrite++ = native;
+
+ // Decrement the count of pixels to draw
+ lCount--;
+
+ // See if there is another pixel to draw
+ if(lCount)
+ {
+ case 1:
+ // Get the lower nibble of the next byte of pixel
+ // data and extract the corresponding entry from
+ // the palette
+ Data = (*pucData++ & 15);
+ rgb = *(uint32_t *)(pucPalette + 3*Data);
+ native = Crystalfontz128x128_ColorTranslate(pvDisplayData, rgb);
+ // Write to LCD screen
+ *pWrite++ = native;
+
+ // Decrement the count of pixels to draw
+ lCount--;
+ }
+ }
+ }
+ // The image data has been drawn.
+
+ break;
+ }
+
+ // The pixel data is in 8 bit per pixel format
+ case 8:
+ {
+ // Loop while there are more pixels to draw
+ while(lCount--)
+ {
+ // Get the next byte of pixel data and extract the
+ // corresponding entry from the palette
+ Data = *pucData++;
+ rgb = *(uint32_t *)(pucPalette + 3*Data);
+ native = Crystalfontz128x128_ColorTranslate(pvDisplayData, rgb);
+ // Write to LCD screen
+ *pWrite++ = native;
+ }
+ // The image data has been drawn
+ break;
+ }
+
+ //
+ // We are being passed data in the display's native format. Merely
+ // write it directly to the display. This is a special case which is
+ // not used by the graphics library but which is helpful to
+ // applications which may want to handle, for example, JPEG images.
+ //
+ case 16:
+ {
+ uint16_t usData;
+
+ // Loop while there are more pixels to draw.
+
+ while(lCount--)
+ {
+ // Get the next byte of pixel data and extract the
+ // corresponding entry from the palette
+ usData = *((uint16_t *)pucData);
+ pucData += 2;
+
+ // Translate this palette entry and write it to the screen
+ *pWrite++ = usData;
+ }
+ }
+ }
+}
+
+
+//*****************************************************************************
+//
+//! Draws a horizontal line.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//! \param lX1 is the X coordinate of the start of the line.
+//! \param lX2 is the X coordinate of the end of the line.
+//! \param lY is the Y coordinate of the line.
+//! \param ulValue is the color of the line.
+//!
+//! This function draws a horizontal line on the display. The coordinates of
+//! the line are assumed to be within the extents of the display.
+//!
+//! \return None.
+//
+//*****************************************************************************
+static void Crystalfontz128x128_LineDrawH(void *pvDisplayData, int32_t lX1, int32_t lX2,
+ int32_t lY, uint32_t ulValue)
+{
+ if (lX1 & 1) { // starts at an odd coordinate: fill in first pixel
+ Lcd_buffer[lY][lX1] = ulValue;
+ lX1++;
+ }
+
+ if (!(lX2 & 1)) { // ends at an even coordinate: fill in last pixel
+ Lcd_buffer[lY][lX2] = ulValue;
+ lX2--;
+ }
+
+ // fill in the bulk of the line 2 pixels at a time
+ uint32_t *pWrite = (uint32_t*)&Lcd_buffer[lY][lX1]; // pointer to the start of the line
+ uint32_t fill = ulValue | (ulValue << 16);
+ for (; lX1 < lX2; lX1 += 2) {
+ *pWrite++ = fill;
+ }
+}
+
+
+//*****************************************************************************
+//
+//! Draws a vertical line.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//! \param lX is the X coordinate of the line.
+//! \param lY1 is the Y coordinate of the start of the line.
+//! \param lY2 is the Y coordinate of the end of the line.
+//! \param ulValue is the color of the line.
+//!
+//! This function draws a vertical line on the display. The coordinates of the
+//! line are assumed to be within the extents of the display.
+//!
+//! \return None.
+//
+//*****************************************************************************
+static void Crystalfontz128x128_LineDrawV(void *pvDisplayData, int32_t lX, int32_t lY1,
+ int32_t lY2, uint32_t ulValue)
+{
+ // fill the line
+ for (; lY1 <= lY2; lY1++) {
+ Lcd_buffer[lY1][lX] = ulValue;
+ }
+}
+
+
+//*****************************************************************************
+//
+//! Fills a rectangle.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//! \param pRect is a pointer to the structure describing the rectangle.
+//! \param ulValue is the color of the rectangle.
+//!
+//! This function fills a rectangle on the display. The coordinates of the
+//! rectangle are assumed to be within the extents of the display, and the
+//! rectangle specification is fully inclusive (in other words, both sXMin and
+//! sXMax are drawn, along with sYMin and sYMax).
+//!
+//! \return None.
+//
+//*****************************************************************************
+static void Crystalfontz128x128_RectFill(void *pvDisplayData, const tRectangle *pRect,
+ uint32_t ulValue)
+{
+ int32_t lX1 = pRect->i16XMin;
+ int32_t lX2 = pRect->i16XMax;
+ int32_t lY1 = pRect->i16YMin;
+ int32_t lY2 = pRect->i16YMax;
+ uint32_t i;
+ if (lX1 & 1) { // starts at an odd coordinate: fill in first column
+ for (i = lY1; i <= lY2; i++) {
+ Lcd_buffer[i][lX1] = ulValue;
+ }
+ lX1++;
+ }
+
+ if (!(lX2 & 1)) { // ends at an even coordinate: fill in last column
+ for (i = lY1; i <= lY2; i++) {
+ Lcd_buffer[i][lX2] = ulValue;
+ }
+ lX2--;
+ }
+
+ // fill the bulk of the rectangle
+ uint32_t fill = ulValue | (ulValue << 16);
+ for (; lY1 <= lY2; lY1++) {
+ // fill 2 pixels at a time
+ uint32_t *pWrite = (uint32_t*)&Lcd_buffer[lY1][lX1]; // pointer to the start of the line
+ for (i = lX1; i < lX2; i += 2) {
+ *pWrite++ = fill;
+ }
+ }
+}
+
+//*****************************************************************************
+//
+//! Translates a 24-bit RGB color to a display driver-specific color.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//! \param ulValue is the 24-bit RGB color. The least-significant byte is the
+//! blue channel, the next byte is the green channel, and the third byte is the
+//! red channel.
+//!
+//! This function translates a 24-bit RGB color into a value that can be
+//! written into the display's frame buffer in order to reproduce that color,
+//! or the closest possible approximation of that color.
+//!
+//! \return Returns the display-driver specific color.
+//
+//*****************************************************************************
+static uint32_t Crystalfontz128x128_ColorTranslate(void *pvDisplayData,
+ uint32_t ulValue)
+{
+ //
+ // Translate from a 24-bit RGB color to a 5-6-5 RGB color.
+ //
+ uint32_t rgb565 =
+ ((((ulValue) & 0x00f80000) >> 8) |
+ (((ulValue) & 0x0000fc00) >> 5) |
+ (((ulValue) & 0x000000f8) >> 3));
+ return (rgb565 >> 8) | ((rgb565 << 8) & 0xff00); // swap bytes
+}
+
+
+//*****************************************************************************
+//
+//! Flushes any cached drawing operations.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//!
+//! This functions flushes any cached drawing operations to the display. This
+//! is useful when a local frame buffer is used for drawing operations, and the
+//! flush would copy the local frame buffer to the display.
+//!
+//! Gene Bogdanov: Added local frame buffer.
+//!
+//! \return None.
+//
+//*****************************************************************************
+static void
+Crystalfontz128x128_Flush(void *pvDisplayData)
+{
+ Crystalfontz128x128_SetDrawFrame(0, 0, LCD_HORIZONTAL_MAX-1, LCD_VERTICAL_MAX-1);
+ HAL_LCD_writeCommand(CM_RAMWR);
+ int i;
+ uint16_t *pRead = &Lcd_buffer[0][0];
+ uint32_t data;
+ for (i = 0; i < LCD_HORIZONTAL_MAX * LCD_VERTICAL_MAX; i++)
+ {
+ data = *pRead++;
+ HAL_LCD_writeData((uint8_t)data);
+ HAL_LCD_writeData((uint8_t)(data >> 8));
+ }
+}
+
+
+//*****************************************************************************
+//
+//! Send command to clear screen.
+//!
+//! \param pvDisplayData is a pointer to the driver-specific data for this
+//! display driver.
+//!
+//! This function does a clear screen and the Display Buffer contents
+//! are initialized to the current background color.
+//!
+//! \return None.
+//
+//*****************************************************************************
+//static void
+//Crystalfontz128x128_ClearScreen (void *pvDisplayData, uint16_t ulValue)
+//{
+// tRectangle rect = { 0, 0, LCD_VERTICAL_MAX-1, LCD_VERTICAL_MAX-1};
+// Crystalfontz128x128_RectFill(&pvDisplayData, &rect, ulValue);
+//}
+
+
+//*****************************************************************************
+//
+//! The display structure that describes the driver for the Kitronix
+//! K350QVG-V1-F TFT panel with an SSD2119 controller.
+//
+//*****************************************************************************
+const tDisplay g_sCrystalfontz128x128 =
+{
+ sizeof(tDisplay),
+ 0,
+ LCD_VERTICAL_MAX,
+ LCD_HORIZONTAL_MAX,
+ Crystalfontz128x128_PixelDraw,
+ Crystalfontz128x128_PixelDrawMultiple,
+ Crystalfontz128x128_LineDrawH,
+ Crystalfontz128x128_LineDrawV,
+ Crystalfontz128x128_RectFill,
+ Crystalfontz128x128_ColorTranslate,
+ Crystalfontz128x128_Flush
+};
+
diff --git a/Crystalfontz128x128_ST7735.h b/Crystalfontz128x128_ST7735.h
new file mode 100644
index 0000000..aa4d528
--- /dev/null
+++ b/Crystalfontz128x128_ST7735.h
@@ -0,0 +1,114 @@
+/* --COPYRIGHT--,BSD
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * --/COPYRIGHT--*/
+//*****************************************************************************
+//
+// Crystalfontz128x128.h - Prototypes for the display driver for the Crystalfontz
+// 128x128 display with ST7735 controller.
+//
+// Modified by Gene Bogdanov 8/30/2017
+//
+//*****************************************************************************
+
+#ifndef __CRYSTALFONTZLCD_H__
+#define __CRYSTALFONTZLCD_H__
+
+
+#include
+#include
+#include "grlib/grlib.h"
+
+// LCD Screen Dimensions
+#define LCD_VERTICAL_MAX 128
+#define LCD_HORIZONTAL_MAX 128
+
+#define LCD_ORIENTATION_UP 0
+#define LCD_ORIENTATION_LEFT 1
+#define LCD_ORIENTATION_DOWN 2
+#define LCD_ORIENTATION_RIGHT 3
+
+// ST7735 LCD controller Command Set
+#define CM_NOP 0x00
+#define CM_SWRESET 0x01
+#define CM_RDDID 0x04
+#define CM_RDDST 0x09
+#define CM_SLPIN 0x10
+#define CM_SLPOUT 0x11
+#define CM_PTLON 0x12
+#define CM_NORON 0x13
+#define CM_INVOFF 0x20
+#define CM_INVON 0x21
+#define CM_GAMSET 0x26
+#define CM_DISPOFF 0x28
+#define CM_DISPON 0x29
+#define CM_CASET 0x2A
+#define CM_RASET 0x2B
+#define CM_RAMWR 0x2C
+#define CM_RGBSET 0x2d
+#define CM_RAMRD 0x2E
+#define CM_PTLAR 0x30
+#define CM_MADCTL 0x36
+#define CM_COLMOD 0x3A
+#define CM_SETPWCTR 0xB1
+#define CM_SETDISPL 0xB2
+#define CM_FRMCTR3 0xB3
+#define CM_SETCYC 0xB4
+#define CM_SETBGP 0xb5
+#define CM_SETVCOM 0xB6
+#define CM_SETSTBA 0xC0
+#define CM_SETID 0xC3
+#define CM_GETHID 0xd0
+#define CM_SETGAMMA 0xE0
+#define CM_MADCTL_MY 0x80
+#define CM_MADCTL_MX 0x40
+#define CM_MADCTL_MV 0x20
+#define CM_MADCTL_ML 0x10
+#define CM_MADCTL_BGR 0x08
+#define CM_MADCTL_MH 0x04
+
+extern uint8_t Lcd_Orientation;
+extern uint16_t Lcd_ScreenWidth, Lcd_ScreenHeigth;
+extern uint8_t Lcd_PenSolid, Lcd_FontSolid, Lcd_FlagRead;
+extern uint16_t Lcd_TouchTrim;
+
+extern uint16_t Lcd_buffer[LCD_VERTICAL_MAX][LCD_HORIZONTAL_MAX];
+
+extern const tDisplay g_sCrystalfontz128x128;
+
+extern void Crystalfontz128x128_Init(void);
+
+extern void Crystalfontz128x128_SetDrawFrame(uint32_t x0, uint32_t y0, uint32_t x1, uint32_t y1);
+
+extern void Crystalfontz128x128_SetOrientation(uint8_t orientation);
+
+
+
+#endif /* __CRYSTALFONTZLCD_H__ */
diff --git a/HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.c b/HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.c
new file mode 100644
index 0000000..95adc76
--- /dev/null
+++ b/HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.c
@@ -0,0 +1,133 @@
+/* --COPYRIGHT--,BSD
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * --/COPYRIGHT--*/
+//*****************************************************************************
+//
+// HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.c -
+// Hardware abstraction layer for using the Educational Boosterpack's
+// Crystalfontz128x128 LCD with EK-TM4C1294XL LaunchPad
+//
+// Ported by Gene Bogdanov 8/30/2017
+//
+//*****************************************************************************
+
+
+#include
+#include
+#include "HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h"
+#include "grlib/grlib.h"
+#include "inc/hw_memmap.h"
+#include "driverlib/gpio.h"
+#include "driverlib/ssi.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/pin_map.h"
+
+void HAL_LCD_PortInit(void)
+{
+ // LCD_SCK
+ SysCtlPeripheralEnable(LCD_SCK_PERIPH);
+ GPIOPinTypeSSI(LCD_SCK_BASE, LCD_SCK_PIN);
+ GPIOPinConfigure(LCD_SCK_CONFIG);
+
+ // LCD_MOSI
+ SysCtlPeripheralEnable(LCD_MOSI_PERIPH);
+ GPIOPinTypeSSI(LCD_MOSI_BASE, LCD_MOSI_PIN);
+ GPIOPinConfigure(LCD_MOSI_CONFIG);
+
+ // LCD_RST
+ SysCtlPeripheralEnable(LCD_RST_PERIPH);
+ GPIOPinTypeGPIOOutput(LCD_RST_BASE, LCD_RST_PIN);
+
+ // LCD_RS (DC)
+ SysCtlPeripheralEnable(LCD_DC_PERIPH);
+ GPIOPinTypeGPIOOutput(LCD_DC_BASE, LCD_DC_PIN);
+
+ // LCD_CS
+ SysCtlPeripheralEnable(LCD_CS_PERIPH);
+ GPIOPinTypeGPIOOutput(LCD_CS_BASE, LCD_CS_PIN);
+}
+
+void HAL_LCD_SpiInit(void)
+{
+ // configure SSI as SPI
+ SysCtlPeripheralEnable(LCD_SSI_PERIPH);
+ SSIConfigSetExpClk(LCD_SSI_BASE, LCD_SYSTEM_CLOCK, LCD_SSI_PROTOCOL, SSI_MODE_MASTER, LCD_SSI_CLOCK, LCD_SSI_DATA_WIDTH);
+ SSIEnable(LCD_SSI_BASE);
+
+ // set outputs to default state
+ GPIOPinWrite(LCD_CS_BASE, LCD_CS_PIN, 0);
+ GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, LCD_DC_PIN);
+
+ // activate reset
+ GPIOPinWrite(LCD_RST_BASE, LCD_RST_PIN, 0);
+
+ HAL_LCD_delay(20);
+
+ // deactivate reset
+ GPIOPinWrite(LCD_RST_BASE, LCD_RST_PIN, LCD_RST_PIN);
+
+ // delay more than 120 ms after reset
+ HAL_LCD_delay(120000);
+}
+
+
+//*****************************************************************************
+//
+// Writes a command to the CFAF128128B-0145T. This function implements the basic SPI
+// interface to the LCD display.
+//
+//*****************************************************************************
+void HAL_LCD_writeCommand(uint8_t command)
+{
+ // Set to command mode
+ while (SSIBusy(LCD_SSI_BASE)); // finish any transmission
+ GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, 0);
+
+ // Transmit data
+ SSIDataPut(LCD_SSI_BASE, command);
+ while (SSIBusy(LCD_SSI_BASE)); // finish transmission
+
+ // Set back to data mode
+ GPIOPinWrite(LCD_DC_BASE, LCD_DC_PIN, LCD_DC_PIN);
+}
+
+
+//*****************************************************************************
+//
+// Writes a data to the CFAF128128B-0145T. This function implements the basic SPI
+// interface to the LCD display.
+//
+//*****************************************************************************
+void HAL_LCD_writeData(uint8_t data)
+{
+ // Transmit data
+ SSIDataPut(LCD_SSI_BASE, data); // returns before data finishes transmitting
+}
diff --git a/HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h b/HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h
new file mode 100644
index 0000000..7eb6542
--- /dev/null
+++ b/HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h
@@ -0,0 +1,101 @@
+/* --COPYRIGHT--,BSD
+ * Copyright (c) 2015, Texas Instruments Incorporated
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * * Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * * Neither the name of Texas Instruments Incorporated nor the names of
+ * its contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+ * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+ * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
+ * EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ * --/COPYRIGHT--*/
+//*****************************************************************************
+//
+// HAL_EK_TM4C1294XL_Crystalfontz128x128_ST7735.h -
+// Hardware abstraction layer for using the Educational Boosterpack's
+// Crystalfontz128x128 LCD with EK-TM4C1294XL LaunchPad
+//
+// Ported by Gene Bogdanov 8/30/2017
+//
+//*****************************************************************************
+
+#ifndef __HAL_EK_TM4C1294XL_CRYSTALFONTZLCD_H_
+#define __HAL_EK_TM4C1294XL_CRYSTALFONTZLCD_H_
+
+#include
+#include "driverlib/sysctl.h"
+
+//*****************************************************************************
+//
+// User Configuration for the LCD Driver
+//
+//*****************************************************************************
+
+// System clock speed (in Hz)
+#define LCD_SYSTEM_CLOCK 120000000 // EK-TM4C1294XL at full speed
+// SPI clock speed (in Hz)
+#define LCD_SSI_CLOCK 15000000
+
+// Ports and pins from MCU connected to LCD (BOOSTXL-EDUMKII as BoosterPack 2 of EK-TM4C1294XL)
+// SCK
+#define LCD_SCK_PERIPH SYSCTL_PERIPH_GPIOQ
+#define LCD_SCK_BASE GPIO_PORTQ_BASE
+#define LCD_SCK_PIN GPIO_PIN_0
+#define LCD_SCK_CONFIG GPIO_PQ0_SSI3CLK
+// MOSI
+#define LCD_MOSI_PERIPH SYSCTL_PERIPH_GPIOQ
+#define LCD_MOSI_BASE GPIO_PORTQ_BASE
+#define LCD_MOSI_PIN GPIO_PIN_2
+#define LCD_MOSI_CONFIG GPIO_PQ2_SSI3XDAT0
+// RST
+#define LCD_RST_PERIPH SYSCTL_PERIPH_GPIOA
+#define LCD_RST_BASE GPIO_PORTA_BASE
+#define LCD_RST_PIN GPIO_PIN_7
+// CS
+#define LCD_CS_PERIPH SYSCTL_PERIPH_GPIOP
+#define LCD_CS_BASE GPIO_PORTP_BASE
+#define LCD_CS_PIN GPIO_PIN_3
+// DC (RS)
+#define LCD_DC_PERIPH SYSCTL_PERIPH_GPIOK
+#define LCD_DC_BASE GPIO_PORTK_BASE
+#define LCD_DC_PIN GPIO_PIN_7
+
+// SPI (SSI) configuration
+#define LCD_SSI_PERIPH SYSCTL_PERIPH_SSI3
+#define LCD_SSI_BASE SSI3_BASE
+#define LCD_SSI_PROTOCOL SSI_FRF_MOTO_MODE_0
+#define LCD_SSI_DATA_WIDTH 8 // bits
+
+//*****************************************************************************
+//
+// Prototypes for the globals exported by this driver.
+//
+//*****************************************************************************
+extern void HAL_LCD_writeCommand(uint8_t command);
+extern void HAL_LCD_writeData(uint8_t data);
+extern void HAL_LCD_PortInit(void);
+extern void HAL_LCD_SpiInit(void);
+
+#define HAL_LCD_delay(x) SysCtlDelay((x) * 40) // delay in us
+
+#endif /* __HAL_EK_TM4C1294XL_CRYSTALFONTZLCD_H_ */
diff --git a/buttons.c b/buttons.c
new file mode 100644
index 0000000..3a80581
--- /dev/null
+++ b/buttons.c
@@ -0,0 +1,168 @@
+/*
+ * buttons.c
+ *
+ * Created on: Aug 12, 2012, modified 9/8/2017
+ * Author: Gene Bogdanov
+ *
+ * ECE 3849 Lab button handling
+ */
+#include
+#include
+#include
+#include "inc/hw_memmap.h"
+#include "inc/hw_ints.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/gpio.h"
+#include "driverlib/timer.h"
+#include "driverlib/interrupt.h"
+#include "driverlib/adc.h"
+#include "sysctl_pll.h"
+#include "buttons.h"
+
+// public globals
+volatile uint32_t gButtons = 0; // debounced button state, one per bit in the lowest bits
+ // button is pressed if its bit is 1, not pressed if 0
+uint32_t gJoystick[2] = {0}; // joystick coordinates
+uint32_t gADCSamplingRate; // [Hz] actual ADC sampling rate
+
+// imported globals
+extern uint32_t gSystemClock; // [Hz] system clock frequency
+extern volatile uint32_t gTime; // time in hundredths of a second
+
+// initialize all button and joystick handling hardware
+void ButtonInit(void)
+{
+ // initialize a general purpose timer for periodic interrupts
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0);
+ TimerDisable(TIMER0_BASE, TIMER_BOTH);
+ TimerConfigure(TIMER0_BASE, TIMER_CFG_PERIODIC);
+ TimerLoadSet(TIMER0_BASE, TIMER_A, roundf((float)gSystemClock / BUTTON_SCAN_RATE) - 1);
+ TimerIntEnable(TIMER0_BASE, TIMER_TIMA_TIMEOUT);
+ TimerEnable(TIMER0_BASE, TIMER_BOTH);
+
+ // initialize interrupt controller to respond to timer interrupts
+ IntPrioritySet(INT_TIMER0A, BUTTON_INT_PRIORITY);
+ IntEnable(INT_TIMER0A);
+ /*
+ // GPIO PJ0 and PJ1 = EK-TM4C1294XL buttons 1 and 2
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ);
+ GPIOPinTypeGPIOInput(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1);
+ GPIOPadConfigSet(GPIO_PORTJ_BASE, GPIO_PIN_0 | GPIO_PIN_1, GPIO_STRENGTH_2MA, GPIO_PIN_TYPE_STD_WPU);
+
+ // analog input AIN13, at GPIO PD2 = BoosterPack Joystick HOR(X)
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD);
+ GPIOPinTypeADC(GPIO_PORTD_BASE, GPIO_PIN_2);
+ // analog input AIN17, at GPIO PK1 = BoosterPack Joystick VER(Y)
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOK);
+ GPIOPinTypeADC(GPIO_PORTK_BASE, GPIO_PIN_1);
+
+ // initialize ADC0 peripheral
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
+ uint32_t pll_frequency = SysCtlFrequencyGet(CRYSTAL_FREQUENCY);
+ uint32_t pll_divisor = (pll_frequency - 1) / (16 * ADC_SAMPLING_RATE) + 1; // round divisor up
+ gADCSamplingRate = pll_frequency / (16 * pll_divisor); // actual sampling rate may differ from ADC_SAMPLING_RATE
+ ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_FULL, pll_divisor); // only ADC0 has PLL clock divisor control
+
+ // initialize ADC sampling sequence
+ ADCSequenceDisable(ADC0_BASE, 0);
+ ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
+ ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH13); // Joystick HOR(X)
+ ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH17 | ADC_CTL_IE | ADC_CTL_END); // Joystick VER(Y)
+ ADCSequenceEnable(ADC0_BASE, 0);
+ */
+}
+
+// update the debounced button state gButtons
+void ButtonDebounce(uint32_t buttons)
+{
+ int32_t i, mask;
+ static int32_t state[BUTTON_COUNT]; // button state: 0 = released
+ // BUTTON_PRESSED_STATE = pressed
+ // in between = previous state
+ for (i = 0; i < BUTTON_COUNT; i++) {
+ mask = 1 << i;
+ if (buttons & mask) {
+ state[i] += BUTTON_STATE_INCREMENT;
+ if (state[i] >= BUTTON_PRESSED_STATE) {
+ state[i] = BUTTON_PRESSED_STATE;
+ gButtons |= mask; // update debounced button state
+ }
+ }
+ else {
+ state[i] -= BUTTON_STATE_DECREMENT;
+ if (state[i] <= 0) {
+ state[i] = 0;
+ gButtons &= ~mask;
+ }
+ }
+ }
+}
+
+// sample joystick and convert to button presses
+void ButtonReadJoystick(void)
+{
+ ADCProcessorTrigger(ADC0_BASE, 0); // trigger the ADC sample sequence for Joystick X and Y
+ while(!ADCIntStatus(ADC0_BASE, 0, false)); // wait until the sample sequence has completed
+ ADCSequenceDataGet(ADC0_BASE, 0, gJoystick);// retrieve joystick data
+ ADCIntClear(ADC0_BASE, 0); // clear ADC sequence interrupt flag
+
+ // process joystick movements as button presses using hysteresis
+ if (gJoystick[0] > JOYSTICK_UPPER_PRESS_THRESHOLD) gButtons |= 1 << 5; // joystick right in position 5
+ if (gJoystick[0] < JOYSTICK_UPPER_RELEASE_THRESHOLD) gButtons &= ~(1 << 5);
+
+ if (gJoystick[0] < JOYSTICK_LOWER_PRESS_THRESHOLD) gButtons |= 1 << 6; // joystick left in position 6
+ if (gJoystick[0] > JOYSTICK_LOWER_RELEASE_THRESHOLD) gButtons &= ~(1 << 6);
+
+ if (gJoystick[1] > JOYSTICK_UPPER_PRESS_THRESHOLD) gButtons |= 1 << 7; // joystick up in position 7
+ if (gJoystick[1] < JOYSTICK_UPPER_RELEASE_THRESHOLD) gButtons &= ~(1 << 7);
+
+ if (gJoystick[1] < JOYSTICK_LOWER_PRESS_THRESHOLD) gButtons |= 1 << 8; // joystick down in position 8
+ if (gJoystick[1] > JOYSTICK_LOWER_RELEASE_THRESHOLD) gButtons &= ~(1 << 8);
+}
+
+// autorepeat button presses if a button is held long enough
+uint32_t ButtonAutoRepeat(void)
+{
+ static int count[BUTTON_AND_JOYSTICK_COUNT] = {0}; // autorepeat counts
+ int i;
+ uint32_t mask;
+ uint32_t presses = 0;
+ for (i = 0; i < BUTTON_AND_JOYSTICK_COUNT; i++) {
+ mask = 1 << i;
+ if (gButtons & mask)
+ count[i]++; // increment count if button is held
+ else
+ count[i] = 0; // reset count if button is let go
+ if (count[i] >= BUTTON_AUTOREPEAT_INITIAL &&
+ (count[i] - BUTTON_AUTOREPEAT_INITIAL) % BUTTON_AUTOREPEAT_NEXT == 0)
+ presses |= mask; // register a button press due to auto-repeat
+ }
+ return presses;
+}
+
+// ISR for scanning and debouncing buttons
+void ButtonISR(void) {
+ TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // clear interrupt flag
+ /*
+ // read hardware button state
+ uint32_t gpio_buttons =
+ ~GPIOPinRead(GPIO_PORTJ_BASE, 0xff) & (GPIO_PIN_1 | GPIO_PIN_0); // EK-TM4C1294XL buttons in positions 0 and 1
+
+ uint32_t old_buttons = gButtons; // save previous button state
+ ButtonDebounce(gpio_buttons); // Run the button debouncer. The result is in gButtons.
+ ButtonReadJoystick(); // Convert joystick state to button presses. The result is in gButtons.
+ uint32_t presses = ~old_buttons & gButtons; // detect button presses (transitions from not pressed to pressed)
+ presses |= ButtonAutoRepeat(); // autorepeat presses if a button is held long enough
+ */
+ static bool tic = false;
+ static bool running = true;
+ /*
+ if (presses & 1) { // EK-TM4C1294XL button 1 pressed
+ running = !running;
+ }
+ */
+ if (running) {
+ if (tic) gTime++; // increment time every other ISR call
+ tic = !tic;
+ }
+}
diff --git a/buttons.h b/buttons.h
new file mode 100644
index 0000000..376321d
--- /dev/null
+++ b/buttons.h
@@ -0,0 +1,55 @@
+/*
+ * buttons.h
+ *
+ * Created on: Aug 12, 2012, modified 9/8/2017
+ * Author: Gene Bogdanov
+ *
+ * Button debouncer, calibrated for 200 samples/sec.
+ */
+
+#ifndef BUTTONS_H_
+#define BUTTONS_H_
+
+#include
+
+#define BUTTON_COUNT 5 // number of buttons excluding joystick directions
+#define BUTTON_AND_JOYSTICK_COUNT 9 // number of buttons including joystick directions
+#define BUTTON_SAMPLES_PRESSED 2 // number of samples before a button is considered pressed
+#define BUTTON_SAMPLES_RELEASED 5 // number of samples before a button is considered released
+// counter value indicating button pressed state
+#define BUTTON_PRESSED_STATE (BUTTON_SAMPLES_RELEASED*BUTTON_SAMPLES_PRESSED)
+#define BUTTON_STATE_INCREMENT (BUTTON_PRESSED_STATE/BUTTON_SAMPLES_PRESSED)
+#define BUTTON_STATE_DECREMENT (BUTTON_PRESSED_STATE/BUTTON_SAMPLES_RELEASED)
+
+#define BUTTON_SCAN_RATE 200 // [Hz] button scanning interrupt rate
+#define BUTTON_INT_PRIORITY 32 // button interrupt priority (higher number is lower priority)
+
+#define BUTTON_AUTOREPEAT_INITIAL 100 // how many samples must read pressed before autorepeat starts
+#define BUTTON_AUTOREPEAT_NEXT 10 // how many samples must read pressed before the next repetition
+
+#define JOYSTICK_UPPER_PRESS_THRESHOLD 3595 // above this ADC value, button is pressed
+#define JOYSTICK_UPPER_RELEASE_THRESHOLD 3095 // below this ADC value, button is released
+#define JOYSTICK_LOWER_PRESS_THRESHOLD 500 // below this ADC value, button is pressed
+#define JOYSTICK_LOWER_RELEASE_THRESHOLD 1000 // above this ADC value, button is released
+
+#define ADC_SAMPLING_RATE 1000000 // [samples/sec] desired ADC sampling rate
+#define CRYSTAL_FREQUENCY 25000000 // [Hz] crystal oscillator frequency used to calculate clock rates
+
+extern volatile uint32_t gButtons; // debounced button state, one per bit in the lowest bits
+extern uint32_t gJoystick[2]; // joystick coordinates
+extern uint32_t gADCSamplingRate; // [Hz] actual ADC sampling rate
+
+// initialize all button and joystick handling hardware
+void ButtonInit(void);
+
+// update the debounced button state in the global variable gButtons
+// the input argument is a bitmap of raw button state from the hardware
+void ButtonDebounce(uint32_t buttons);
+
+// sample joystick and convert to button presses
+void ButtonReadJoystick(void);
+
+// autorepeat button presses if a button is held long enough
+uint32_t ButtonAutoRepeat(void);
+
+#endif /* BUTTONS_H_ */
diff --git a/main.c b/main.c
new file mode 100644
index 0000000..65cfcf2
--- /dev/null
+++ b/main.c
@@ -0,0 +1,59 @@
+/**
+ * main.c
+ *
+ * ECE 3849 Lab 0 Starter Project
+ * Gene Bogdanov 10/18/2017
+ *
+ * This version is using the new hardware for B2017: the EK-TM4C1294XL LaunchPad with BOOSTXL-EDUMKII BoosterPack.
+ *
+ */
+
+#include
+#include
+#include "driverlib/fpu.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/interrupt.h"
+#include "Crystalfontz128x128_ST7735.h"
+#include
+
+uint32_t gSystemClock; // [Hz] system clock frequency
+volatile uint32_t gTime = 8345; // time in hundredths of a second
+
+int main(void)
+{
+ IntMasterDisable();
+
+ // Enable the Floating Point Unit, and permit ISRs to use it
+ FPUEnable();
+ FPULazyStackingEnable();
+
+ // Initialize the system clock to 120 MHz
+ gSystemClock = SysCtlClockFreqSet(SYSCTL_XTAL_25MHZ | SYSCTL_OSC_MAIN | SYSCTL_USE_PLL | SYSCTL_CFG_VCO_480, 120000000);
+
+ Crystalfontz128x128_Init(); // Initialize the LCD display driver
+ Crystalfontz128x128_SetOrientation(LCD_ORIENTATION_UP); // set screen orientation
+
+ tContext sContext;
+ GrContextInit(&sContext, &g_sCrystalfontz128x128); // Initialize the grlib graphics context
+ GrContextFontSet(&sContext, &g_sFontFixed6x8); // select font
+
+ uint32_t time; // local copy of gTime
+ char str[50]; // string buffer
+ // full-screen rectangle
+ tRectangle rectFullScreen = {0, 0, GrContextDpyWidthGet(&sContext)-1, GrContextDpyHeightGet(&sContext)-1};
+
+ while (true) {
+ GrContextForegroundSet(&sContext, ClrBlack);
+ GrRectFill(&sContext, &rectFullScreen); // fill screen with black
+ time = gTime; // read shared global only once
+
+ uint32_t hundredths = time % 100;
+ uint32_t seconds = (time / 100) % 60;
+ uint32_t minutes = (time / (100 * 60));
+
+ snprintf(str, sizeof(str), "Time = %02u:%02u:%02u", minutes, seconds, hundredths); // convert time to string
+ GrContextForegroundSet(&sContext, ClrYellow); // yellow text
+ GrStringDraw(&sContext, str, /*length*/ -1, /*x*/ 0, /*y*/ 0, /*opaque*/ false);
+ GrFlush(&sContext); // flush the frame buffer to the LCD
+ }
+}
diff --git a/sysctl_pll.c b/sysctl_pll.c
new file mode 100644
index 0000000..d42264b
--- /dev/null
+++ b/sysctl_pll.c
@@ -0,0 +1,115 @@
+//*****************************************************************************
+//
+// sysctl.c - Driver for the system controller.
+//
+// Copyright (c) 2005-2015 Texas Instruments Incorporated. All rights reserved.
+// Software License Agreement
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the
+// distribution.
+//
+// Neither the name of Texas Instruments Incorporated nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Excerpt exporting the normally static function _SysCtlFrequencyGet.
+//
+//*****************************************************************************
+
+#include
+#include
+#include "inc/hw_ints.h"
+#include "inc/hw_nvic.h"
+#include "inc/hw_sysctl.h"
+#include "inc/hw_types.h"
+#include "inc/hw_flash.h"
+#include "driverlib/cpu.h"
+#include "driverlib/debug.h"
+#include "driverlib/interrupt.h"
+#include "driverlib/sysctl.h"
+
+//*****************************************************************************
+//
+// Calculate the system frequency from the register settings base on the
+// oscillator input.
+//
+//*****************************************************************************
+uint32_t SysCtlFrequencyGet(uint32_t ui32Xtal)
+{
+ uint32_t ui32Result;
+ uint_fast16_t ui16F1, ui16F2;
+ uint_fast16_t ui16PInt, ui16PFract;
+ uint_fast8_t ui8Q, ui8N;
+
+ //
+ // Extract all of the values from the hardware registers.
+ //
+ ui16PFract = ((HWREG(SYSCTL_PLLFREQ0) & SYSCTL_PLLFREQ0_MFRAC_M) >>
+ SYSCTL_PLLFREQ0_MFRAC_S);
+ ui16PInt = HWREG(SYSCTL_PLLFREQ0) & SYSCTL_PLLFREQ0_MINT_M;
+ ui8Q = (((HWREG(SYSCTL_PLLFREQ1) & SYSCTL_PLLFREQ1_Q_M) >>
+ SYSCTL_PLLFREQ1_Q_S) + 1);
+ ui8N = (((HWREG(SYSCTL_PLLFREQ1) & SYSCTL_PLLFREQ1_N_M) >>
+ SYSCTL_PLLFREQ1_N_S) + 1);
+
+ //
+ // Divide the crystal value by N.
+ //
+ ui32Xtal /= (uint32_t)ui8N;
+
+ //
+ // Calculate the multiplier for bits 9:5.
+ //
+ ui16F1 = ui16PFract / 32;
+
+ //
+ // Calculate the multiplier for bits 4:0.
+ //
+ ui16F2 = ui16PFract - (ui16F1 * 32);
+
+ //
+ // Get the integer portion.
+ //
+ ui32Result = ui32Xtal * (uint32_t)ui16PInt;
+
+ //
+ // Add first fractional bits portion(9:0).
+ //
+ ui32Result += (ui32Xtal * (uint32_t)ui16F1) / 32;
+
+ //
+ // Add the second fractional bits portion(4:0).
+ //
+ ui32Result += (ui32Xtal * (uint32_t)ui16F2) / 1024;
+
+ //
+ // Divide the result by Q.
+ //
+ ui32Result = ui32Result / (uint32_t)ui8Q;
+
+ //
+ // Return the resulting PLL frequency.
+ //
+ return(ui32Result);
+}
diff --git a/sysctl_pll.h b/sysctl_pll.h
new file mode 100644
index 0000000..68dccae
--- /dev/null
+++ b/sysctl_pll.h
@@ -0,0 +1,45 @@
+//*****************************************************************************
+//
+// sysctl.h - Prototypes for the system control driver.
+//
+// Copyright (c) 2005-2015 Texas Instruments Incorporated. All rights reserved.
+// Software License Agreement
+//
+// Redistribution and use in source and binary forms, with or without
+// modification, are permitted provided that the following conditions
+// are met:
+//
+// Redistributions of source code must retain the above copyright
+// notice, this list of conditions and the following disclaimer.
+//
+// Redistributions in binary form must reproduce the above copyright
+// notice, this list of conditions and the following disclaimer in the
+// documentation and/or other materials provided with the
+// distribution.
+//
+// Neither the name of Texas Instruments Incorporated nor the names of
+// its contributors may be used to endorse or promote products derived
+// from this software without specific prior written permission.
+//
+// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+//
+// Excerpt exporting the normally static function _SysCtlFrequencyGet.
+//
+//*****************************************************************************
+
+#ifndef SYSCTL_PLL_H_
+#define SYSCTL_PLL_H_
+
+uint32_t SysCtlFrequencyGet(uint32_t ui32Xtal);
+
+#endif /* SYSCTL_PLL_H_ */
diff --git a/targetConfigs/Tiva TM4C1294NCPDT.ccxml b/targetConfigs/Tiva TM4C1294NCPDT.ccxml
new file mode 100644
index 0000000..089403b
--- /dev/null
+++ b/targetConfigs/Tiva TM4C1294NCPDT.ccxml
@@ -0,0 +1,24 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/targetConfigs/readme.txt b/targetConfigs/readme.txt
new file mode 100644
index 0000000..af97b62
--- /dev/null
+++ b/targetConfigs/readme.txt
@@ -0,0 +1,9 @@
+The 'targetConfigs' folder contains target-configuration (.ccxml) files, automatically generated based
+on the device and connection settings specified in your project on the Properties > General page.
+
+Please note that in automatic target-configuration management, changes to the project's device and/or
+connection settings will either modify an existing or generate a new target-configuration file. Thus,
+if you manually edit these auto-generated files, you may need to re-apply your changes. Alternatively,
+you may create your own target-configuration file for this project and manage it manually. You can
+always switch back to automatic target-configuration management by checking the "Manage the project's
+target-configuration automatically" checkbox on the project's Properties > General page.
\ No newline at end of file
diff --git a/tm4c1294ncpdt.cmd b/tm4c1294ncpdt.cmd
new file mode 100644
index 0000000..ee18ce7
--- /dev/null
+++ b/tm4c1294ncpdt.cmd
@@ -0,0 +1,45 @@
+/******************************************************************************
+ *
+ * Default Linker Command file for the Texas Instruments TM4C1294NCPDT
+ *
+ * This is derived from revision 15071 of the TivaWare Library.
+ *
+ *****************************************************************************/
+
+--retain=g_pfnVectors
+
+MEMORY
+{
+ FLASH (RX) : origin = 0x00000000, length = 0x00100000
+ SRAM (RWX) : origin = 0x20000000, length = 0x00040000
+}
+
+/* The following command line options are set as part of the CCS project. */
+/* If you are building using the command line, or for some reason want to */
+/* define them here, you can uncomment and modify these lines as needed. */
+/* If you are using CCS for building, it is probably better to make any such */
+/* modifications in your CCS project and leave this file alone. */
+/* */
+/* --heap_size=0 */
+/* --stack_size=256 */
+/* --library=rtsv7M4_T_le_eabi.lib */
+
+/* Section allocation in memory */
+
+SECTIONS
+{
+ .intvecs: > 0x00000000
+ .text : > FLASH
+ .const : > FLASH
+ .cinit : > FLASH
+ .pinit : > FLASH
+ .init_array : > FLASH
+
+ .vtable : > 0x20000000
+ .data : > SRAM
+ .bss : > SRAM
+ .sysmem : > SRAM
+ .stack : > SRAM
+}
+
+__STACK_TOP = __stack + 512;
diff --git a/tm4c1294ncpdt_startup_ccs.c b/tm4c1294ncpdt_startup_ccs.c
new file mode 100644
index 0000000..c1b28dd
--- /dev/null
+++ b/tm4c1294ncpdt_startup_ccs.c
@@ -0,0 +1,276 @@
+//*****************************************************************************
+//
+// Startup code for use with TI's Code Composer Studio.
+//
+// Copyright (c) 2011-2014 Texas Instruments Incorporated. All rights reserved.
+// Software License Agreement
+//
+// 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.
+//
+//*****************************************************************************
+
+#include
+
+//*****************************************************************************
+//
+// Forward declaration of the default fault handlers.
+//
+//*****************************************************************************
+void ResetISR(void);
+static void NmiSR(void);
+static void FaultISR(void);
+static void IntDefaultHandler(void);
+
+//*****************************************************************************
+//
+// External declaration for the reset handler that is to be called when the
+// processor is started
+//
+//*****************************************************************************
+extern void _c_int00(void);
+
+//*****************************************************************************
+//
+// Linker variable that marks the top of the stack.
+//
+//*****************************************************************************
+extern uint32_t __STACK_TOP;
+
+//*****************************************************************************
+//
+// External declarations for the interrupt handlers used by the application.
+//
+//*****************************************************************************
+// To be added by user
+
+
+//*****************************************************************************
+//
+// The vector table. Note that the proper constructs must be placed on this to
+// ensure that it ends up at physical address 0x0000.0000 or at the start of
+// the program if located at a start address other than 0.
+//
+//*****************************************************************************
+#pragma DATA_SECTION(g_pfnVectors, ".intvecs")
+void (* const g_pfnVectors[])(void) =
+{
+ (void (*)(void))((uint32_t)&__STACK_TOP),
+ // The initial stack pointer
+ ResetISR, // The reset handler
+ NmiSR, // The NMI handler
+ FaultISR, // The hard fault handler
+ IntDefaultHandler, // The MPU fault handler
+ IntDefaultHandler, // The bus fault handler
+ IntDefaultHandler, // The usage fault handler
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ 0, // Reserved
+ IntDefaultHandler, // SVCall handler
+ IntDefaultHandler, // Debug monitor handler
+ 0, // Reserved
+ IntDefaultHandler, // The PendSV handler
+ IntDefaultHandler, // The SysTick handler
+ IntDefaultHandler, // GPIO Port A
+ IntDefaultHandler, // GPIO Port B
+ IntDefaultHandler, // GPIO Port C
+ IntDefaultHandler, // GPIO Port D
+ IntDefaultHandler, // GPIO Port E
+ IntDefaultHandler, // UART0 Rx and Tx
+ IntDefaultHandler, // UART1 Rx and Tx
+ IntDefaultHandler, // SSI0 Rx and Tx
+ IntDefaultHandler, // I2C0 Master and Slave
+ IntDefaultHandler, // PWM Fault
+ IntDefaultHandler, // PWM Generator 0
+ IntDefaultHandler, // PWM Generator 1
+ IntDefaultHandler, // PWM Generator 2
+ IntDefaultHandler, // Quadrature Encoder 0
+ IntDefaultHandler, // ADC Sequence 0
+ IntDefaultHandler, // ADC Sequence 1
+ IntDefaultHandler, // ADC Sequence 2
+ IntDefaultHandler, // ADC Sequence 3
+ IntDefaultHandler, // Watchdog timer
+ IntDefaultHandler, // Timer 0 subtimer A
+ IntDefaultHandler, // Timer 0 subtimer B
+ IntDefaultHandler, // Timer 1 subtimer A
+ IntDefaultHandler, // Timer 1 subtimer B
+ IntDefaultHandler, // Timer 2 subtimer A
+ IntDefaultHandler, // Timer 2 subtimer B
+ IntDefaultHandler, // Analog Comparator 0
+ IntDefaultHandler, // Analog Comparator 1
+ IntDefaultHandler, // Analog Comparator 2
+ IntDefaultHandler, // System Control (PLL, OSC, BO)
+ IntDefaultHandler, // FLASH Control
+ IntDefaultHandler, // GPIO Port F
+ IntDefaultHandler, // GPIO Port G
+ IntDefaultHandler, // GPIO Port H
+ IntDefaultHandler, // UART2 Rx and Tx
+ IntDefaultHandler, // SSI1 Rx and Tx
+ IntDefaultHandler, // Timer 3 subtimer A
+ IntDefaultHandler, // Timer 3 subtimer B
+ IntDefaultHandler, // I2C1 Master and Slave
+ IntDefaultHandler, // CAN0
+ IntDefaultHandler, // CAN1
+ IntDefaultHandler, // Ethernet
+ IntDefaultHandler, // Hibernate
+ IntDefaultHandler, // USB0
+ IntDefaultHandler, // PWM Generator 3
+ IntDefaultHandler, // uDMA Software Transfer
+ IntDefaultHandler, // uDMA Error
+ IntDefaultHandler, // ADC1 Sequence 0
+ IntDefaultHandler, // ADC1 Sequence 1
+ IntDefaultHandler, // ADC1 Sequence 2
+ IntDefaultHandler, // ADC1 Sequence 3
+ IntDefaultHandler, // External Bus Interface 0
+ IntDefaultHandler, // GPIO Port J
+ IntDefaultHandler, // GPIO Port K
+ IntDefaultHandler, // GPIO Port L
+ IntDefaultHandler, // SSI2 Rx and Tx
+ IntDefaultHandler, // SSI3 Rx and Tx
+ IntDefaultHandler, // UART3 Rx and Tx
+ IntDefaultHandler, // UART4 Rx and Tx
+ IntDefaultHandler, // UART5 Rx and Tx
+ IntDefaultHandler, // UART6 Rx and Tx
+ IntDefaultHandler, // UART7 Rx and Tx
+ IntDefaultHandler, // I2C2 Master and Slave
+ IntDefaultHandler, // I2C3 Master and Slave
+ IntDefaultHandler, // Timer 4 subtimer A
+ IntDefaultHandler, // Timer 4 subtimer B
+ IntDefaultHandler, // Timer 5 subtimer A
+ IntDefaultHandler, // Timer 5 subtimer B
+ IntDefaultHandler, // FPU
+ 0, // Reserved
+ 0, // Reserved
+ IntDefaultHandler, // I2C4 Master and Slave
+ IntDefaultHandler, // I2C5 Master and Slave
+ IntDefaultHandler, // GPIO Port M
+ IntDefaultHandler, // GPIO Port N
+ 0, // Reserved
+ IntDefaultHandler, // Tamper
+ IntDefaultHandler, // GPIO Port P (Summary or P0)
+ IntDefaultHandler, // GPIO Port P1
+ IntDefaultHandler, // GPIO Port P2
+ IntDefaultHandler, // GPIO Port P3
+ IntDefaultHandler, // GPIO Port P4
+ IntDefaultHandler, // GPIO Port P5
+ IntDefaultHandler, // GPIO Port P6
+ IntDefaultHandler, // GPIO Port P7
+ IntDefaultHandler, // GPIO Port Q (Summary or Q0)
+ IntDefaultHandler, // GPIO Port Q1
+ IntDefaultHandler, // GPIO Port Q2
+ IntDefaultHandler, // GPIO Port Q3
+ IntDefaultHandler, // GPIO Port Q4
+ IntDefaultHandler, // GPIO Port Q5
+ IntDefaultHandler, // GPIO Port Q6
+ IntDefaultHandler, // GPIO Port Q7
+ IntDefaultHandler, // GPIO Port R
+ IntDefaultHandler, // GPIO Port S
+ IntDefaultHandler, // SHA/MD5 0
+ IntDefaultHandler, // AES 0
+ IntDefaultHandler, // DES3DES 0
+ IntDefaultHandler, // LCD Controller 0
+ IntDefaultHandler, // Timer 6 subtimer A
+ IntDefaultHandler, // Timer 6 subtimer B
+ IntDefaultHandler, // Timer 7 subtimer A
+ IntDefaultHandler, // Timer 7 subtimer B
+ IntDefaultHandler, // I2C6 Master and Slave
+ IntDefaultHandler, // I2C7 Master and Slave
+ IntDefaultHandler, // HIM Scan Matrix Keyboard 0
+ IntDefaultHandler, // One Wire 0
+ IntDefaultHandler, // HIM PS/2 0
+ IntDefaultHandler, // HIM LED Sequencer 0
+ IntDefaultHandler, // HIM Consumer IR 0
+ IntDefaultHandler, // I2C8 Master and Slave
+ IntDefaultHandler, // I2C9 Master and Slave
+ IntDefaultHandler, // GPIO Port T
+ IntDefaultHandler, // Fan 1
+ 0, // Reserved
+};
+
+//*****************************************************************************
+//
+// This is the code that gets called when the processor first starts execution
+// following a reset event. Only the absolutely necessary set is performed,
+// after which the application supplied entry() routine is called. Any fancy
+// actions (such as making decisions based on the reset cause register, and
+// resetting the bits in that register) are left solely in the hands of the
+// application.
+//
+//*****************************************************************************
+void
+ResetISR(void)
+{
+ //
+ // Jump to the CCS C initialization routine. This will enable the
+ // floating-point unit as well, so that does not need to be done here.
+ //
+ __asm(" .global _c_int00\n"
+ " b.w _c_int00");
+}
+
+//*****************************************************************************
+//
+// This is the code that gets called when the processor receives a NMI. This
+// simply enters an infinite loop, preserving the system state for examination
+// by a debugger.
+//
+//*****************************************************************************
+static void
+NmiSR(void)
+{
+ //
+ // Enter an infinite loop.
+ //
+ while(1)
+ {
+ }
+}
+
+//*****************************************************************************
+//
+// This is the code that gets called when the processor receives a fault
+// interrupt. This simply enters an infinite loop, preserving the system state
+// for examination by a debugger.
+//
+//*****************************************************************************
+static void
+FaultISR(void)
+{
+ //
+ // Enter an infinite loop.
+ //
+ while(1)
+ {
+ }
+}
+
+//*****************************************************************************
+//
+// This is the code that gets called when the processor receives an unexpected
+// interrupt. This simply enters an infinite loop, preserving the system state
+// for examination by a debugger.
+//
+//*****************************************************************************
+static void
+IntDefaultHandler(void)
+{
+ //
+ // Go into an infinite loop.
+ //
+ while(1)
+ {
+ }
+}