-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPlatform.h
216 lines (171 loc) · 6.69 KB
/
Platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
#ifndef _PLATFORM_H_
#define _PLATFORM_H_
//Configure Eve's Clock (clock at 72 MHz makes things faster, but audio and video frame rates are off
//#define Set72MHzEveClock
//Antares uses a P2 smartpin in NCO mode to give clock to EVE3 chip in order to get TV and monitors to accept VGA/720p signals selected by the below
//Note: Eve sometimes gets stuck when switched from VGA to 720p
//Pick one: (see DisplaySettings.h)
//#define EVE3_720p
//#define EVE3_1080p
//#define EVE3_VGA
//#define EVE2_70 //7" WVGA LCD
#define EVE2_43 //4.3" LCD
//#define EVE2_50
//#define EVE2_39
//#define EVE2_38
//#define EVE2_35 //3.5" LCD
//#define EVE2_29
//Audio settings - Can use a cog to convert EVE's digital audio output to a P2 pin in DAC mode for use with, for example, Parallax P2 A/V Accessory board
//Use this define to invoke audio cog
#define ReflectEveAudio //comment this out to not use a cog for audio output
//Left output with A/V accessory board on basepin #8 is pin 8+6=14
#define ReflectEveAudioPin1 (8 + 6)
//Right output with A/V accessory board on basepin #8 is pin 8+7=15, set to -1 if not needed
#define ReflectEveAudioPin2 (8 + 7) //-1
//Backlight Setting
#define BacklightSetting 90 //0==Off, 128==Max.
//Touchscreen settings
//Really only need to do something special if have a resistive touch screen, then need to do calibration or load calibration from files
//But, some examples will make fake input if neither type of touchscreen is present
//#define ResistiveTouch
#define CapacitiveTouch
//Define this if want to use file system to save/restore resistive calibration settings
#define UseFilesForTouchCalibration //file=ResTouch.dat
//If using a different screen, may want to uncomment the below to force recalibration
//#define ForceTouchCalibration
//Note: For VGA, there other frequency options, but for 720p we need 297 MHz
#ifdef EVE3_VGA
enum { _clkfreq = 200000000 }; //Note: If you change this you must also change the NCO values to maintain 12 MHz output
#elif defined EVE3_720p
enum { _clkfreq = 297000000 };
#elif defined EVE2_70
enum { _clkfreq = 160000000 };
#elif defined EVE3_1080p
enum { _clkfreq = 237600000 }; //24 Hz
#endif
enum { heapsize = 16000 }; //override the default heapsize to give more, if needed
//Pick one of these board configs or add your own
#define P2Eval //P2 Eval to IDC adapter for Newhaven displays
//#define AntaresB
//#define Board1
//#define Dazzler
//P2 Eval board with Ray's Original IDC adapter
#ifdef P2Eval
#define basepin (16)
#define FT800_CS (basepin+5)
#define FT800_INT (basepin+7)
#define FT800_PD_N (basepin+6)
#define FT800_SEL_PIN FT800_CS
//RJA adding more pins
#define FT800_MOSI (basepin+0)
#define FT800_MISO (basepin+1)
#define FT800_CLK (basepin+4)
#define FT800_AUDIO (basepin+2)
//The Eval Board's uSD pins
#define uSD_MISO 58
#define uSD_MOSI 59
#define uSD_SS 60
#define uSD_CLK 61
#endif //P2Eval
//P2 Eval board with AntaresB
#ifdef AntaresB
#define basepin (0) //This is the starting pin on which the Antares-B adapter is situated
//Using this P2 pin to supply ~12 MHz clock to eve chip
#define NCOPIN (basepin+2)
#ifdef EVE3_VGA
#define NCOYPIN $4000_0000 //wypin value for NCO oscillator
#define NCOXPIN 4
#else
#define NCOYPIN $8000_0000 //wypin value for NCO oscillator
#define NCOXPIN 12
#endif
#define FT800_CS (basepin+5)
#define FT800_INT (basepin+7)
#define FT800_PD_N (basepin+6)
#define FT800_SEL_PIN FT800_CS
//RJA adding more pins
#define FT800_MOSI (basepin+0)
#define FT800_MISO (basepin+1)
#define FT800_CLK (basepin+4)
#define FT800_AUDIO -1 //don't have audio to P2
//The Eval Board's uSD pins
#define uSD_MISO 58
#define uSD_MOSI 59
#define uSD_SS 60
#define uSD_CLK 61
#endif
//RJA's P2 Board1 with EVE2 display
#ifdef Board1
#define FT800_CS (30)
#define FT800_INT (28)
#define FT800_PD_N (31)
#define FT800_SEL_PIN FT800_CS
#define FT800_MOSI (24)
#define FT800_MISO (25)
#define FT800_CLK (29)
#define uSD_MISO 44
#define uSD_MOSI 46
#define uSD_SS 47
#define uSD_CLK 45
#endif
//RJA's Arduino style P2 Board with Dazzler
#ifdef Dazzler
#define FT800_CS (50)
#define FT800_INT (36)
#define FT800_PD_N (-1)
#define FT800_SEL_PIN FT800_CS
#define FT800_MOSI (53)
#define FT800_MISO (54)
#define FT800_CLK (55)
#define Dazzler_CS (52)
#define DazzlerSD_CS (51)
#endif
//Pick one or none of these to say where files might come from
#define USE_SD
//#define USE_HOST
//Can we use USB with GD2 examples? Think stuff we need is in panels.h...
#ifdef AntaresB
//USB pin definitions for AntaresB
#define USB_BASE_PIN (basepin+3) //use AntaresB onboard LED for USB activity
#define USB_ENABLE_PIN -1 //not using a P2 pin to enable AntaresB USB
#define USB_DM_PIN (basepin+14) //USB is on +14 and +15
#define USB_ERR_LED_PIN 57 //Using P2 Eval board's P57 led for error display
#endif //AntaresB
#ifdef P2Eval
//USB pin definitions Parallax USB adapter board for P2 Eval Board
#define SERIAL_HOST_BASEPIN 32//24
#define USB_BASE_PIN (SERIAL_HOST_BASEPIN)
#define USB_ENABLE_PIN (SERIAL_HOST_BASEPIN+5) //+5 for lower port, +1 for upper port
#define USB_DM_PIN (SERIAL_HOST_BASEPIN+6) //USB is on +6 and +7 for lower port, +2 and +3 for upper port
#define USB_ERR_LED_PIN 57 //Using P2 Eval board's P57 led for error display
#endif //P2Eval
///* Threshold for resistance */
#define RESISTANCE_THRESHOLD (1200) //RJA: for resistive touch panels
//typedef boolean bool_t;
#define TRUE (1)
#define FALSE (0)
// override baud rate for serial, requires use of "_setbaud(_BAUD);" in code
#ifndef _BAUD
#define _BAUD 2000000
#endif
//Add in some needed includes here
#include "propeller2.h"
#include "stdio.h"
#include "stdlib.h"
#include "stdint.h"
#include "stdbool.h"
#include "DisplaySettings.h" //Settings for various types of displays are here,
//some types not yet defined in FlexSpin, or needed to translate Arduino code
typedef char byte;
typedef unsigned char uchar;
typedef char bool_t;
typedef char char8_t;
typedef unsigned char uchar8_t;
typedef unsigned char prog_uchar8_t;
typedef signed char schar8_t;
typedef float float_t;
//RJA: Seem to need this...
#define min(x,y) ((x) > (y) ? (y) : (x))
#define max(x,y) ((x) > (y) ? (x) : (y))
#endif /*_PLATFORM_H_*/
/* Nothing beyond this*/