drivers/periph/rtt: enhancements to make RTT_FREQUENCY easily configurable#13874
drivers/periph/rtt: enhancements to make RTT_FREQUENCY easily configurable#13874fjmolinas wants to merge 6 commits intoRIOT-OS:masterfrom
Conversation
This adds the following defines that must be present in all RTT configurations: - RTT_CLOCK_FREQUENCY - RTT_MAX_FREQUENCY - RTT_MIN_FREQUENCY Since RTT_REQUENCY is based on a prescaled value of RTT_CLOCK_FREQUENCY valid values RTT_CLOCK_FREQUENCY % RTT_FREQUENCY = 0. It also enforces RTT_MAX_VALUE to be defined.
|
I think that makes a lot of sense! |
Should have tagged it as wip since I didn't adapt all rtt yet, will do now. |
Adds: RTT_MAX_FREQUENCY, RTT_MIN_FREQUENCY & RTT_CLOCK_FREQUENCY
I could also just remove the error messages for now. |
|
I don't think you have to update all RTT implementations in one go/PR. |
Ok, I think that makes sense. I had started looking into different From what I've seen from other
|
Contribution description
This PR wants to make
RTT_FREQUENCYeasily configurable. CurrentlyRTT_FREQUENCYis for most platforms a fixed value, I would like to be easily configurable at compile time.I looked at most
rttimplementations and in most casesRTT_FREQUENCYwould be a a prescaled value of the clock source . Therefore I think aminandmaxvalue should be enough to map all possible values forRTT_FREQUENCY.I added a
RTT_CLOCK_FREQUENCYto make the clock source transparent, also useful for deriving prescaler values from the desiredRTT_FREQUENCY.I also force
RTT_MAX_VALUEto be defined for all platforms.I migrated all
stm32f1to implement the required values. I'm willing to do the same for all otherrttconfigurations if the global change makes sense.Testing procedure
tests/periph_rttshould still pass onstm32f1boards with different frequenciesBOARD=iotlab-m3 make -C tests/periph_rtt flash test --no-print-directory -j3CFLAGS+=-DRTT_FREQUENCY=1 BOARD=iotlab-m3 make -C tests/periph_rtt clean flash test --no-print-directory -j3RTT_FREQUENCYare checked at compile time:Issues/PRs references