You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-16Lines changed: 15 additions & 16 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -97,22 +97,21 @@ There is no Analog Pin definition such as A0. Just use 11, 14, 15, or 32 for the
97
97
98
98
### No polymorph functions:
99
99
100
-
There is no free C++ compiler for MCS51 chip, we can not use polymorph functions. So you can not expect the compiler will choose a function according to the parameter's type.
101
-
102
-
The biggest difference may be the ```Serial.print``` function. Here is what you should do in CH55xduino
103
-
104
-
| datatype | Print on USB | Println on USB | Print on UART0 | Println on UART0 |
| int with base | USBSerial\_print\_ub(P,Q) | USBSerial\_println\_ub(P,Q) | Serial0\_print\_ub(P,Q) | Serial0\_println\_ub(P,Q) |
114
-
115
-
They are defined in ```Arduino.h```.
100
+
There is no free C++ compiler for MCS51 chip, we can not use polymorph functions. However, since commit 13402 of SDCC, the generic selection is functional. Ch55xduino supports generic selection since 0.0.11.
101
+
102
+
If you are using a version higher than 0.0.11, the print function can choose a function according to the parameter's type.
103
+
104
+
For example. If you want to print to the USB-CDC virtual serial port, you can do:
105
+
106
+
```
107
+
USBSerial_print(val); //val: the value to print - any data type
108
+
USBSerial_print(val, format) //specifies the number base (for integral data types) or number of decimal places (for floating point types)
109
+
USBSerial_print(charPointer, length) //specifies the string length to be printed
110
+
```
111
+
112
+
It is also possible to do ``` USBSerial_println ```. If you want to print to Serial0 or Serial1, just use ``` Serial0_print ``` or ``` Serial1_print ```.
113
+
114
+
They are defined in ```genericPrintSelection.h```.
0 commit comments