Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 1 | // Copyright (c) FIRST and other WPILib contributors. |
| 2 | // Open Source Software; you can modify and/or share it under the terms of |
| 3 | // the WPILib BSD license file in the root directory of this project. |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 4 | |
| 5 | #include "hal/Power.h" |
| 6 | |
| 7 | #include "mockdata/RoboRioDataInternal.h" |
| 8 | |
| 9 | using namespace hal; |
| 10 | |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 11 | namespace hal::init { |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 12 | void InitializePower() {} |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 13 | } // namespace hal::init |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 14 | |
| 15 | // TODO: Fix the naming in here |
| 16 | extern "C" { |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 17 | double HAL_GetVinVoltage(int32_t* status) { |
| 18 | return SimRoboRioData->vInVoltage; |
| 19 | } |
| 20 | double HAL_GetVinCurrent(int32_t* status) { |
| 21 | return SimRoboRioData->vInCurrent; |
| 22 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 23 | double HAL_GetUserVoltage6V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 24 | return SimRoboRioData->userVoltage6V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 25 | } |
| 26 | double HAL_GetUserCurrent6V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 27 | return SimRoboRioData->userCurrent6V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 28 | } |
| 29 | HAL_Bool HAL_GetUserActive6V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 30 | return SimRoboRioData->userActive6V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 31 | } |
| 32 | int32_t HAL_GetUserCurrentFaults6V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 33 | return SimRoboRioData->userFaults6V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 34 | } |
| 35 | double HAL_GetUserVoltage5V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 36 | return SimRoboRioData->userVoltage5V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 37 | } |
| 38 | double HAL_GetUserCurrent5V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 39 | return SimRoboRioData->userCurrent5V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 40 | } |
| 41 | HAL_Bool HAL_GetUserActive5V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 42 | return SimRoboRioData->userActive5V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 43 | } |
| 44 | int32_t HAL_GetUserCurrentFaults5V(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 45 | return SimRoboRioData->userFaults5V; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 46 | } |
| 47 | double HAL_GetUserVoltage3V3(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 48 | return SimRoboRioData->userVoltage3V3; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 49 | } |
| 50 | double HAL_GetUserCurrent3V3(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 51 | return SimRoboRioData->userCurrent3V3; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 52 | } |
| 53 | HAL_Bool HAL_GetUserActive3V3(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 54 | return SimRoboRioData->userActive3V3; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 55 | } |
| 56 | int32_t HAL_GetUserCurrentFaults3V3(int32_t* status) { |
Austin Schuh | 1e69f94 | 2020-11-14 15:06:14 -0800 | [diff] [blame] | 57 | return SimRoboRioData->userFaults3V3; |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 58 | } |
Austin Schuh | 812d0d1 | 2021-11-04 20:16:48 -0700 | [diff] [blame^] | 59 | void HAL_SetBrownoutVoltage(double voltage, int32_t* status) { |
| 60 | SimRoboRioData->brownoutVoltage = voltage; |
| 61 | } |
| 62 | double HAL_GetBrownoutVoltage(int32_t* status) { |
| 63 | return SimRoboRioData->brownoutVoltage; |
| 64 | } |
Brian Silverman | 8fce748 | 2020-01-05 13:18:21 -0800 | [diff] [blame] | 65 | } // extern "C" |