diff options
author | HampusM <hampus@hampusmat.com> | 2022-03-07 10:07:36 +0100 |
---|---|---|
committer | HampusM <hampus@hampusmat.com> | 2022-03-07 10:07:36 +0100 |
commit | da2ec747227ac1716326bd076219c7f7a2bb3887 (patch) | |
tree | 090f3ccc40dff6e86fb04409904f08d1de7a8d56 /src/sensor/sensor.hpp | |
parent | 4b4605df15ce7061a08d7911069927bf49778d05 (diff) |
refactor: improve sensor methods
Diffstat (limited to 'src/sensor/sensor.hpp')
-rw-r--r-- | src/sensor/sensor.hpp | 38 |
1 files changed, 19 insertions, 19 deletions
diff --git a/src/sensor/sensor.hpp b/src/sensor/sensor.hpp index 7b76ae2..5bdf6ca 100644 --- a/src/sensor/sensor.hpp +++ b/src/sensor/sensor.hpp @@ -43,19 +43,19 @@ public: * * @returns Whether or not the sensor can be communicated with. */ - bool begin(); + bool begin() noexcept; /** * Returns whether or not the sensor is connected. */ - bool isConnected(); + bool isConnected() noexcept; /** * Reads from the sensor. * * @returns Whether or not it succeeded. */ - bool read(); + bool read() noexcept; /** * Sets the accelerometer sensitivity. @@ -63,7 +63,7 @@ public: * @param sensitivity Accelerometer sensitivity. 0, 1, 2, 3 => 2g 4g 8g 16g * @returns Whether or not it succeeded. */ - bool setAccelSensitivity(uint8_t sensitivity); + bool setAccelSensitivity(uint8_t sensitivity) noexcept; /** * Sets the gyro sensitivity. @@ -72,57 +72,57 @@ public: * 0, 1, 2, 3 => 250, 500, 1000, 2000 degrees/s * @returns Whether or not it succeeded. */ - bool setGyroSensitivity(uint8_t sensitivity); + bool setGyroSensitivity(uint8_t sensitivity) noexcept; /** * Returns the current X axis acceleration in g:s (g-force). */ - double getAccelX() const; + double getAccelX() const noexcept; /** * Returns the current Y axis acceleration in g:s (g-force). */ - double getAccelY() const; + double getAccelY() const noexcept; /** * Returns the current Z axis acceleration in g:s (g-force). */ - double getAccelZ() const; + double getAccelZ() const noexcept; /** * Returns the current X angle. */ - double getAngleX() const; + double getAngleX() const noexcept; /** * Returns the current Y angle. */ - double getAngleY() const; + double getAngleY() const noexcept; /** * Returns the current X axis in degrees/s. */ - double getGyroX() const; + double getGyroX() const noexcept; /** * Returns the current Y axis in degrees/s. */ - double getGyroY() const; + double getGyroY() const noexcept; /** * Returns the current Z axis in degrees/s. */ - double getGyroZ() const; + double getGyroZ() const noexcept; /** * Returns the current pitch angle. */ - double getPitch() const; + double getPitch() const noexcept; /** * Returns the current roll angle. */ - double getRoll() const; + double getRoll() const noexcept; /** * Sets the value of a key in the sensor's register. @@ -131,19 +131,19 @@ public: * @param value A new value * @returns Whether or not it succeeded. */ - bool setRegister(uint8_t reg, uint8_t value); + bool setRegister(uint8_t reg, uint8_t value) noexcept; /** * Returns the value of a key in the sensor's registry. * * @param reg The address of a registry key */ - uint8_t getRegister(uint8_t reg); + uint8_t getRegister(uint8_t reg) noexcept; /** * Returns the last sensor status. */ - SensorStatus getStatus(); + SensorStatus getStatus() noexcept; // Accelerometer calibration values double accel_cal_x = 0.0F; @@ -193,5 +193,5 @@ private: double _roll = 0; double _yaw = 0; - int16_t _readHighLow(); + int16_t _readHighLow() noexcept; }; |