df

Dependencies:   mbed

Fork of APP1 by Team APP

Utility.hpp

Committer:
GaiSensei
Date:
2017-01-15
Revision:
12:1c341b119b23
Parent:
9:12519f9dd3cd
Child:
13:bb9669053eb3

File content as of revision 12:1c341b119b23:

#ifndef UTILITY_HPP
#define UTILITY_HPP

namespace utility
{
    const double PI = 3.14159265;

    bool is_almost_equal(double a, double b, double tolerance);

    //Return angle between 0 and 360 degree
    double wrap_angle(double angle);
    double degree_from_radian(const double angle_radian);
    
    //Calculate the 4 bytes required to represent a previous 4 bytes value
    //after changing a single bit at a given position (position 0 being the LSB)
    int update_bit(const int previous_byte, const int position, const bool new_bit_value);
}

#endif