Proposal: Introduce shutdownPeripherals in NRF52Board to prepare for shutdown#2906
Proposal: Introduce shutdownPeripherals in NRF52Board to prepare for shutdown#2906fdlamotte wants to merge 1 commit into
Conversation
|
@fdlamotte It is fine for me as long as powerOff() will call shutdownPeripherals(). In some boards, we have to shutdown the GPS, LoRa PA by sleep code before we set the EN to LOW (or something like that). With shutdownPeripherals, it will become Yes, I think shutdownPeripherals() is very helpful if some friends may want to off all LEDs, GPS... but still keep the board powered on to save power. |
|
That's the idea @IoTThinks, but the way you made things didn't work because once NRF52Board::powerOff is called there is no instruction executed after as the MCU is stopped So with what you did (and yes it was necessary to shut down peripherals correctly before closing the gates) the gates were not closed because the instructions to close them were not executed. That's why I've introduced shutdownPeripherals, to permit the variant to do their own stuff (as closing gates such as |
you can't call The idea is to let the variant write their own |
|
I see the bug now. yes, then shutdownPeripherals() is a good idea. I still like the idea to off everything just by 1 command _board.powerOff(). |
|
in this PR, shutdownPeripheral is called by poweroff, so from the application point of view you only have to do powerOff shutdownPeripherals is just a stub to put the shutdown code apart of powering off the cpu |
|
This PR is great for me. |
Following #2895 which solved poweroff issues from repeater commandline on some variants (T-Echo is one of them) I wondered about the construct where poweroff in the variant was called before shutting down the specific peripherals of the boards
Obviously this specific shutdown code was never reached and I thing this was placed after the call to shutdown because it's mainly peripheral gating in there and it cuts power from some peripherals that are shut down in the
powerofffunction. In this case, the gates should be closed after the peripherals are correctly downMy idea is to add a
shutdownPeripheralsfunction, ideally the variants should overload this one instead ofpoweroffwhich calls it. This way one can let generic shutdown happen and then do specific shutdown to a board before CPU shutdown.@ripplebiz @IoTThinks what do you think ?
shutdownPeripheralscould even be promoted toMainBoardI think but I just wanted to illustrate the idea and keep the PR simple