mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-27 02:01:42 +00:00
Moved C++ comments from source files to headers (#1111)
Also sorted functions in C++ sources to match order in related headers.
This commit is contained in:
committed by
Peter Johnson
parent
d9971a705a
commit
8c680a26f8
@@ -37,9 +37,6 @@ void InitializeDIO() {
|
||||
|
||||
extern "C" {
|
||||
|
||||
/**
|
||||
* Create a new instance of a digital port.
|
||||
*/
|
||||
HAL_DigitalHandle HAL_InitializeDIOPort(HAL_PortHandle portHandle,
|
||||
HAL_Bool input, int32_t* status) {
|
||||
hal::init::CheckInit();
|
||||
@@ -84,12 +81,6 @@ void HAL_FreeDIOPort(HAL_DigitalHandle dioPortHandle) {
|
||||
SimDIOData[port->channel].SetInitialized(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* Allocate a DO PWM Generator.
|
||||
* Allocate PWM generators so that they are not accidentally reused.
|
||||
*
|
||||
* @return PWM Generator handle
|
||||
*/
|
||||
HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status) {
|
||||
auto handle = digitalPWMHandles->Allocate();
|
||||
if (handle == HAL_kInvalidHandle) {
|
||||
@@ -109,12 +100,6 @@ HAL_DigitalPWMHandle HAL_AllocateDigitalPWM(int32_t* status) {
|
||||
return handle;
|
||||
}
|
||||
|
||||
/**
|
||||
* Free the resource associated with a DO PWM generator.
|
||||
*
|
||||
* @param pwmGenerator The pwmGen to free that was allocated with
|
||||
* allocateDigitalPWM()
|
||||
*/
|
||||
void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status) {
|
||||
auto port = digitalPWMHandles->Get(pwmGenerator);
|
||||
digitalPWMHandles->Free(pwmGenerator);
|
||||
@@ -123,14 +108,6 @@ void HAL_FreeDigitalPWM(HAL_DigitalPWMHandle pwmGenerator, int32_t* status) {
|
||||
SimDigitalPWMData[id].SetInitialized(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Change the frequency of the DO PWM generator.
|
||||
*
|
||||
* The valid range is from 0.6 Hz to 19 kHz. The frequency resolution is
|
||||
* logarithmic.
|
||||
*
|
||||
* @param rate The frequency to output all digital output PWM signals.
|
||||
*/
|
||||
void HAL_SetDigitalPWMRate(double rate, int32_t* status) {
|
||||
// Currently rounding in the log rate domain... heavy weight toward picking a
|
||||
// higher freq.
|
||||
@@ -143,12 +120,6 @@ void HAL_SetDigitalPWMRate(double rate, int32_t* status) {
|
||||
// digitalSystem->writePWMPeriodPower(pwmPeriodPower, status);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure the duty-cycle of the PWM generator
|
||||
*
|
||||
* @param pwmGenerator The generator index reserved by allocateDigitalPWM()
|
||||
* @param dutyCycle The percent duty cycle to output [0..1].
|
||||
*/
|
||||
void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
|
||||
double dutyCycle, int32_t* status) {
|
||||
auto port = digitalPWMHandles->Get(pwmGenerator);
|
||||
@@ -162,12 +133,6 @@ void HAL_SetDigitalPWMDutyCycle(HAL_DigitalPWMHandle pwmGenerator,
|
||||
SimDigitalPWMData[id].SetDutyCycle(dutyCycle);
|
||||
}
|
||||
|
||||
/**
|
||||
* Configure which DO channel the PWM signal is output on
|
||||
*
|
||||
* @param pwmGenerator The generator index reserved by allocateDigitalPWM()
|
||||
* @param channel The Digital Output channel to output on
|
||||
*/
|
||||
void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
|
||||
int32_t channel, int32_t* status) {
|
||||
auto port = digitalPWMHandles->Get(pwmGenerator);
|
||||
@@ -179,14 +144,6 @@ void HAL_SetDigitalPWMOutputChannel(HAL_DigitalPWMHandle pwmGenerator,
|
||||
SimDigitalPWMData[id].SetPin(channel);
|
||||
}
|
||||
|
||||
/**
|
||||
* Write a digital I/O bit to the FPGA.
|
||||
* Set a single value on a digital I/O channel.
|
||||
*
|
||||
* @param channel The Digital I/O channel
|
||||
* @param value The state to set the digital channel (if it is configured as an
|
||||
* output)
|
||||
*/
|
||||
void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
@@ -200,12 +157,6 @@ void HAL_SetDIO(HAL_DigitalHandle dioPortHandle, HAL_Bool value,
|
||||
SimDIOData[port->channel].SetValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set direction of a DIO channel.
|
||||
*
|
||||
* @param channel The Digital I/O channel
|
||||
* @param input true to set input, false for output
|
||||
*/
|
||||
void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
@@ -217,13 +168,6 @@ void HAL_SetDIODirection(HAL_DigitalHandle dioPortHandle, HAL_Bool input,
|
||||
SimDIOData[port->channel].SetIsInput(input);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read a digital I/O bit from the FPGA.
|
||||
* Get a single value from a digital I/O channel.
|
||||
*
|
||||
* @param channel The digital I/O channel
|
||||
* @return The state of the specified channel
|
||||
*/
|
||||
HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) {
|
||||
@@ -236,13 +180,6 @@ HAL_Bool HAL_GetDIO(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the direction of a the Digital I/O lines
|
||||
* A 1 bit means output and a 0 bit means input.
|
||||
*
|
||||
* @param channel The digital I/O channel
|
||||
* @return The direction of the specified channel
|
||||
*/
|
||||
HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) {
|
||||
@@ -255,14 +192,6 @@ HAL_Bool HAL_GetDIODirection(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
return value;
|
||||
}
|
||||
|
||||
/**
|
||||
* Generate a single pulse.
|
||||
* Write a pulse to the specified digital output channel. There can only be a
|
||||
* single pulse going at any time.
|
||||
*
|
||||
* @param channel The Digital Output channel that the pulse should be output on
|
||||
* @param pulseLength The active length of the pulse (in seconds)
|
||||
*/
|
||||
void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
@@ -273,11 +202,6 @@ void HAL_Pulse(HAL_DigitalHandle dioPortHandle, double pulseLength,
|
||||
// TODO (Thad) Add this
|
||||
}
|
||||
|
||||
/**
|
||||
* Check a DIO line to see if it is currently generating a pulse.
|
||||
*
|
||||
* @return A pulse is in progress
|
||||
*/
|
||||
HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) {
|
||||
@@ -288,23 +212,10 @@ HAL_Bool HAL_IsPulsing(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
// TODO (Thad) Add this
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if any DIO line is currently generating a pulse.
|
||||
*
|
||||
* @return A pulse on some line is in progress
|
||||
*/
|
||||
HAL_Bool HAL_IsAnyPulsing(int32_t* status) {
|
||||
return false; // TODO(Thad) Figure this out
|
||||
}
|
||||
|
||||
/**
|
||||
* Write the filter index from the FPGA.
|
||||
* Set the filter index used to filter out short pulses.
|
||||
*
|
||||
* @param dioPortHandle Handle to the digital I/O channel
|
||||
* @param filterIndex The filter index. Must be in the range 0 - 3, where 0
|
||||
* means "none" and 1 - 3 means filter # filterIndex - 1.
|
||||
*/
|
||||
void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
@@ -316,14 +227,6 @@ void HAL_SetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t filterIndex,
|
||||
// TODO(Thad) Figure this out
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the filter index from the FPGA.
|
||||
* Get the filter index used to filter out short pulses.
|
||||
*
|
||||
* @param dioPortHandle Handle to the digital I/O channel
|
||||
* @return filterIndex The filter index. Must be in the range 0 - 3,
|
||||
* where 0 means "none" and 1 - 3 means filter # filterIndex - 1.
|
||||
*/
|
||||
int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(dioPortHandle, HAL_HandleEnum::DIO);
|
||||
if (port == nullptr) {
|
||||
@@ -334,33 +237,10 @@ int32_t HAL_GetFilterSelect(HAL_DigitalHandle dioPortHandle, int32_t* status) {
|
||||
// TODO(Thad) Figure this out
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the filter period for the specified filter index.
|
||||
*
|
||||
* Set the filter period in FPGA cycles. Even though there are 2 different
|
||||
* filter index domains (MXP vs HDR), ignore that distinction for now since it
|
||||
* compilicates the interface. That can be changed later.
|
||||
*
|
||||
* @param filterIndex The filter index, 0 - 2.
|
||||
* @param value The number of cycles that the signal must not transition to be
|
||||
* counted as a transition.
|
||||
*/
|
||||
void HAL_SetFilterPeriod(int32_t filterIndex, int64_t value, int32_t* status) {
|
||||
// TODO(Thad) figure this out
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the filter period for the specified filter index.
|
||||
*
|
||||
* Get the filter period in FPGA cycles. Even though there are 2 different
|
||||
* filter index domains (MXP vs HDR), ignore that distinction for now since it
|
||||
* compilicates the interface. Set status to NiFpga_Status_SoftwareFault if the
|
||||
* filter values miss-match.
|
||||
*
|
||||
* @param filterIndex The filter index, 0 - 2.
|
||||
* @param value The number of cycles that the signal must not transition to be
|
||||
* counted as a transition.
|
||||
*/
|
||||
int64_t HAL_GetFilterPeriod(int32_t filterIndex, int32_t* status) {
|
||||
return 0; // TODO(Thad) figure this out
|
||||
}
|
||||
|
||||
@@ -28,26 +28,6 @@ void InitializeDigitalInternal() {
|
||||
}
|
||||
} // namespace init
|
||||
|
||||
/**
|
||||
* Map DIO channel numbers from their physical number (10 to 26) to their
|
||||
* position in the bit field.
|
||||
*/
|
||||
int32_t remapMXPChannel(int32_t channel) { return channel - 10; }
|
||||
|
||||
int32_t remapMXPPWMChannel(int32_t channel) {
|
||||
if (channel < 14) {
|
||||
return channel - 10; // first block of 4 pwms (MXP 0-3)
|
||||
} else {
|
||||
return channel - 6; // block of PWMs after SPI
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remap the digital source channel and set the module.
|
||||
* If it's an analog trigger, determine the module from the high order routing
|
||||
* channel else do normal digital input remapping based on channel number
|
||||
* (MXP)
|
||||
*/
|
||||
bool remapDigitalSource(HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
uint8_t& channel, uint8_t& module,
|
||||
@@ -75,6 +55,16 @@ bool remapDigitalSource(HAL_Handle digitalSourceHandle,
|
||||
}
|
||||
}
|
||||
|
||||
int32_t remapMXPChannel(int32_t channel) { return channel - 10; }
|
||||
|
||||
int32_t remapMXPPWMChannel(int32_t channel) {
|
||||
if (channel < 14) {
|
||||
return channel - 10; // first block of 4 pwms (MXP 0-3)
|
||||
} else {
|
||||
return channel - 6; // block of PWMs after SPI
|
||||
}
|
||||
}
|
||||
|
||||
int32_t GetDigitalInputChannel(HAL_DigitalHandle handle, int32_t* status) {
|
||||
auto digital = digitalChannelHandles->Get(handle, HAL_HandleEnum::DIO);
|
||||
if (digital == nullptr) {
|
||||
|
||||
@@ -70,11 +70,24 @@ extern DigitalHandleResource<HAL_DigitalHandle, DigitalPort,
|
||||
kNumDigitalChannels + kNumPWMHeaders>*
|
||||
digitalChannelHandles;
|
||||
|
||||
/**
|
||||
* Remap the digital source channel and set the module.
|
||||
*
|
||||
* If it's an analog trigger, determine the module from the high order routing
|
||||
* channel else do normal digital input remapping based on channel number
|
||||
* (MXP).
|
||||
*/
|
||||
bool remapDigitalSource(HAL_Handle digitalSourceHandle,
|
||||
HAL_AnalogTriggerType analogTriggerType,
|
||||
uint8_t& channel, uint8_t& module, bool& analogTrigger);
|
||||
int32_t remapMXPPWMChannel(int32_t channel);
|
||||
|
||||
/**
|
||||
* Map DIO channel numbers from their physical number (10 to 26) to their
|
||||
* position in the bit field.
|
||||
*/
|
||||
int32_t remapMXPChannel(int32_t channel);
|
||||
|
||||
int32_t remapMXPPWMChannel(int32_t channel);
|
||||
|
||||
int32_t GetDigitalInputChannel(HAL_DigitalHandle handle, int32_t* status);
|
||||
} // namespace hal
|
||||
|
||||
@@ -124,17 +124,7 @@ int32_t HAL_GetJoystickButtons(int32_t joystickNum,
|
||||
SimDriverStationData->GetJoystickButtons(joystickNum, buttons);
|
||||
return 0;
|
||||
}
|
||||
/**
|
||||
* Retrieve the Joystick Descriptor for particular slot
|
||||
* @param desc [out] descriptor (data transfer object) to fill in. desc is
|
||||
* filled in regardless of success. In other words, if descriptor is not
|
||||
* available, desc is filled in with default values matching the init-values in
|
||||
* Java and C++ Driverstation for when caller requests a too-large joystick
|
||||
* index.
|
||||
*
|
||||
* @return error code reported from Network Comm back-end. Zero is good,
|
||||
* nonzero is bad.
|
||||
*/
|
||||
|
||||
int32_t HAL_GetJoystickDescriptor(int32_t joystickNum,
|
||||
HAL_JoystickDescriptor* desc) {
|
||||
SimDriverStationData->GetJoystickDescriptor(joystickNum, desc);
|
||||
@@ -241,16 +231,8 @@ bool HAL_IsNewControlData(void) {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Waits for the newest DS packet to arrive. Note that this is a blocking call.
|
||||
*/
|
||||
void HAL_WaitForDSData(void) { HAL_WaitForDSDataTimeout(0); }
|
||||
|
||||
/**
|
||||
* Waits for the newest DS packet to arrive. If timeout is <= 0, this will wait
|
||||
* forever. Otherwise, it will wait until either a new packet, or the timeout
|
||||
* time has passed. Returns true on new data, false on timeout.
|
||||
*/
|
||||
HAL_Bool HAL_WaitForDSDataTimeout(double timeout) {
|
||||
auto timeoutTime =
|
||||
std::chrono::steady_clock::now() + std::chrono::duration<double>(timeout);
|
||||
@@ -284,11 +266,6 @@ static int32_t newDataOccur(uint32_t refNum) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/*
|
||||
* Call this to initialize the driver station communication. This will properly
|
||||
* handle multiple calls. However note that this CANNOT be called from a library
|
||||
* that interfaces with LabVIEW.
|
||||
*/
|
||||
void HAL_InitializeDriverStation(void) {
|
||||
hal::init::CheckInit();
|
||||
static std::atomic_bool initialized{false};
|
||||
@@ -305,10 +282,6 @@ void HAL_InitializeDriverStation(void) {
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Releases the DS Mutex to allow proper shutdown of any threads that are
|
||||
* waiting on it.
|
||||
*/
|
||||
void HAL_ReleaseDSMutex(void) { newDataOccur(refNumber); }
|
||||
|
||||
} // extern "C"
|
||||
|
||||
@@ -67,10 +67,6 @@ int HAL_LoadOneExtension(const char* library) {
|
||||
return rc;
|
||||
}
|
||||
|
||||
/**
|
||||
* Load any extra halsim libraries provided in the HALSIM_EXTENSIONS
|
||||
* environment variable.
|
||||
*/
|
||||
int HAL_LoadExtensions(void) {
|
||||
int rc = 1;
|
||||
wpi::SmallVector<wpi::StringRef, 2> libraries;
|
||||
|
||||
@@ -83,9 +83,6 @@ HAL_PortHandle HAL_GetPort(int32_t channel) {
|
||||
return createPortHandle(channel, 1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @deprecated Uses module numbers
|
||||
*/
|
||||
HAL_PortHandle HAL_GetPortWithModule(int32_t module, int32_t channel) {
|
||||
// Dont allow a number that wouldn't fit in a uint8_t
|
||||
if (channel < 0 || channel >= 255) return HAL_kInvalidHandle;
|
||||
@@ -204,44 +201,18 @@ const char* HAL_GetErrorMessage(int32_t code) {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the runtime type of this HAL
|
||||
*/
|
||||
HAL_RuntimeType HAL_GetRuntimeType(void) { return HAL_Mock; }
|
||||
|
||||
/**
|
||||
* Return the FPGA Version number.
|
||||
* For now, expect this to be competition year.
|
||||
* @return FPGA Version number.
|
||||
*/
|
||||
int32_t HAL_GetFPGAVersion(int32_t* status) {
|
||||
return 2018; // Automatically script this at some point
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the FPGA Revision number.
|
||||
* The format of the revision is 3 numbers.
|
||||
* The 12 most significant bits are the Major Revision.
|
||||
* the next 8 bits are the Minor Revision.
|
||||
* The 12 least significant bits are the Build Number.
|
||||
* @return FPGA Revision number.
|
||||
*/
|
||||
int64_t HAL_GetFPGARevision(int32_t* status) {
|
||||
return 0; // TODO: Find a better number to return;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read the microsecond-resolution timer on the FPGA.
|
||||
*
|
||||
* @return The current time in microseconds according to the FPGA (since FPGA
|
||||
* reset).
|
||||
*/
|
||||
uint64_t HAL_GetFPGATime(int32_t* status) { return hal::GetFPGATime(); }
|
||||
|
||||
/**
|
||||
* Get the state of the "USER" button on the roboRIO
|
||||
* @return true if the button is currently pressed down
|
||||
*/
|
||||
HAL_Bool HAL_GetFPGAButton(int32_t* status) {
|
||||
return SimRoboRioData[0].GetFPGAButton();
|
||||
}
|
||||
|
||||
@@ -166,14 +166,6 @@ HAL_Bool HAL_GetPWMEliminateDeadband(HAL_DigitalHandle pwmPortHandle,
|
||||
return port->eliminateDeadband;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a PWM channel to the desired value. The values range from 0 to 255 and
|
||||
* the period is controlled
|
||||
* by the PWM Period and MinHigh registers.
|
||||
*
|
||||
* @param channel The PWM channel to set.
|
||||
* @param value The PWM value to set.
|
||||
*/
|
||||
void HAL_SetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t value,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
@@ -185,15 +177,6 @@ void HAL_SetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t value,
|
||||
SimPWMData[port->channel].SetRawValue(value);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a PWM channel to the desired scaled value. The values range from -1 to 1
|
||||
* and
|
||||
* the period is controlled
|
||||
* by the PWM Period and MinHigh registers.
|
||||
*
|
||||
* @param channel The PWM channel to set.
|
||||
* @param value The scaled PWM value to set.
|
||||
*/
|
||||
void HAL_SetPWMSpeed(HAL_DigitalHandle pwmPortHandle, double speed,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
@@ -215,15 +198,6 @@ void HAL_SetPWMSpeed(HAL_DigitalHandle pwmPortHandle, double speed,
|
||||
SimPWMData[port->channel].SetSpeed(speed);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set a PWM channel to the desired position value. The values range from 0 to 1
|
||||
* and
|
||||
* the period is controlled
|
||||
* by the PWM Period and MinHigh registers.
|
||||
*
|
||||
* @param channel The PWM channel to set.
|
||||
* @param value The scaled PWM value to set.
|
||||
*/
|
||||
void HAL_SetPWMPosition(HAL_DigitalHandle pwmPortHandle, double pos,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
@@ -256,12 +230,6 @@ void HAL_SetPWMDisabled(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
SimPWMData[port->channel].SetSpeed(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a value from a PWM channel. The values range from 0 to 255.
|
||||
*
|
||||
* @param channel The PWM channel to read from.
|
||||
* @return The raw PWM value.
|
||||
*/
|
||||
int32_t HAL_GetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
if (port == nullptr) {
|
||||
@@ -272,12 +240,6 @@ int32_t HAL_GetPWMRaw(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
return SimPWMData[port->channel].GetRawValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a scaled value from a PWM channel. The values range from -1 to 1.
|
||||
*
|
||||
* @param channel The PWM channel to read from.
|
||||
* @return The scaled PWM value.
|
||||
*/
|
||||
double HAL_GetPWMSpeed(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
if (port == nullptr) {
|
||||
@@ -295,12 +257,6 @@ double HAL_GetPWMSpeed(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
return speed;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a position value from a PWM channel. The values range from 0 to 1.
|
||||
*
|
||||
* @param channel The PWM channel to read from.
|
||||
* @return The scaled PWM value.
|
||||
*/
|
||||
double HAL_GetPWMPosition(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
if (port == nullptr) {
|
||||
@@ -329,12 +285,6 @@ void HAL_LatchPWMZero(HAL_DigitalHandle pwmPortHandle, int32_t* status) {
|
||||
SimPWMData[port->channel].SetZeroLatch(false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set how how often the PWM signal is squelched, thus scaling the period.
|
||||
*
|
||||
* @param channel The PWM channel to configure.
|
||||
* @param squelchMask The 2-bit mask of outputs to squelch.
|
||||
*/
|
||||
void HAL_SetPWMPeriodScale(HAL_DigitalHandle pwmPortHandle, int32_t squelchMask,
|
||||
int32_t* status) {
|
||||
auto port = digitalChannelHandles->Get(pwmPortHandle, HAL_HandleEnum::PWM);
|
||||
@@ -346,17 +296,7 @@ void HAL_SetPWMPeriodScale(HAL_DigitalHandle pwmPortHandle, int32_t squelchMask,
|
||||
SimPWMData[port->channel].SetPeriodScale(squelchMask);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the loop timing of the PWM system
|
||||
*
|
||||
* @return The loop time
|
||||
*/
|
||||
int32_t HAL_GetPWMLoopTiming(int32_t* status) { return kExpectedLoopTiming; }
|
||||
|
||||
/**
|
||||
* Get the pwm starting cycle time
|
||||
*
|
||||
* @return The pwm cycle start time.
|
||||
*/
|
||||
uint64_t HAL_GetPWMCycleStartTime(int32_t* status) { return 0; }
|
||||
} // extern "C"
|
||||
|
||||
Reference in New Issue
Block a user