-
Notifications
You must be signed in to change notification settings - Fork 134
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[gpio] Refactor GPIO and Signal implementation #686
[gpio] Refactor GPIO and Signal implementation #686
Conversation
25f196f
to
e4370d0
Compare
e4370d0
to
9b3ede4
Compare
I did a simple test in each blink example:
While compile time does decrease a little, lbuild build is much much faster now. This is a good change! |
Nice! I will take a look at it later today. |
Maybe you also find a better way to encode the Gpio-peripheral-signal dependencies, dragging around the |
I might have found a usable way to avoid the ugly The gpio data would look like:
I will upload a small proof-of-concept for STM32 on my fork as soon as the F1 compiles. |
I am wondering if there is a problem with the STM32F1 alternate function configuration of this refactored version. For F1 the unspecialized version of |
@salkinium Proof-of-concept for removing the signal template template parameter: chris-durand@727fe18 |
Yes, that's great, I'm going to cherry pick that! You're right about the F1, the connect for unspecialized peripherals must not be empty. I'll do some more testing. |
It would need a one-line change in all the drivers with a connect method. I have only done it for the STM32 uart. Furthermore, the other platforms have to be adapted as well. Should I do it or will you? |
I'll work on it, also redo the AVR implementation to match. |
7e39919
to
88e4257
Compare
I've modified your prototype just a little to reduce data duplication, quite happy with this implementation. Kinda obvious in hindsight to use template specialization to code the triplet dependencies. Still very neat. |
d77c1f5
to
3b8ce49
Compare
823fdba
to
6a3c45f
Compare
a1691f6
to
0581eb6
Compare
This is ready to be merged, in case anyone wants to review this. |
0581eb6
to
aa2fc39
Compare
Just FYI: Today is the last day for review, I'll be merging this tonight, since I'll be busy with the release tomorrow. |
- Fewer files to generate and include - Signals without templates Co-authored-by: Christopher Durand <christopher.durand@rwth-aachen.de>
aa2fc39
to
c0aeaae
Compare
I'm merging this now. |
The STM32 GPIO classes are manually generated, which create a lot of code and a lot of files. This is particularly noticable on devices with many pins, both calls to
lbuild build
andscons
slow down significantly.Instead I'm moving all the pin specific data into one long file, and using a templated
GpioStatic
class to specialize with this data at compile time. This shows significantly faster generation and compile times. TheGpioConnector
class has been adapted for the changes with more used of modern C++ TMP features. I've also reworked the GpioUnused implementation sightly as a specialization of the GpioStatic class.I've also moved the STM32 external interrupt implementation into their own module with a new implementation based on
modm::inplace_function
. This makes a lot more sense than using EXTI via Gpios, since there are more event lines than just the GPIO ones. On AVRs the EXTI lines are coupled to the Gpios more strongly, so it stays like that.