File tree 7 files changed +5
-145
lines changed
7 files changed +5
-145
lines changed Original file line number Diff line number Diff line change 2
2
3
3
HardwareSerial Serial (1 ); /* 1st instance/slot */
4
4
5
- #ifdef ZPU15
6
-
7
- void HardwareSerial::begin_slow (const unsigned int baudrate) {
8
- REG (1 ) = BAUDRATEGEN (baudrate)|BIT (UARTEN);
9
- }
10
-
11
- void HardwareSerial::flush () {
12
- while (REG (1 ) & 4 );
13
- }
14
-
15
- size_t HardwareSerial::write (unsigned char c) {
16
- while ((REG (1 ) & 2 )==2 );
17
- REG (0 ) = c;
18
- return 1 ;
19
- }
20
-
21
- #else
22
-
23
5
void HardwareSerial::begin_slow (const unsigned int baudrate) {
24
6
REGISTER (ioslot,1 ) = BAUDRATEGEN (baudrate)|BIT (UARTEN);
25
7
}
26
8
27
9
size_t HardwareSerial::write (unsigned char c) {
28
10
while ((REGISTER (ioslot,1 ) & 2 )==2 );
29
11
REGISTER (ioslot,0 ) = c;
12
+ return 1 ;
30
13
}
31
-
32
-
33
- #endif
Original file line number Diff line number Diff line change 6
6
#include " Stream.h"
7
7
#include " Print.h"
8
8
9
- #ifdef ZPU15
10
- #include " BaseDevice.h"
11
-
12
- #define VENDOR_ZPUINO 0x08
13
- #define PRODUCT_ZPUINO_UART 0x11
14
-
15
- namespace ZPUino {
16
- };
17
-
18
- class HardwareSerial : public ZPUino ::BaseDevice, public Stream
19
- {
20
- private:
21
- public:
22
- HardwareSerial (uint8_t instance=0xff ): BaseDevice(instance) {}
23
-
24
- __attribute__ ((always_inline)) inline void begin (const unsigned int baudrate) {
25
- if (deviceBegin (VENDOR_ZPUINO, PRODUCT_ZPUINO_UART)==0 ) {
26
- if (__builtin_constant_p (baudrate)) {
27
- REG (1 ) = BAUDRATEGEN (baudrate) | BIT (UARTEN);
28
- } else {
29
- begin_slow (baudrate);
30
- }
31
- }
32
- }
33
- void begin_slow (const unsigned int baudrate);
34
-
35
- int available (void ) {
36
- return (REG (1 ) & 1 );
37
- }
38
-
39
- virtual int read (void ) {
40
- return REG (0 );
41
- }
42
-
43
- virtual void flush (void );
44
-
45
- size_t write (uint8_t c);
46
-
47
- virtual int peek () { return -1 ; }
48
-
49
- using Print::write; // pull in write(str) and write(buf, size) from Print
50
- private:
51
- unsigned int ioslot;
52
- };
53
-
54
- extern void serialEventRun (void ) __attribute__((weak));
55
-
56
- extern HardwareSerial Serial; /* 1st slot */
57
- extern HardwareSerial Serial1; /* 1st slot */
58
-
59
- #else
60
9
class HardwareSerial : public Stream
61
10
{
62
11
private:
@@ -94,6 +43,5 @@ class HardwareSerial: public Stream
94
43
extern void serialEventRun (void ) __attribute__((weak));
95
44
96
45
extern HardwareSerial Serial; /* 1st slot */
97
- #endif
98
46
99
47
#endif
Original file line number Diff line number Diff line change @@ -31,14 +31,8 @@ typedef volatile unsigned int* register_t;
31
31
32
32
#define REGISTER (SLOT , y ) *(volatile unsigned int*)(SLOT + (y<<2))
33
33
34
- #ifndef ZPU15
35
34
#define SPIBASE IO_SLOT(0)
36
35
#define INTRBASE IO_SLOT(4)
37
- #else
38
- #define SPIBASE IO_SLOT(4)
39
- #define INTRBASE IO_SLOT(0)
40
- #define SYSCTLBASE INTRBASE
41
- #endif
42
36
43
37
#define UARTBASE IO_SLOT(1)
44
38
#define GPIOBASE IO_SLOT(2)
Original file line number Diff line number Diff line change 1
1
##############################################################
2
- zpuino15_papilio_one500.name=ZPUino 1.5 on Papilio One (500) board
2
+ zpuino15_papilio_one500.name=ZPUino 2.0 on Papilio One (500) board
3
+ zpuino15_papilio_one500.boardid=0xa5010f00
3
4
zpuino15_papilio_one500.upload.protocol=zpuino-serial
4
5
zpuino15_papilio_one500.upload.maximum_size=27648
5
6
zpuino15_papilio_one500.upload.size_sections=all
@@ -11,5 +12,5 @@ zpuino15_papilio_one500.build.mcu=zpu
11
12
zpuino15_papilio_one500.build.ldscript=zpuelf.lds
12
13
zpuino15_papilio_one500.build.pins=standard
13
14
zpuino15_papilio_one500.build.toolchain=zpu
14
- zpuino15_papilio_one500.build.extra_flags=-D__ZPUINO_PAPILIO_ONE__ -DZPU15 -DBOARD_ID=0xA5010F00 -DBOARD_MEMORYSIZE=0x8000 -D__S3E_500__ -nostartfiles
15
- zpuino15_papilio_one500.build.extraSflags=-DBOARD_ID=0xA5010F00 -DZPU15
15
+ zpuino15_papilio_one500.build.extra_flags=-D__ZPUINO_PAPILIO_ONE__ -DZPU20 -DBOARD_ID=0xA5010F00 -DBOARD_MEMORYSIZE=0x8000 -D__S3E_500__ -nostartfiles
16
+ zpuino15_papilio_one500.build.extraSflags=-DBOARD_ID=0xA5010F00 -DZPU20
Original file line number Diff line number Diff line change 2
2
3
3
HardwareSerial Serial (1 ); /* 1st instance/slot */
4
4
5
- #ifdef ZPU15
6
-
7
5
void HardwareSerial::begin_slow (const unsigned int baudrate) {
8
6
REG (1 ) = BAUDRATEGEN (baudrate)|BIT (UARTEN);
9
7
}
@@ -17,17 +15,3 @@ size_t HardwareSerial::write(unsigned char c) {
17
15
REG (0 ) = c;
18
16
return 1 ;
19
17
}
20
-
21
- #else
22
-
23
- void HardwareSerial::begin_slow (const unsigned int baudrate) {
24
- REGISTER (ioslot,1 ) = BAUDRATEGEN (baudrate)|BIT (UARTEN);
25
- }
26
-
27
- size_t HardwareSerial::write (unsigned char c) {
28
- while ((REGISTER (ioslot,1 ) & 2 )==2 );
29
- REGISTER (ioslot,0 ) = c;
30
- }
31
-
32
-
33
- #endif
Original file line number Diff line number Diff line change 5
5
#include < zpuino-types.h>
6
6
#include " Stream.h"
7
7
#include " Print.h"
8
-
9
- #ifdef ZPU15
10
8
#include " BaseDevice.h"
11
9
12
10
#define VENDOR_ZPUINO 0x08
@@ -56,44 +54,4 @@ extern void serialEventRun(void) __attribute__((weak));
56
54
extern HardwareSerial Serial; /* 1st slot */
57
55
extern HardwareSerial Serial1; /* 1st slot */
58
56
59
- #else
60
- class HardwareSerial : public Stream
61
- {
62
- private:
63
- public:
64
- HardwareSerial (unsigned int b): ioslot(IO_SLOT(b)) {}
65
-
66
- __attribute__ ((always_inline)) inline void begin (const unsigned int baudrate) {
67
- if (__builtin_constant_p (baudrate)) {
68
- REGISTER (ioslot,1 ) = BAUDRATEGEN (baudrate) | BIT (UARTEN);
69
- } else {
70
- begin_slow (baudrate);
71
- }
72
- }
73
- void begin_slow (const unsigned int baudrate);
74
-
75
- int available (void ) {
76
- return (REGISTER (ioslot,1 ) & 1 );
77
- }
78
-
79
- virtual int read (void ) {
80
- return REGISTER (ioslot,0 );
81
- }
82
-
83
- virtual void flush (void ) {};
84
-
85
- size_t write (uint8_t c);
86
-
87
- virtual int peek () { return -1 ; }
88
-
89
- using Print::write; // pull in write(str) and write(buf, size) from Print
90
- private:
91
- unsigned int ioslot;
92
- };
93
-
94
- extern void serialEventRun (void ) __attribute__((weak));
95
-
96
- extern HardwareSerial Serial; /* 1st slot */
97
- #endif
98
-
99
57
#endif
Original file line number Diff line number Diff line change @@ -31,14 +31,9 @@ typedef volatile unsigned int* register_t;
31
31
32
32
#define REGISTER (SLOT , y ) *(volatile unsigned int*)(SLOT + (y<<2))
33
33
34
- #ifndef ZPU15
35
- #define SPIBASE IO_SLOT(0)
36
- #define INTRBASE IO_SLOT(4)
37
- #else
38
34
#define SPIBASE IO_SLOT(4)
39
35
#define INTRBASE IO_SLOT(0)
40
36
#define SYSCTLBASE INTRBASE
41
- #endif
42
37
43
38
#define UARTBASE IO_SLOT(1)
44
39
#define GPIOBASE IO_SLOT(2)
You can’t perform that action at this time.
0 commit comments