Feat/new dual pwm#555
Merged
Merged
Conversation
jdmarmen
approved these changes
Feb 2, 2026
jorgecanut
pushed a commit
that referenced
this pull request
Feb 6, 2026
* PWM rework, now in HALAL/Services/PWM (not in pwm/pwm) * Add DualPWM implementation, deadtime might be wrong? * both timerpins must be pwm pins * fix timer_wrapper_test (hopefully) * fix stuff found wrong in pwm.hpp when making dualpwm.hpp * fix deadtime calculation * fix: Max pins per timer is 7
FoniksFox
added a commit
that referenced
this pull request
Feb 12, 2026
* It compiles the old version with constexpr * Draft of the new dma class * Minor change on where is the instance declared on dma.hpp * limpieza de funciones, enums y structs * feat: distintos inscribe definidos, no creo que sea lo mejor que se puede hacer * feat: mejor enfoque, pero no se si el correcto * feat: comprueba el numero de perifericos, cambios de nombre a algunas funcion y reorganizar un poco * feat: struct constructor, better is... logic, refactor inscribe (technically consteval), and a few more constexprs * algunas cosillas para que compile. falta conseguir pasarle las variables de los modulos al start * feat: agregar static a las variables constexpr * me lo quiero pasar al PC solamente, luego hago bien el commit * feat: agregar funciones que comprueban si el stream y la instancias ya estan siendo utilizadas * fuck constexpr, todo en runtime. feat: inscribe funciona, solo quedaria hacer el start * repartir entre archivos las funciones y hacer el start * feat: start completado, mejor estructura, todos los perifericos configurados * hacer funciones inline para que pueda compilar * adc inscribe_dma now working, moved dma implementations from cpp to hpp, fixed irqn function, and minor changes to inscribe_dma for legibility * Initial structure * no need to have an id for instance * erased no longer needed code * cambio de nombre al antiguo dma y empiezo con la nueva infraestructura compile-time * añadir funciones de configuracion del handle DMA * Added DigitalInput and DigitalOutput Services, and added support for Alternate functions * todo lo facil hecho, queda lo dificil (handle y global_handle) * entry, build e instances_ ahora se rigen por stream y no instancia (la cual se puede repetir). cambios en sus constructores y nuevo metodo (setDMAHandle) para poder pasar el handle desde el periferico * se me habia olvidado desreferenciar * modificar STLIB.hpp para meter el contexto de la DMA * throws comentados, una dma menos * It compiles the old version with constexpr * Draft of the new dma class * Minor change on where is the instance declared on dma.hpp * limpieza de funciones, enums y structs * feat: distintos inscribe definidos, no creo que sea lo mejor que se puede hacer * feat: mejor enfoque, pero no se si el correcto * feat: comprueba el numero de perifericos, cambios de nombre a algunas funcion y reorganizar un poco * feat: struct constructor, better is... logic, refactor inscribe (technically consteval), and a few more constexprs * algunas cosillas para que compile. falta conseguir pasarle las variables de los modulos al start * feat: agregar static a las variables constexpr * me lo quiero pasar al PC solamente, luego hago bien el commit * feat: agregar funciones que comprueban si el stream y la instancias ya estan siendo utilizadas * fuck constexpr, todo en runtime. feat: inscribe funciona, solo quedaria hacer el start * repartir entre archivos las funciones y hacer el start * feat: start completado, mejor estructura, todos los perifericos configurados * hacer funciones inline para que pueda compilar * adc inscribe_dma now working, moved dma implementations from cpp to hpp, fixed irqn function, and minor changes to inscribe_dma for legibility * Initial structure * cambio de nombre al antiguo dma y empiezo con la nueva infraestructura compile-time * añadir funciones de configuracion del handle DMA * Added DigitalInput and DigitalOutput Services, and added support for Alternate functions * todo lo facil hecho, queda lo dificil (handle y global_handle) * entry, build e instances_ ahora se rigen por stream y no instancia (la cual se puede repetir). cambios en sus constructores y nuevo metodo (setDMAHandle) para poder pasar el handle desde el periferico * se me habia olvidado desreferenciar * modificar STLIB.hpp para meter el contexto de la DMA * eliminar que reciba el handle * eliminar que reciba el handle * sacar streams fuera del struct * el commit que se me olvido hacer para que poder testear * cambios para poder utilizar none y algunos errores corregidos, queda configurar interrupciones * ni me acuerdo, mañana sigo * debugging validacion * cmake cambiado para que se incluya la dma2.cpp * cambios finales, prueba funciona * ahora de verdad funciona * limpieza de rama p1 * limpieza de rama p2 * cambiar gpio para que el static assert me deje compilar * feat(SPI): First implementation with most of the infrastructure and hadware settings * feat(SPI): Baudrate prescaler calculation * feat(SPI): Add IRQ handlers and HAL callbacks * fix(SPI): Fix error spi number * fix(SPI): Callback handling * feat(SPI): Implement API for both Master and Slave * doc(SPI): Add tooltip comments * fix(SPI): Typo in ErrorHandler function name * fix(SPI): Move spi_instances declaration * fix(SPI): General syntax errror fixes * feat(SPI): Add SPI domain to ST-LIB * fix(SPI): Remove forgotten line * fix(SPI): General fixes to make it compile * fix(SPI): Forgot to set up max baudrate * feat(DMA): udpate inscribe method to return indices * feat(SPI): Add DMA linking * feat(SPI): Implement configuration API + some cleanup * fix(SPI): Update SPI in ST-LIB.hpp * feat(SPI): Make inscribe return size_t * automatic stream assignment (no tengo claro que vaya, lo probare con el adc) * fix(SPI): Fix compile_error * fix(SPI): Fix inscribe * minor sintaxis change * fix(SPI): Fix things * fix(SPI): Pin A15 AF were incorrect * fix(SPI): Fix instances array * feat(SPI): Add templated functions to acccept anything * fix(SPI): Alignments and correct frame calculations * feat(SPI): Add slave software nss interface * fix(GH_Actions): Don't upload build artifacts * multiple names fixed * build.yml * fix(ST-LIB): Missing comma (#556) * Feat/new dual pwm (#555) * PWM rework, now in HALAL/Services/PWM (not in pwm/pwm) * Add DualPWM implementation, deadtime might be wrong? * both timerpins must be pwm pins * fix timer_wrapper_test (hopefully) * fix stuff found wrong in pwm.hpp when making dualpwm.hpp * fix deadtime calculation * fix: Max pins per timer is 7 * Hotfix! fixed a bug with a strange case when getting an overflow (#560) * Hotfix! fixed a bug with a strange case when getting an overflow of global_timer_us_ (overflow of 32 bits) * fix scheduler tests * fixed set_timer_frequency (#562) * fixed set_timer_frequency... Now doesn't need to set_duty_cycle for any other pwms from the same timer (does it automatically) * Add pwm_frequency as a pointer too, add get_frequency and get_duty_cycle to PWM * Make set_pwm_frequency, set_timer_frequency templated * Add extra parens * remove unused param in PWM configure * Add check for <= 0.0f duty_cycle and > 100.0f * Durisimo este error * Add inline and unlikely to clamping in set_duty_cycle * PWM fix and pin::start * Update GPIO initialization logic for NOT_USED mode Refactor GPIO initialization for NOT_USED mode. --------- Co-authored-by: Cantonplas <dcancat@etsinf.upv.es> Co-authored-by: Daniel Cantó Catalán <144663567+Cantonplas@users.noreply.github.com> * funcionando con la antigua dma * adc en teoria funcional, aun no he probado * fix(SPI): Fix merge things * fix(HardFault): Include string.h so that it can compile * fix(SPI): Fix merge, now works * fix(DMA): Missing spi6 * fix: General small things * Added mocks and tests * Added more tests --------- Co-authored-by: Cantonplas <dcancat@etsinf.upv.es> Co-authored-by: Jorge <jorgecaru3@gmail.com> Co-authored-by: Jorge Sáez <jorgeesg82@gmail.com> Co-authored-by: Víctor López <120128034+victor-Lopez25@users.noreply.github.com> Co-authored-by: Daniel Cantó Catalán <144663567+Cantonplas@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New dualpwm abstraction that uses timerdomain instead of timerperipheral.
Example usage:
This is a bit annoying to program, but I will change this after when changing the abstraction on pwm (it will be a similar abstraction).
You must select pins that have the same channel - negated channel for a single timer, I suggest searching for a match in
timerdomain.hppmacros