Skip to content

Commit

Permalink
Fixed documentation, removed periods, and used imperative tone.
Browse files Browse the repository at this point in the history
  • Loading branch information
WillXuCodes committed Oct 21, 2020
1 parent 066142e commit 8785778
Show file tree
Hide file tree
Showing 2 changed files with 51 additions and 57 deletions.
61 changes: 29 additions & 32 deletions include/pros/rotation.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* \file pros/rotation.h
*
* Contains prototypes for functions related to the VEX Rotation sensor.
* Contains prototypes for functions related to the VEX rotation sensor.
*
* Visit https://pros.cs.purdue.edu/v5/tutorials/topical/rotation.html to learn
* more.
Expand Down Expand Up @@ -29,34 +29,34 @@ namespace c {
#endif

/**
* Resets Rotation Sensor
* Reset rotation sensor
*
* Resets rotation sensor by multiplying the rotation reading by
* Reset rotation sensor by multiplying the rotation reading by
* -1 and changes the angle by -180 degrees only if the direction
* was recently reversed.
* was recently reversed
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \return 1 if the operation was successful or PROS_ERR if the operation
* failed, setting errno.
*/
int32_t rotation_reset(uint8_t port);

/**
* Set the rotation sensor position reading to a desired rotation value.
* Set the rotation sensor position reading to a desired rotation value
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \param position
* The position in terms of ticks
* \return 1 if the operation was successful or PROS_ERR if the operation
Expand All @@ -65,64 +65,61 @@ int32_t rotation_reset(uint8_t port);
int32_t rotation_set_position(uint8_t port, uint32_t position);

/**
* Resets the rotation sensor position to 0.
* Reset the rotation sensor position to 0
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \return 1 if the operation was successful or PROS_ERR if the operation
* failed, setting errno.
*/
int32_t rotation_reset_position(uint8_t port);

/**
* Get the Rotation sensor's current position. Specifically, in
* terms of hundreths of degrees.
* Get the rotation sensor's current position in centidegrees
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \return The position value or PROS_ERR_F if the operation failed, setting
* errno.
*/
int32_t rotation_get_position(uint8_t port);

/**
* Get the Rotation sensor's current velocity in hundreths of
* degrees per second.
* Get the rotation sensor's current velocity in centidegrees per second
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \return The velocity value or PROS_ERR_F if the operation failed, setting
* errno.
*/
int32_t rotation_get_velocity(uint8_t port);

/**
* Get the Rotation sensor's current position in terms of an angle
* measured in hundreths of degrees.
* Get the rotation sensor's current position in centidegrees
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \return The angle value or PROS_ERR_F if the operation failed, setting
* errno.
*/
Expand All @@ -134,10 +131,10 @@ int32_t rotation_get_angle(uint8_t port);
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \param value
* Determines if the direction of the rotation sensor is reversed or not.
*
Expand All @@ -147,31 +144,31 @@ int32_t rotation_get_angle(uint8_t port);
int32_t rotation_set_reversed(uint8_t port, bool value);

/**
* Reverses the rotation sensor's direction.
* Reverse the rotation sensor's direction
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
*
* \return 1 if the operation was successful or PROS_ERR if the operation
* failed, setting errno.
*/
int32_t rotation_reverse(uint8_t port);

/**
* Check whether the rotation sensor's direction is reversed.
* Get the rotation sensor's reversed flag
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
*
* \return Boolean value of if the rotation sensor's direction is reversed or not
* or PROS_ERR if the operation failed, setting errno.
Expand Down
47 changes: 22 additions & 25 deletions include/pros/rotation.hpp
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/**
* \file pros/rotation.hpp
*
* Contains prototypes for functions related to the VEX Rotation sensor.
* Contains prototypes for functions related to the VEX rotation sensor.
*
* Visit https://pros.cs.purdue.edu/v5/tutorials/topical/rotation.html to learn
* more.
Expand Down Expand Up @@ -30,29 +30,29 @@ class Rotation {
Rotation(const std::uint8_t port) : _port(port){};

/**
* Resets Rotation Sensor
* Reset the rotation sensor
*
* Resets rotation sensor by multiplying the rotation reading by
* Reset the rotation sensor by multiplying the rotation reading by
* -1 and changes the angle by -180 degrees only if the direction
* was recently reversed.
* was recently reversed
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \return 1 if the operation was successful or PROS_ERR if the operation
* failed, setting errno.
*/
virtual std::int32_t reset();

/**
* Set the rotation sensor position reading to a desired rotation value.
* Set the rotation sensor position reading to a desired rotation value
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param position
* The position in terms of ticks
Expand All @@ -62,12 +62,12 @@ class Rotation {
virtual std::int32_t set_position(std::uint32_t position);

/**
* Reset the rotation sensor to a desired rotation value.
* Reset the rotation sensor to a desired rotation value
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param position
* The position in terms of ticks
Expand All @@ -77,57 +77,54 @@ class Rotation {
virtual std::int32_t reset_position(void);

/**
* Get the Rotation sensor's current position. Specifically, in
* terms of hundreths of degrees.
* Get the rotation sensor's current position in centidegrees
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \return The position value or PROS_ERR if the operation failed, setting
* errno.
*/
virtual std::int32_t get_position();

/**
* Get the Rotation sensor's current velocity in hundreths of
* degrees per second.
* Get the rotation sensor's current velocity in centidegrees per second
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param port
* The V5 Rotation Sensor port number from 1-21
* The V5 rotation sensor port number from 1-21
* \return The
value or PROS_ERR_F if the operation failed, setting
* errno.
*/
virtual std::int32_t get_velocity();

/**
* Get the Rotation sensor's current position in terms of an angle
* measured in hundreths of degrees.
* Get the rotation sensor's current position in centidegrees
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \return The angle value or PROS_ERR if the operation failed, setting
* errno.
*/
virtual std::int32_t get_angle();

/**
* Sets if the rotation sensor's positive/negative direction is reversed or not.
* Set the rotation sensor's direction reversed flag
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \param value
* Determines if the direction of the rotational sensor is
Expand All @@ -139,25 +136,25 @@ class Rotation {
virtual std::int32_t set_reversed(bool value);

/**
* Reverses the rotation sensor's direction.
* Reverse the rotation sensor's direction.
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \return 1 if the operation was successful or PROS_ERR if the operation
* failed, setting errno.
*/
virtual std::int32_t reverse();

/**
* Check whether the rotation sensor's direction is reversed.
* Get the rotation sensor's reversed flag
*
* This function uses the following values of errno when an error state is
* reached:
* ENXIO - The given value is not within the range of V5 ports (1-21).
* ENODEV - The port cannot be configured as an Rotation Sensor
* ENODEV - The port cannot be configured as an rotation sensor
*
* \return Reversed value or PROS_ERR if the operation failed, setting
* errno.
Expand Down

0 comments on commit 8785778

Please sign in to comment.