Skip to content

Conversation

@fschrempf
Copy link
Contributor

I was a bit disappointed to see the loads of duplicated code and seemingly nobody being bothered by the increasing amount of copy and paste when adding new hardware variants.

So I tried to "be the change I want to see" and started to deduplicate the NRF52 board code. Except for the last commit, these changes are intended to be purely refactoring and not change the functional behavior.

The last commit enables the DC/DC converter for the RAK4631 hardware. The documentation says that the DC/DC converter can be used and it was tested to decrease the power consumption significantly.

There is a lot of duplicated code for the NRF52 boards. Add a base
class for sharing.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
The reboot() method is the same for all NRF52 boards. Use a shared
implementation.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
Use a common begin() method that can be called from derived classes
to contain the shared initialization code.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
Some NRF52 boards are able to use the internal power-efficient DC/DC
regulator. Add a new class that can be inherited by board classes to
enable this feature and reduce the power consumption.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
The startOTAUpdate() is the same for all NRF52 boards. Use a common
implementation for all boards that currently have a specific
implementation.

The following boards currently have an empty startOTAUpdate() for
whatever reasons and therefore are not inheriting NRF52BoardOTA to
keep the same state: Nano G2 Ultra, Seeed SenseCAP T1000-E,
Wio WM1110.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
The RAK4631/RAK4630 module are able to use the DC/DC converter. Enable
it to reduce power consumption.

Signed-off-by: Frieder Schrempf <frieder@fris.de>
@IoTThinks
Copy link

I have created a common NRF52Board when I tried to add in built-in temperature.

When merged, we can remove duplicated code.

Copy and paste code is not a way to go.

#1163

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants