Skip to content
This repository was archived by the owner on Jun 13, 2023. It is now read-only.

Commit 33e9c99

Browse files
committed
Merge branch 'pr/31'
Conflicts: hardware/zpuino/zpu20/cores/zpuino/board_papilio_pro.h hardware/zpuino/zpu20/cores/zpuino/delay.cpp libraries/Servo/library.properties libraries/Servo/src/Servo.h
2 parents 4b5be11 + 13b45f1 commit 33e9c99

File tree

15 files changed

+894
-120
lines changed

15 files changed

+894
-120
lines changed

hardware/zpuino/zpu20/cores/zpuino/board_papilio_one.h

+109
Original file line numberDiff line numberDiff line change
@@ -297,4 +297,113 @@
297297
#define WING_C_14 FPGA_PIN_P16
298298
#define WING_C_15 FPGA_PIN_P17
299299

300+
//Wing 1 Column A
301+
#define WA0 0
302+
#define WA1 1
303+
#define WA2 2
304+
#define WA3 3
305+
#define WA4 4
306+
#define WA5 5
307+
#define WA6 6
308+
#define WA7 7
309+
#define WA8 8
310+
#define WA9 9
311+
#define WA10 10
312+
#define WA11 11
313+
#define WA12 12
314+
#define WA13 13
315+
#define WA14 14
316+
#define WA15 15
317+
318+
//Wing 1 Column B
319+
#define WB0 16 //This doesn't work for some reason!
320+
#define WB1 17
321+
#define WB2 18
322+
#define WB3 19
323+
#define WB4 20
324+
#define WB5 21
325+
#define WB6 22
326+
#define WB7 23
327+
#define WB8 24
328+
#define WB9 25
329+
#define WB10 26
330+
#define WB11 27
331+
#define WB12 28
332+
#define WB13 29
333+
#define WB14 30
334+
#define WB15 31
335+
336+
//Wing 2 Column C
337+
#define WC0 32
338+
#define WC1 33
339+
#define WC2 34
340+
#define WC3 35
341+
#define WC4 36
342+
#define WC5 37
343+
#define WC6 38
344+
#define WC7 39
345+
#define WC8 40
346+
#define WC9 41
347+
#define WC10 42
348+
#define WC11 43
349+
#define WC12 44
350+
#define WC13 45
351+
#define WC14 46
352+
#define WC15 47
353+
354+
// ******** Define AH/AL syntax
355+
//Wing 1 Column A
356+
#define WAL0 0
357+
#define WAL1 1
358+
#define WAL2 2
359+
#define WAL3 3
360+
#define WAL4 4
361+
#define WAL5 5
362+
#define WAL6 6
363+
#define WAL7 7
364+
#define WAH0 8
365+
#define WAH1 9
366+
#define WAH2 10
367+
#define WAH3 11
368+
#define WAH4 12
369+
#define WAH5 13
370+
#define WAH6 14
371+
#define WAH7 15
372+
373+
//Wing 1 Column B
374+
#define WBL0 16 //This doesn't work for some reason!
375+
#define WBL1 17
376+
#define WBL2 18
377+
#define WBL3 19
378+
#define WBL4 20
379+
#define WBL5 21
380+
#define WBL6 22
381+
#define WBL7 23
382+
#define WBH0 24
383+
#define WBH1 25
384+
#define WBH2 26
385+
#define WBH3 27
386+
#define WBH4 28
387+
#define WBH5 29
388+
#define WBH6 30
389+
#define WBH7 31
390+
391+
//Wing 2 Column C
392+
#define WCL0 32
393+
#define WCL1 33
394+
#define WCL2 34
395+
#define WCL3 35
396+
#define WCL4 36
397+
#define WCL5 37
398+
#define WCL6 38
399+
#define WCL7 39
400+
#define WCH0 40
401+
#define WCH1 41
402+
#define WCH2 42
403+
#define WCH3 43
404+
#define WCH4 44
405+
#define WCH5 45
406+
#define WCH6 46
407+
#define WCH7 47
408+
300409
#endif

hardware/zpuino/zpu20/cores/zpuino/board_papilio_pro.h

-52
Original file line numberDiff line numberDiff line change
@@ -135,58 +135,6 @@
135135
#define WING_C_14 FPGA_PIN_P16
136136
#define WING_C_15 FPGA_PIN_P17
137137

138-
139-
#define WING_AL0 0
140-
#define WING_AL1 1
141-
#define WING_AL2 2
142-
#define WING_AL3 3
143-
#define WING_AL4 4
144-
#define WING_AL5 5
145-
#define WING_AL6 6
146-
#define WING_AL7 7
147-
#define WING_AH0 8
148-
#define WING_AH1 9
149-
#define WING_AH2 10
150-
#define WING_AH3 11
151-
#define WING_AH4 12
152-
#define WING_AH5 13
153-
#define WING_AH6 14
154-
#define WING_AH7 15
155-
156-
#define WING_BL0 16
157-
#define WING_BL1 17
158-
#define WING_BL2 18
159-
#define WING_BL3 19
160-
#define WING_BL4 20
161-
#define WING_BL5 21
162-
#define WING_BL6 22
163-
#define WING_BL7 23
164-
#define WING_BH0 24
165-
#define WING_BH1 25
166-
#define WING_BH2 26
167-
#define WING_BH3 27
168-
#define WING_BH4 28
169-
#define WING_BH5 29
170-
#define WING_BH6 30
171-
#define WING_BH7 31
172-
173-
#define WING_CL0 32
174-
#define WING_CL1 33
175-
#define WING_CL2 34
176-
#define WING_CL3 35
177-
#define WING_CL4 36
178-
#define WING_CL5 37
179-
#define WING_CL6 38
180-
#define WING_CL7 39
181-
#define WING_CH0 40
182-
#define WING_CH1 41
183-
#define WING_CH2 42
184-
#define WING_CH3 43
185-
#define WING_CH4 44
186-
#define WING_CH5 45
187-
#define WING_CH6 46
188-
#define WING_CH7 47
189-
190138
//Wing 1 Column A
191139
#define WA0 0
192140
#define WA1 1

hardware/zpuino/zpu20/cores/zpuino/delay.cpp

+7-10
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
void delayCycles(unsigned int cycles)
44
{
5-
unsigned int current = TIMERTSC;
6-
unsigned int next = current + cycles;
7-
/* This might overflow. We assume cycles is less than 2^30 */
8-
if (next<current) {
9-
while (TIMERTSC&0x80000000) {} // Wait for timer to roll over
10-
}
5+
unsigned int current = TIMERTSC;
6+
unsigned int next = current + cycles;
7+
/* This might overflow. We assume cycles is less than 2^30 */
8+
if (next<current) {
9+
while (TIMERTSC&0x80000000) {} // Wait for timer to roll over
10+
}
1111

12-
while (TIMERTSC<next) {}
12+
while (TIMERTSC<next) {}
1313
}
1414

1515
static unsigned lastMillis = 0;
@@ -24,9 +24,6 @@ unsigned int millis(void) {
2424
return addMillis + currentMillis;
2525
}
2626

27-
/* unsigned int millis(void) {
28-
return TIMERTSC / clocksPerMilisecond;
29-
} */
3027
unsigned int micros(void) {
3128
return TIMERTSC / clocksPerMicrosecond;
3229
}

hardware/zpuino/zpu20/cores/zpuino/register.h

+3
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,9 @@ typedef volatile unsigned int* register_t;
9191
#define TMR0CMP REGISTER(TIMERSBASE,2)
9292
#define TIMERTSC REGISTER(TIMERSBASE,3)
9393

94+
#define MILLISL REGISTER(TIMERSBASE,4)
95+
#define MILLISH REGISTER(TIMERSBASE,5)
96+
9497
// PWM for timer 0
9598
#define TMR0PWMLOW(x) REGISTER(TIMERSBASE, 32+(4*x))
9699
#define TMR0PWMHIGH(x) REGISTER(TIMERSBASE, 33+(4*x))

hardware/zpuino/zpu20/cores/zpuino/zposix.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ int fstat(int fd, struct stat *buf)
188188
{
189189
int ret = -1;
190190
if (__fds[fd].ops) {
191-
if (__fds[fd].ops->read) {
191+
if (__fds[fd].ops->fstat) {
192192
ret = __fds[fd].ops->fstat(__fds[fd].data,buf);
193193
}
194194
}

hardware/zpuino/zpu20/cores/zpuino/zstdio.c

+3-2
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,9 @@ FILE *fdopen(int fd, const char *mode)
242242

243243
int fseek(FILE *stream, long offset, int whence)
244244
{
245-
UNIMPLEMENTED();
246-
return -1;
245+
if (!stream || stream->fd<0)
246+
return -1;
247+
return lseek(stream->fd,offset,whence);
247248
}
248249
long ftell(FILE *stream)
249250
{

0 commit comments

Comments
 (0)