[wpilib] Document simulation APIs (#3079)

- Remove sim checkstyle suppression
- Add [[nodiscard]] to C++ register callback functions
- Add a couple of missing sim functions

Co-authored-by: Peter Johnson <johnson.peter@gmail.com>
Co-authored-by: Starlight220 <yotamshlomi@gmail.com>
This commit is contained in:
Peter Johnson
2021-01-11 21:55:45 -08:00
committed by GitHub
parent 26584ff145
commit 9c3b51ca0f
64 changed files with 4516 additions and 199 deletions

View File

@@ -47,27 +47,81 @@ class DigitalPWMSim {
*/
static DigitalPWMSim CreateForIndex(int index);
std::unique_ptr<CallbackStore> RegisterInitializedCallback(
/**
* Register a callback to be run when this PWM output is initialized.
*
* @param callback the callback
* @param initialNotify whether to run the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterInitializedCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check whether this PWM output has been initialized.
*
* @return true if initialized
*/
bool GetInitialized() const;
/**
* Define whether this PWM output has been initialized.
*
* @param initialized whether this object is initialized
*/
void SetInitialized(bool initialized);
std::unique_ptr<CallbackStore> RegisterDutyCycleCallback(
/**
* Register a callback to be run whenever the duty cycle value changes.
*
* @param callback the callback
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterDutyCycleCallback(
NotifyCallback callback, bool initialNotify);
/**
* Read the duty cycle value.
*
* @return the duty cycle value of this PWM output
*/
double GetDutyCycle() const;
/**
* Set the duty cycle value of this PWM output.
*
* @param dutyCycle the new value
*/
void SetDutyCycle(double dutyCycle);
std::unique_ptr<CallbackStore> RegisterPinCallback(NotifyCallback callback,
bool initialNotify);
/**
* Register a callback to be run whenever the pin changes.
*
* @param callback the callback
* @param initialNotify whether to call the callback with the initial state
* @return the CallbackStore object associated with this callback
*/
[[nodiscard]] std::unique_ptr<CallbackStore> RegisterPinCallback(
NotifyCallback callback, bool initialNotify);
/**
* Check the pin number.
*
* @return the pin number
*/
int GetPin() const;
/**
* Change the pin number.
*
* @param pin the new pin number
*/
void SetPin(int pin);
/**
* Reset all simulation data.
*/
void ResetData();
private: