1 |
581 |
jeremybenn |
//*****************************************************************************
|
2 |
|
|
//
|
3 |
|
|
// pdc.h - Stellaris development board Peripheral Device Controller definitions
|
4 |
|
|
// and prototypes.
|
5 |
|
|
//
|
6 |
|
|
// Copyright (c) 2005,2006 Luminary Micro, Inc. All rights reserved.
|
7 |
|
|
//
|
8 |
|
|
// Software License Agreement
|
9 |
|
|
//
|
10 |
|
|
// Luminary Micro, Inc. (LMI) is supplying this software for use solely and
|
11 |
|
|
// exclusively on LMI's Stellaris Family of microcontroller products.
|
12 |
|
|
//
|
13 |
|
|
// The software is owned by LMI and/or its suppliers, and is protected under
|
14 |
|
|
// applicable copyright laws. All rights are reserved. Any use in violation
|
15 |
|
|
// of the foregoing restrictions may subject the user to criminal sanctions
|
16 |
|
|
// under applicable laws, as well as to civil liability for the breach of the
|
17 |
|
|
// terms and conditions of this license.
|
18 |
|
|
//
|
19 |
|
|
// THIS SOFTWARE IS PROVIDED "AS IS". NO WARRANTIES, WHETHER EXPRESS, IMPLIED
|
20 |
|
|
// OR STATUTORY, INCLUDING, BUT NOT LIMITED TO, IMPLIED WARRANTIES OF
|
21 |
|
|
// MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE APPLY TO THIS SOFTWARE.
|
22 |
|
|
// LMI SHALL NOT, IN ANY CIRCUMSTANCES, BE LIABLE FOR SPECIAL, INCIDENTAL, OR
|
23 |
|
|
// CONSEQUENTIAL DAMAGES, FOR ANY REASON WHATSOEVER.
|
24 |
|
|
//
|
25 |
|
|
// This is part of revision 635 of the Stellaris Driver Library.
|
26 |
|
|
//
|
27 |
|
|
//*****************************************************************************
|
28 |
|
|
|
29 |
|
|
#ifndef __PDC_H__
|
30 |
|
|
#define __PDC_H__
|
31 |
|
|
|
32 |
|
|
#ifdef __cplusplus
|
33 |
|
|
extern "C"
|
34 |
|
|
{
|
35 |
|
|
#endif
|
36 |
|
|
|
37 |
|
|
//*****************************************************************************
|
38 |
|
|
//
|
39 |
|
|
// The registers within the peripheral device controller.
|
40 |
|
|
//
|
41 |
|
|
//*****************************************************************************
|
42 |
|
|
#define PDC_VER 0x0 // Version register
|
43 |
|
|
#define PDC_CSR 0x1 // Command/Status register
|
44 |
|
|
#define PDC_DSW 0x4 // DIP Switch register
|
45 |
|
|
#define PDC_LED 0x5 // LED register
|
46 |
|
|
#define PDC_LCD_CSR 0x6 // LCD Command/Status register
|
47 |
|
|
#define PDC_LCD_RAM 0x7 // LCD RAM register
|
48 |
|
|
#define PDC_GPXDAT 0x8 // GPIO X Data register
|
49 |
|
|
#define PDC_GPXDIR 0x9 // GPIO X Direction register
|
50 |
|
|
#define PDC_GPYDAT 0xA // GPIO Y Data register
|
51 |
|
|
#define PDC_GPYDIR 0xB // GPIO Y Direction register
|
52 |
|
|
#define PDC_GPZDAT 0xC // GPIO Z Data register
|
53 |
|
|
#define PDC_GPZDIR 0xD // GPIO Z Direction register
|
54 |
|
|
|
55 |
|
|
//*****************************************************************************
|
56 |
|
|
//
|
57 |
|
|
// Flags indicating a read or write to the peripheral device controller.
|
58 |
|
|
//
|
59 |
|
|
//*****************************************************************************
|
60 |
|
|
#define PDC_RD 0x80 // PDC read command
|
61 |
|
|
#define PDC_WR 0x00 // PDC write command
|
62 |
|
|
|
63 |
|
|
//*****************************************************************************
|
64 |
|
|
//
|
65 |
|
|
// LCD panel (Crystalfontz CFAH1602B) commands, RS = 0
|
66 |
|
|
//
|
67 |
|
|
//*****************************************************************************
|
68 |
|
|
#define LCD_CLEAR 0x01 // Clear display (0 fill DDRAM).
|
69 |
|
|
#define LCD_HOME 0x02 // Cursor home.
|
70 |
|
|
#define LCD_MODE 0x04 // Set entry mode (cursor dir)
|
71 |
|
|
#define LCD_ON 0x08 // Set display, cursor, blinking
|
72 |
|
|
// on/off
|
73 |
|
|
#define LCD_CUR 0x10 // Cursor, display shift
|
74 |
|
|
#define LCD_IF 0x20 // Set interface data length,
|
75 |
|
|
// lines, font
|
76 |
|
|
#define LCD_CGADDR 0x40 // Set CGRAM AC address
|
77 |
|
|
#define LCD_DDADDR 0x80 // Set DDRAM AC address
|
78 |
|
|
|
79 |
|
|
//*****************************************************************************
|
80 |
|
|
//
|
81 |
|
|
// LCD Status bit
|
82 |
|
|
//
|
83 |
|
|
//*****************************************************************************
|
84 |
|
|
#define LCD_B_BUSY 0x80 // Busy flag.
|
85 |
|
|
|
86 |
|
|
//*****************************************************************************
|
87 |
|
|
//
|
88 |
|
|
// The GPIO port A pin numbers for the various SSI signals.
|
89 |
|
|
//
|
90 |
|
|
//*****************************************************************************
|
91 |
|
|
#define SSI_CS GPIO_PIN_3
|
92 |
|
|
#define PDC_CS GPIO_PIN_3
|
93 |
|
|
#define SSI_CLK GPIO_PIN_2
|
94 |
|
|
#define SSI_TX GPIO_PIN_5
|
95 |
|
|
#define SSI_RX GPIO_PIN_4
|
96 |
|
|
|
97 |
|
|
//*****************************************************************************
|
98 |
|
|
//
|
99 |
|
|
// Function Prototypes
|
100 |
|
|
//
|
101 |
|
|
//*****************************************************************************
|
102 |
|
|
extern void PDCInit(void);
|
103 |
|
|
extern unsigned char PDCRead(unsigned char ucAddr);
|
104 |
|
|
extern void PDCWrite(unsigned char ucAddr, unsigned char ucData);
|
105 |
|
|
extern unsigned char PDCDIPRead(void);
|
106 |
|
|
extern void PDCLEDWrite(unsigned char ucLED);
|
107 |
|
|
extern unsigned char PDCLEDRead(void);
|
108 |
|
|
extern void PDCLCDInit(void);
|
109 |
|
|
extern void PDCLCDBacklightOn(void);
|
110 |
|
|
extern void PDCLCDBacklightOff(void);
|
111 |
|
|
extern void PDCLCDClear(void);
|
112 |
|
|
extern void PDCLCDCreateChar(unsigned char ucChar, unsigned char *pucData);
|
113 |
|
|
extern void PDCLCDSetPos(unsigned char ucX, unsigned char ucY);
|
114 |
|
|
extern void PDCLCDWrite(const char *pcStr, unsigned long ulCount);
|
115 |
|
|
extern unsigned char PDCGPIODirRead(unsigned char ucIdx);
|
116 |
|
|
extern void PDCGPIODirWrite(unsigned char ucIdx, unsigned char ucValue);
|
117 |
|
|
extern unsigned char PDCGPIORead(unsigned char ucIdx);
|
118 |
|
|
extern void PDCGPIOWrite(unsigned char ucIdx, unsigned char ucValue);
|
119 |
|
|
|
120 |
|
|
#ifdef __cplusplus
|
121 |
|
|
}
|
122 |
|
|
#endif
|
123 |
|
|
|
124 |
|
|
#endif // __PDC_H__
|