+/EE445L
embedded systems
git clone https://git.julia.blue/+/EE445L
c12dcba
master
1// LED.h 2// Runs on TM4C123 3// Provide functions that initialize a GPIO as an input pin and 4// allow reading of two negative logic switches on PF0 and PF4 5 6// Use bit-banded I/O. 7// Daniel and Jonathan Valvano 8// Feb 23, 2015 9 10/* This example accompanies the book 11"Embedded Systems: Introduction to ARM Cortex M Microcontrollers", 12ISBN: 978-1469998749, Jonathan Valvano, copyright (c) 2014 13Section 4.2 Program 4.2 14 15"Embedded Systems: Real Time Interfacing to ARM Cortex M Microcontrollers", 16ISBN: 978-1463590154, Jonathan Valvano, copyright (c) 2014 17Example 2.3, Program 2.9, Figure 2.36 18 19Copyright 2015 by Jonathan W. Valvano, valvano@mail.utexas.edu 20You may use, edit, run or distribute this file 21as long as the above copyright notice remains 22THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED 23OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF 24MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE. 25VALVANO SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, 26OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER. 27For more information about my classes, my research, and my books, see 28http://users.ece.utexas.edu/~valvano/ 29*/ 30#include <stdint.h> 31 32//------------LED_Init------------ 33// Initialize GPIO Port F for negative logic switches on PF0 and 34// PF4 as the Launchpad is wired. Weak internal pull-up 35// resistors are enabled, and the NMI functionality on PF0 is disabled. 36// LEDs on PF3,2,1 are enabled 37// Input: none 38// Output: none 39void LED_Init (void ); 40 41//------------Board_Input------------ 42// Read and return the status of the switches. 43// Input: none 44// Output: 2 if only Switch 1 is pressed 45// 1 if only Switch 2 is pressed 46// 3 if both switches are pressed 47// 0 if no switches are pressed 48uint32_t Board_Input (void ); 49 50//------------LED_RedOn------------ 51// Turn on red LED 52// Input: none 53// Output: none 54void LED_RedOn (void ); 55 56//------------LED_RedOff------------ 57// Turn off red LED 58// Input: none 59// Output: none 60void LED_RedOff (void ); 61 62//------------LED_RedToggle------------ 63// Toggle redv LED 64// Input: none 65// Output: none 66void LED_RedToggle (void ); 67 68//------------LED_BlueToggle------------ 69// Toggle blue LED 70// Input: none 71// Output: none 72void LED_BlueToggle (void ); 73 74//------------LED_GreenToggle------------ 75// Toggle green LED 76// Input: none 77// Output: none 78void LED_GreenToggle (void ); 79 80//------------LED_GreenOn------------ 81// Turn on green LED 82// Input: none 83// Output: none 84void LED_GreenOn (void ); 85 86//------------LED_GreenOff------------ 87// Turn off green LED 88// Input: none 89// Output: none 90void LED_GreenOff (void );