Bruno Allaire-Lemay
/
APP1test
df
Fork of APP1 by
Utility.hpp@15:b38d9d210e32, 2017-01-17 (annotated)
- Committer:
- dupm2216
- Date:
- Tue Jan 17 00:06:38 2017 +0000
- Revision:
- 15:b38d9d210e32
- Parent:
- 13:bb9669053eb3
- Child:
- 18:a21199781d20
Fini?
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
dupm2216 | 6:3facf0329142 | 1 | #ifndef UTILITY_HPP |
dupm2216 | 6:3facf0329142 | 2 | #define UTILITY_HPP |
dupm2216 | 6:3facf0329142 | 3 | |
dupm2216 | 6:3facf0329142 | 4 | namespace utility |
dupm2216 | 6:3facf0329142 | 5 | { |
dupm2216 | 6:3facf0329142 | 6 | const double PI = 3.14159265; |
dupm2216 | 6:3facf0329142 | 7 | |
dupm2216 | 6:3facf0329142 | 8 | bool is_almost_equal(double a, double b, double tolerance); |
dupm2216 | 6:3facf0329142 | 9 | |
dupm2216 | 6:3facf0329142 | 10 | //Return angle between 0 and 360 degree |
dupm2216 | 6:3facf0329142 | 11 | double wrap_angle(double angle); |
dupm2216 | 6:3facf0329142 | 12 | double degree_from_radian(const double angle_radian); |
GaiSensei | 12:1c341b119b23 | 13 | |
GaiSensei | 12:1c341b119b23 | 14 | //Calculate the 4 bytes required to represent a previous 4 bytes value |
GaiSensei | 12:1c341b119b23 | 15 | //after changing a single bit at a given position (position 0 being the LSB) |
GaiSensei | 13:bb9669053eb3 | 16 | unsigned int update_bit(const unsigned int previous_4_bytes, const int position, const bool new_bit_value); |
GaiSensei | 13:bb9669053eb3 | 17 | |
dupm2216 | 15:b38d9d210e32 | 18 | unsigned int update_bits(const unsigned int previous_4_bytes, const int start_bit, const int stop_bit, const unsigned int reserved_bits_mask, const unsigned int new_bits_value); |
dupm2216 | 15:b38d9d210e32 | 19 | //Hang the program and blink an LED on the mbed |
dupm2216 | 15:b38d9d210e32 | 20 | void blink(); |
dupm2216 | 9:12519f9dd3cd | 21 | } |
dupm2216 | 6:3facf0329142 | 22 | |
dupm2216 | 6:3facf0329142 | 23 | #endif |