Switches HAL to fixed length signed integers, and adds our own HAL_Bool Type (#155)

* Switches HAL to fixed length signed integers, and adds our own HAL_Bool type

* Replaces HAL Floats with Doubles

Doubles are just as fast as floats with optimizations turned on, so
switches to all doubles. All made doubles for consistency.

* Prepends HAL/ to HAL include files. Also fixes some range errors
This commit is contained in:
Thad House
2016-07-12 10:45:14 -07:00
committed by Peter Johnson
parent 4a98e68815
commit b51e85ae26
89 changed files with 900 additions and 795 deletions

View File

@@ -22,39 +22,39 @@ extern "C" {
/**
* Get the roboRIO input voltage
*/
float HAL_GetVinVoltage(int32_t* status) {
double HAL_GetVinVoltage(int32_t* status) {
initializePower(status);
return power->readVinVoltage(status) / 4.096f * 0.025733f - 0.029f;
return power->readVinVoltage(status) / 4.096 * 0.025733 - 0.029;
}
/**
* Get the roboRIO input current
*/
float HAL_GetVinCurrent(int32_t* status) {
double HAL_GetVinCurrent(int32_t* status) {
initializePower(status);
return power->readVinCurrent(status) / 4.096f * 0.017042 - 0.071f;
return power->readVinCurrent(status) / 4.096 * 0.017042 - 0.071;
}
/**
* Get the 6V rail voltage
*/
float HAL_GetUserVoltage6V(int32_t* status) {
double HAL_GetUserVoltage6V(int32_t* status) {
initializePower(status);
return power->readUserVoltage6V(status) / 4.096f * 0.007019f - 0.014f;
return power->readUserVoltage6V(status) / 4.096 * 0.007019 - 0.014;
}
/**
* Get the 6V rail current
*/
float HAL_GetUserCurrent6V(int32_t* status) {
double HAL_GetUserCurrent6V(int32_t* status) {
initializePower(status);
return power->readUserCurrent6V(status) / 4.096f * 0.005566f - 0.009f;
return power->readUserCurrent6V(status) / 4.096 * 0.005566 - 0.009;
}
/**
* Get the active state of the 6V rail
*/
bool HAL_GetUserActive6V(int32_t* status) {
HAL_Bool HAL_GetUserActive6V(int32_t* status) {
initializePower(status);
return power->readStatus_User6V(status) == 4;
}
@@ -62,32 +62,32 @@ bool HAL_GetUserActive6V(int32_t* status) {
/**
* Get the fault count for the 6V rail
*/
int HAL_GetUserCurrentFaults6V(int32_t* status) {
int32_t HAL_GetUserCurrentFaults6V(int32_t* status) {
initializePower(status);
return static_cast<int>(
return static_cast<int32_t>(
power->readFaultCounts_OverCurrentFaultCount6V(status));
}
/**
* Get the 5V rail voltage
*/
float HAL_GetUserVoltage5V(int32_t* status) {
double HAL_GetUserVoltage5V(int32_t* status) {
initializePower(status);
return power->readUserVoltage5V(status) / 4.096f * 0.005962f - 0.013f;
return power->readUserVoltage5V(status) / 4.096 * 0.005962 - 0.013;
}
/**
* Get the 5V rail current
*/
float HAL_GetUserCurrent5V(int32_t* status) {
double HAL_GetUserCurrent5V(int32_t* status) {
initializePower(status);
return power->readUserCurrent5V(status) / 4.096f * 0.001996f - 0.002f;
return power->readUserCurrent5V(status) / 4.096 * 0.001996 - 0.002;
}
/**
* Get the active state of the 5V rail
*/
bool HAL_GetUserActive5V(int32_t* status) {
HAL_Bool HAL_GetUserActive5V(int32_t* status) {
initializePower(status);
return power->readStatus_User5V(status) == 4;
}
@@ -95,13 +95,13 @@ bool HAL_GetUserActive5V(int32_t* status) {
/**
* Get the fault count for the 5V rail
*/
int HAL_GetUserCurrentFaults5V(int32_t* status) {
int32_t HAL_GetUserCurrentFaults5V(int32_t* status) {
initializePower(status);
return static_cast<int>(
return static_cast<int32_t>(
power->readFaultCounts_OverCurrentFaultCount5V(status));
}
unsigned char HAL_GetUserStatus5V(int32_t* status) {
uint8_t HAL_GetUserStatus5V(int32_t* status) {
initializePower(status);
return power->readStatus_User5V(status);
}
@@ -109,23 +109,23 @@ unsigned char HAL_GetUserStatus5V(int32_t* status) {
/**
* Get the 3.3V rail voltage
*/
float HAL_GetUserVoltage3V3(int32_t* status) {
double HAL_GetUserVoltage3V3(int32_t* status) {
initializePower(status);
return power->readUserVoltage3V3(status) / 4.096f * 0.004902f - 0.01f;
return power->readUserVoltage3V3(status) / 4.096 * 0.004902 - 0.01;
}
/**
* Get the 3.3V rail current
*/
float HAL_GetUserCurrent3V3(int32_t* status) {
double HAL_GetUserCurrent3V3(int32_t* status) {
initializePower(status);
return power->readUserCurrent3V3(status) / 4.096f * 0.002486f - 0.003f;
return power->readUserCurrent3V3(status) / 4.096 * 0.002486 - 0.003;
}
/**
* Get the active state of the 3.3V rail
*/
bool HAL_GetUserActive3V3(int32_t* status) {
HAL_Bool HAL_GetUserActive3V3(int32_t* status) {
initializePower(status);
return power->readStatus_User3V3(status) == 4;
}
@@ -133,9 +133,9 @@ bool HAL_GetUserActive3V3(int32_t* status) {
/**
* Get the fault count for the 3.3V rail
*/
int HAL_GetUserCurrentFaults3V3(int32_t* status) {
int32_t HAL_GetUserCurrentFaults3V3(int32_t* status) {
initializePower(status);
return static_cast<int>(
return static_cast<int32_t>(
power->readFaultCounts_OverCurrentFaultCount3V3(status));
}