core: arduino: add ShiftIn/ShiftOut implementation #395
core: arduino: add ShiftIn/ShiftOut implementation #395KurtE wants to merge 1 commit intoarduino:mainfrom
Conversation
b000b78 to
b67d0f4
Compare
b67d0f4 to
f0289a9
Compare
|
Thanks @KurtE I've force pushed your changes to make the ci happy. |
c376871 to
569d86d
Compare
|
Thanks |
pillo79
left a comment
There was a problem hiding this comment.
Thanks @KurtE, but we would like to avoid including LGPL licensed code directly in the main core. Even though the final license of any Arduino build is always LGPL, the "core" itself is Apache2 and this would be the first incompatible bit.
The implementation of shiftIn/shiftOut should be rewritten from scratch to make this viable for inclusion. Would you like to give it a try? 🤗
Sorry, not sure how things like that would apply, as for example my hands are dirty, so not sure what writing from Maybe you could just copy in the version from renesas_uno, which does not say anything? So no idea what license that code has. The complete shift.cpp EDIT: Looks like that whole project has MIT License... Only one of your cores which are Apache2 are your |
|
I will see about hacking up a different version... Although hard to say I can come up with an original version 😉 |
163da03 to
6a04768
Compare
pillo79
left a comment
There was a problem hiding this comment.
Thank you for the code and test! I suggest one trivial fix, but LGTM! 🙂
cores/arduino/wiring_shift.cpp
Outdated
| @@ -0,0 +1,50 @@ | |||
| /* | |||
| * Copyright (c) Arduino s.r.l. and/or its affiliated companies | |||
There was a problem hiding this comment.
Use your name (or alias, if you prefer)... it's your work! 😉
There was a problem hiding this comment.
Could do, but is there any way to mark it as Copyright, everyone who has ever shifted in or out a byte ;)
There was a problem hiding this comment.
However now the test for licenses fail...
cores/arduino/wiring_shift.cpp
Outdated
| @@ -0,0 +1,50 @@ | |||
| /* | |||
| * Copyright (c) KurtE | |||
There was a problem hiding this comment.
It seems the name is too short for it to be reliably detected by scancode. Black magic.
Can you please try this alternative? (the tag is case sensitive)
| * Copyright (c) KurtE | |
| * SPDX-FileCopyrightText: Copyright (c) KurtE |
(or try adding the year?).
cores/arduino/wiring_shift.cpp
Outdated
| @@ -0,0 +1,49 @@ | |||
| /* | |||
| * SPDX-FileCopyrightText: Copyright (c) KurtE | |||
There was a problem hiding this comment.
Did a few tests locally. It appears if you add SPDX-FileCopyrightText: then you do NOT have to add Copyright. But it does require the year. So confusing! 🤷♂️
I have tested this works:
* Copyright (c) 2026 KurtE
(there is also * SPDX-FileCopyrightText: 2026 KurtE, but it isn't used anywhere else in the repo, so I'd prefer the above one).
Sorry about this flurry of changes!
ShiftIn and ShiftOut different than MBED version.
Built
|
| Artifact | Board | Core | Tests | RAM | Sketches | Warnings | Errors |
|---|---|---|---|---|---|---|---|
✅ zephyr_contrib |
ek_ra8d1
| 📗 | ✅ |
11.9% |
2 | - | - |
frdm_mcxn947
| 3 🏷️ | ✅ |
58.0% |
2 | - | - | |
frdm_rw612
| 1 🏷️ | ✅ |
83.0% |
2 | - | - | |
✔️* zephyr_main |
giga
| 4 🏷️ | ✅* |
54.5% |
44 | 8 | - |
nano33ble
| 1 🏷️ | ✅* |
78.7% |
22 | 8 | - | |
nano_matter
| 📗 | ✔️* |
|
20 | 8 | (2*) | |
niclasense
| 2 🏷️ | ✅* |
|
20 | 8 | - | |
opta
| 4 🏷️ | ✔️* |
46.7% |
54 | 8 | (2*) | |
portentac33
| 3 🏷️ | ✔️* |
|
56 | 8 | (8*) | |
portentah7
| 3 🏷️ | ✔️* |
47.3% |
58 | 8 | (2*) | |
✅* zephyr_unoq |
unoq
| 📗 | ✅* |
26.4% |
62 | 8 | - |
Legend
Board Test Status description 🔥 🔥 Test run failed to complete. ❌ 🔴 Test completed with unexpected errors. ✔️* 🚫 Test completed with errors, but all are known/expected. ✅* 🟡 Test completed with some warnings; no errors detected. ✅ 🟢 Test passed successfully, with no warnings or errors. 🌑 🌑 Test was skipped.

resolves: #345
Note: I simply copied in the MBED version of this. The APIS were already contained within the header files.
Verified that the sketch within the issue built.
Modified it to verify that worked at all:
Built and ran on UnoQ with current sources as of this morning.

It has the same possible issue as the MBED version in that the faster the processor, the narrower the pulses are:

I know in the case of Teensy 4.x boards, they put in possible delays, but that could be looked at later if needed.