commit | 34cb42164c039b92a976941f1ac90c8e0cf63715 | [log] [tgz] |
---|---|---|
author | Austin Schuh <austin.linux@gmail.com> | Sun Oct 17 23:39:07 2021 -0700 |
committer | Austin Schuh <austin.linux@gmail.com> | Mon Oct 18 10:04:51 2021 -0700 |
tree | 44bb2c056dca2bdfb8eb9588fc6bf2e18ecf1988 | |
parent | 5e9e8867260c0569926db57a0ab46197812f058a [diff] |
Allocate the Power subsystem at startup in WPILib This gets rid of a malloc in the realtime code by doing it before we start. Change-Id: I39e81d584f7a7efd5d401b49b5ab5d53aa717ef1 Signed-off-by: Austin Schuh <austin.linux@gmail.com>
diff --git a/third_party/allwpilib/hal/src/main/native/athena/Power.cpp b/third_party/allwpilib/hal/src/main/native/athena/Power.cpp index 2cf4d33..a13ebb6 100644 --- a/third_party/allwpilib/hal/src/main/native/athena/Power.cpp +++ b/third_party/allwpilib/hal/src/main/native/athena/Power.cpp
@@ -29,7 +29,12 @@ namespace hal { namespace init { -void InitializePower() {} +void InitializePower() { + if (power == nullptr) { + int32_t status = 0; + power.reset(tPower::create(&status)); + } +} } // namespace init } // namespace hal