summaryrefslogtreecommitdiff
path: root/boards/dk-tm4c129x/hello/hello.c
diff options
context:
space:
mode:
authorYuval Adam <yuv.adm@gmail.com>2014-06-29 12:34:32 +0300
committerYuval Adam <yuv.adm@gmail.com>2014-06-29 12:34:32 +0300
commitc3e4c9a25c2910d2d66d52215b3406b13d5b23d5 (patch)
treeadded370d1e356901f8579f076e3263fb0464db7 /boards/dk-tm4c129x/hello/hello.c
parent990090a4cc9070837d31e66b58d40f0c3d038741 (diff)
Add more board models
Diffstat (limited to 'boards/dk-tm4c129x/hello/hello.c')
-rw-r--r--boards/dk-tm4c129x/hello/hello.c118
1 files changed, 118 insertions, 0 deletions
diff --git a/boards/dk-tm4c129x/hello/hello.c b/boards/dk-tm4c129x/hello/hello.c
new file mode 100644
index 0000000..3c51b72
--- /dev/null
+++ b/boards/dk-tm4c129x/hello/hello.c
@@ -0,0 +1,118 @@
+//*****************************************************************************
+//
+// hello.c - Simple hello world example.
+//
+// Copyright (c) 2013-2014 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.0.12573 of the DK-TM4C129X Firmware Package.
+//
+//*****************************************************************************
+
+#include <stdbool.h>
+#include <stdint.h>
+#include "driverlib/rom.h"
+#include "driverlib/rom_map.h"
+#include "driverlib/sysctl.h"
+#include "grlib/grlib.h"
+#include "drivers/frame.h"
+#include "drivers/kentec320x240x16_ssd2119.h"
+#include "drivers/pinout.h"
+
+//*****************************************************************************
+//
+//! \addtogroup example_list
+//! <h1>Hello World (hello)</h1>
+//!
+//! A very simple ``hello world'' example. It simply displays ``Hello World!''
+//! on the display and is a starting point for more complicated applications.
+//! This example uses calls to the TivaWare Graphics Library graphics
+//! primitives functions to update the display. For a similar example using
+//! widgets, please see ``hello_widget''.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// The error routine that is called if the driver library encounters an error.
+//
+//*****************************************************************************
+#ifdef DEBUG
+void
+__error__(char *pcFilename, uint32_t ui32Line)
+{
+}
+#endif
+
+//*****************************************************************************
+//
+// Print "Hello World!" to the display on the Intelligent Display Module.
+//
+//*****************************************************************************
+int
+main(void)
+{
+ tContext sContext;
+ uint32_t ui32SysClock;
+
+ //
+ // Run from the PLL at 120 MHz.
+ //
+ ui32SysClock = MAP_SysCtlClockFreqSet((SYSCTL_XTAL_25MHZ |
+ SYSCTL_OSC_MAIN | SYSCTL_USE_PLL |
+ SYSCTL_CFG_VCO_480), 120000000);
+
+ //
+ // Configure the device pins.
+ //
+ PinoutSet();
+
+ //
+ // Initialize the display driver.
+ //
+ Kentec320x240x16_SSD2119Init(ui32SysClock);
+
+ //
+ // Initialize the graphics context.
+ //
+ GrContextInit(&sContext, &g_sKentec320x240x16_SSD2119);
+
+ //
+ // Draw the application frame.
+ //
+ FrameDraw(&sContext, "hello");
+
+ //
+ // Say hello using the Computer Modern 40 point font.
+ //
+ GrContextFontSet(&sContext, g_psFontCm40);
+ GrStringDrawCentered(&sContext, "Hello World!", -1,
+ GrContextDpyWidthGet(&sContext) / 2,
+ ((GrContextDpyHeightGet(&sContext) - 32) / 2) + 24,
+ 0);
+
+ //
+ // Flush any cached drawing operations.
+ //
+ GrFlush(&sContext);
+
+ //
+ // We are finished. Hang around doing nothing.
+ //
+ while(1)
+ {
+ }
+}