+/EE445L

embedded systems

git clone https://git.julia.blue/+/EE445L

jspspikeAdded lab4 files99480b6

master
1.8 KiB47 linesraw
1// PortF.h
2// Runs on LM4F120/TM4C123
3// Simple GPIO on Port F.
4// Jonathan Valvano
5// September 20, 2018
6
7/* This example accompanies the book
8   "Embedded Systems: Real Time Interfacing to Arm Cortex M Microcontrollers",
9   ISBN: 978-1463590154, Jonathan Valvano, copyright (c) 2018
10 
11 Copyright 2018 by Jonathan W. Valvano, valvano@mail.utexas.edu
12    You may use, edit, run or distribute this file
13    as long as the above copyright notice remains
14 THIS SOFTWARE IS PROVIDED "AS IS".  NO WARRANTIES, WHETHER EXPRESS, IMPLIED
15 OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
16 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
17 VALVANO SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL,
18 OR CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
19 For more information about my classes, my research, and my books, see
20 http://users.ece.utexas.edu/~valvano/
21 */
22#ifndef _PORTFH_
23#define _PORTFH_
24#include <stdint.h>
25#define PF0       (*((volatile uint32_t *)0x40025004))
26#define PF1       (*((volatile uint32_t *)0x40025008))
27#define PF2       (*((volatile uint32_t *)0x40025010))
28#define PF3       (*((volatile uint32_t *)0x40025020))
29#define PF4       (*((volatile uint32_t *)0x40025040))
30#define SWITCHES  (*((volatile uint32_t *)0x40025044))
31#define SW1       0x10    // on the left side of the Launchpad board
32#define SW2       0x01    // on the right side of the Launchpad board
33#define RED       0x02
34#define BLUE      0x04
35#define GREEN     0x08
36// Initialize PortF switches and LEDs
37void PortF_Init(void);
38// read switches,
39// Bit4 and Bit0 are in negative logic
40// returns 0x00,0x01,0x10, or 0x11
41uint32_t PortF_Input(void);
42
43// Output to LEDs
44// LEDs on bits 1,2,3
45void PortF_Output(uint32_t data);
46#endif
47