diff options
| author | Yuval Adam <yuv.adm@gmail.com> | 2014-06-29 12:34:32 +0300 |
|---|---|---|
| committer | Yuval Adam <yuv.adm@gmail.com> | 2014-06-29 12:34:32 +0300 |
| commit | c3e4c9a25c2910d2d66d52215b3406b13d5b23d5 (patch) | |
| tree | added370d1e356901f8579f076e3263fb0464db7 /boards/ek-tm4c123gxl/project0/project0.c | |
| parent | 990090a4cc9070837d31e66b58d40f0c3d038741 (diff) | |
Add more board models
Diffstat (limited to 'boards/ek-tm4c123gxl/project0/project0.c')
| -rw-r--r-- | boards/ek-tm4c123gxl/project0/project0.c | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/boards/ek-tm4c123gxl/project0/project0.c b/boards/ek-tm4c123gxl/project0/project0.c new file mode 100644 index 0000000..a0484c0 --- /dev/null +++ b/boards/ek-tm4c123gxl/project0/project0.c @@ -0,0 +1,114 @@ +//*****************************************************************************
+//
+// project0.c - Example to demonstrate minimal TivaWare setup
+//
+// Copyright (c) 2012-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 EK-TM4C123GXL Firmware Package.
+//
+//*****************************************************************************
+
+#include <stdint.h>
+#include <stdbool.h>
+#include "inc/hw_types.h"
+#include "inc/hw_memmap.h"
+#include "driverlib/sysctl.h"
+#include "driverlib/gpio.h"
+
+//*****************************************************************************
+//
+// Define pin to LED color mapping.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+//
+//! \addtogroup example_list
+//! <h1>Project Zero (project0)</h1>
+//!
+//! This example demonstrates the use of TivaWare to setup the clocks and
+//! toggle GPIO pins to make the LED's blink. This is a good place to start
+//! understanding your launchpad and the tools that can be used to program it.
+//! See http://www.ti.com/tm4c123g-launchpad/project0 for more information and
+//! tutorial videos.
+//
+//*****************************************************************************
+
+#define RED_LED GPIO_PIN_1
+#define BLUE_LED GPIO_PIN_2
+#define GREEN_LED GPIO_PIN_3
+
+//*****************************************************************************
+//
+// The error routine that is called if the driver library encounters an error.
+//
+//*****************************************************************************
+#ifdef DEBUG
+void
+__error__(char *pcFilename, uint32_t ui32Line)
+{
+}
+#endif
+
+//*****************************************************************************
+//
+// Main 'C' Language entry point. Toggle an LED using TivaWare.
+// See http://www.ti.com/tm4c123g-launchpad/project0 for more information and
+// tutorial videos.
+//
+//*****************************************************************************
+int
+main(void)
+{
+ //
+ // Setup the system clock to run at 50 Mhz from PLL with crystal reference
+ //
+ SysCtlClockSet(SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|
+ SYSCTL_OSC_MAIN);
+
+ //
+ // Enable and configure the GPIO port for the LED operation.
+ //
+ SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
+ GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED);
+
+ //
+ // Loop Forever
+ //
+ while(1)
+ {
+ //
+ // Turn on the LED
+ //
+ GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, RED_LED);
+
+ //
+ // Delay for a bit
+ //
+ SysCtlDelay(2000000);
+
+ //
+ // Turn on the LED
+ //
+ GPIOPinWrite(GPIO_PORTF_BASE, RED_LED|BLUE_LED|GREEN_LED, BLUE_LED);
+
+ //
+ // Delay for a bit
+ //
+ SysCtlDelay(2000000);
+ }
+}
|
