Fixes warnings thrown by cpplint.py (#154)

* Fixed cpplint.py [runtime/int] warnings

* Fixed cpplint.py [readability/casting] warnings

* Fixed cpplint.py [readability/namespace] warnings

* Fixed cpplint.py [readability/braces] warnings

* Fixed cpplint.py [whitespace/braces] warnings

* Fixed cpplint.py [runtime/explicit] warnings

* Fixed cpplint.py [runtime/printf] warnings

* Fixed cpplint.py [readability/inheritance] warnings

* Fixed cpplint.py [whitespace/tab] warnings

* Fixed cpplint.py [build/storage_class] warnings

* Fixed cpplint.py [readability/multiline_comment] warnings

* Fixed cpplint.py [whitespace/semicolon] warnings

* Fixed cpplint.py [readability/check] warnings

* Fixed cpplint.py [runtime/arrays] warnings

* Ran format.py
This commit is contained in:
Tyler Veness
2016-07-10 17:47:44 -07:00
committed by Peter Johnson
parent e44a6e227a
commit 0cb288ffba
141 changed files with 670 additions and 626 deletions

View File

@@ -75,7 +75,8 @@ HAL_DigitalHandle HAL_InitializePWMPort(HAL_PortHandle port_handle,
port->pin = origPin;
uint32_t bitToSet = 1 << remapMXPPWMChannel(port->pin);
short specialFunctions = digitalSystem->readEnableMXPSpecialFunction(status);
int16_t specialFunctions =
digitalSystem->readEnableMXPSpecialFunction(status);
digitalSystem->writeEnableMXPSpecialFunction(specialFunctions | bitToSet,
status);
@@ -90,7 +91,7 @@ void HAL_FreePWMPort(HAL_DigitalHandle pwm_port_handle, int32_t* status) {
if (port->pin > tPWM::kNumHdrRegisters - 1) {
uint32_t bitToUnset = 1 << remapMXPPWMChannel(port->pin);
short specialFunctions =
int16_t specialFunctions =
digitalSystem->readEnableMXPSpecialFunction(status);
digitalSystem->writeEnableMXPSpecialFunction(specialFunctions & ~bitToUnset,
status);
@@ -244,11 +245,13 @@ void HAL_SetPWMSpeed(HAL_DigitalHandle pwm_port_handle, float speed,
if (speed == 0.0) {
rawValue = GetCenterPwm(dPort);
} else if (speed > 0.0) {
rawValue = (int32_t)(speed * ((float)GetPositiveScaleFactor(dPort)) +
((float)GetMinPositivePwm(dPort)) + 0.5);
rawValue = static_cast<int32_t>(
speed * static_cast<float>(GetPositiveScaleFactor(dPort)) +
static_cast<float>(GetMinPositivePwm(dPort)) + 0.5);
} else {
rawValue = (int32_t)(speed * ((float)GetNegativeScaleFactor(dPort)) +
((float)GetMaxNegativePwm(dPort)) + 0.5);
rawValue = static_cast<int32_t>(
speed * static_cast<float>(GetNegativeScaleFactor(dPort)) +
static_cast<float>(GetMaxNegativePwm(dPort)) + 0.5);
}
if (!((rawValue >= GetMinNegativePwm(dPort)) &&
@@ -291,8 +294,9 @@ void HAL_SetPWMPosition(HAL_DigitalHandle pwm_port_handle, float pos,
// note, need to perform the multiplication below as floating point before
// converting to int
uint16_t rawValue = (int32_t)((pos * (float)GetFullRangeScaleFactor(dPort)) +
GetMinNegativePwm(dPort));
uint16_t rawValue = static_cast<int32_t>(
(pos * static_cast<float>(GetFullRangeScaleFactor(dPort))) +
GetMinNegativePwm(dPort));
if (rawValue == kPwmDisabled) {
*status = HAL_PWM_SCALE_ERROR;
@@ -354,11 +358,11 @@ float HAL_GetPWMSpeed(HAL_DigitalHandle pwm_port_handle, int32_t* status) {
} else if (value < GetMinNegativePwm(dPort)) {
return -1.0;
} else if (value > GetMinPositivePwm(dPort)) {
return (float)(value - GetMinPositivePwm(dPort)) /
(float)GetPositiveScaleFactor(dPort);
return static_cast<float>(value - GetMinPositivePwm(dPort)) /
static_cast<float>(GetPositiveScaleFactor(dPort));
} else if (value < GetMaxNegativePwm(dPort)) {
return (float)(value - GetMaxNegativePwm(dPort)) /
(float)GetNegativeScaleFactor(dPort);
return static_cast<float>(value - GetMaxNegativePwm(dPort)) /
static_cast<float>(GetNegativeScaleFactor(dPort));
} else {
return 0.0;
}
@@ -390,8 +394,8 @@ float HAL_GetPWMPosition(HAL_DigitalHandle pwm_port_handle, int32_t* status) {
} else if (value > GetMaxPositivePwm(dPort)) {
return 1.0;
} else {
return (float)(value - GetMinNegativePwm(dPort)) /
(float)GetFullRangeScaleFactor(dPort);
return static_cast<float>(value - GetMinNegativePwm(dPort)) /
static_cast<float>(GetFullRangeScaleFactor(dPort));
}
}