|
Infuse-IoT SDK API 0.0.1
A Scalable Open Source RTOS
|
Macros | |
| #define | math_abs(x) |
| Absolute value. | |
Functions | |
| uint8_t | math_sqrt16 (uint16_t x) |
| Compute square root of unsigned 16 bit number. | |
| uint16_t | math_sqrt32 (uint32_t x) |
| Compute square root of unsigned 32 bit number. | |
| uint32_t | math_sqrt64 (uint64_t x) |
| Compute square root of unsigned 64 bit number. | |
| float | math_inverse_sqrt32 (float x) |
| Fast inverse square root. | |
| uint32_t | math_vector_xy_sq_magnitude (int16_t x, int16_t y) |
| Compute the squared magnitude of an XY vector. | |
| uint16_t | math_vector_xy_magnitude (int16_t x, int16_t y) |
| Compute the magnitude of an XY vector. | |
| uint32_t | math_vector_xyz_sq_magnitude (int16_t x, int16_t y, int16_t z) |
| Compute the squared magnitude of an XYZ vector. | |
| uint16_t | math_vector_xyz_magnitude (int16_t x, int16_t y, int16_t z) |
| Compute the magnitude of an XYZ vector. | |
| int64_t | math_vector_xyz_dot_product (int16_t ax, int16_t ay, int16_t az, int16_t bx, int16_t by, int16_t bz) |
| Compute the dot product of two XYZ vectors. | |
| int32_t | math_vector_xyz_dot_product_fast (int16_t ax, int16_t ay, int16_t az, int16_t bx, int16_t by, int16_t bz) |
| Compute the dot product of two XYZ vectors. | |
| uint32_t | math_bitmask_get_next_bits (uint32_t bitmask, uint8_t start_idx, uint8_t *next_idx, uint8_t num_bits) |
| Get the next N bits of a bitmask, with rollover. | |
| #define math_abs | ( | x | ) |
#include <infuse/math/common.h>
Absolute value.
| x | Value to absolute |
| uint32_t math_bitmask_get_next_bits | ( | uint32_t | bitmask, |
| uint8_t | start_idx, | ||
| uint8_t * | next_idx, | ||
| uint8_t | num_bits ) |
#include <infuse/math/common.h>
Get the next N bits of a bitmask, with rollover.
| bitmask | Bitmask to iterate over |
| start_idx | Index of first bit to check |
| next_idx | Index of first bit to check on next iteration |
| num_bits | Number of bits to return |
| float math_inverse_sqrt32 | ( | float | x | ) |
#include <infuse/math/common.h>
Fast inverse square root.
| x | Value to compute inverse square root of |
| uint8_t math_sqrt16 | ( | uint16_t | x | ) |
#include <infuse/math/common.h>
Compute square root of unsigned 16 bit number.
| x | Value to square root |
| uint16_t math_sqrt32 | ( | uint32_t | x | ) |
#include <infuse/math/common.h>
Compute square root of unsigned 32 bit number.
| x | Value to square root |
| uint32_t math_sqrt64 | ( | uint64_t | x | ) |
#include <infuse/math/common.h>
Compute square root of unsigned 64 bit number.
| x | Value to square root |
| uint16_t math_vector_xy_magnitude | ( | int16_t | x, |
| int16_t | y ) |
#include <infuse/math/common.h>
Compute the magnitude of an XY vector.
| x | X component of vector |
| y | Y component of vector |
| uint32_t math_vector_xy_sq_magnitude | ( | int16_t | x, |
| int16_t | y ) |
#include <infuse/math/common.h>
Compute the squared magnitude of an XY vector.
| x | X component of vector |
| y | Y component of vector |
| int64_t math_vector_xyz_dot_product | ( | int16_t | ax, |
| int16_t | ay, | ||
| int16_t | az, | ||
| int16_t | bx, | ||
| int16_t | by, | ||
| int16_t | bz ) |
#include <infuse/math/common.h>
Compute the dot product of two XYZ vectors.
The maximum value of the output is 1.5 * (2 ** 31), when all inputs are INT16_MIN.
| ax | A vector, X component |
| ay | A vector, Y component |
| az | A vector, Z component |
| bx | B vector, X component |
| by | B vector, Y component |
| bz | B vector, Z component |
| int32_t math_vector_xyz_dot_product_fast | ( | int16_t | ax, |
| int16_t | ay, | ||
| int16_t | az, | ||
| int16_t | bx, | ||
| int16_t | by, | ||
| int16_t | bz ) |
#include <infuse/math/common.h>
Compute the dot product of two XYZ vectors.
A faster variant of math_vector_xyz_dot_product that assumes the dot product fits in an int32_t, which will be true for most, but not all, inputs.
| ax | A vector, X component |
| ay | A vector, Y component |
| az | A vector, Z component |
| bx | B vector, X component |
| by | B vector, Y component |
| bz | B vector, Z component |
| uint16_t math_vector_xyz_magnitude | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | z ) |
#include <infuse/math/common.h>
Compute the magnitude of an XYZ vector.
| x | X component of vector |
| y | Y component of vector |
| z | Z component of vector |
| uint32_t math_vector_xyz_sq_magnitude | ( | int16_t | x, |
| int16_t | y, | ||
| int16_t | z ) |
#include <infuse/math/common.h>
Compute the squared magnitude of an XYZ vector.
| x | X component of vector |
| y | Y component of vector |
| z | Z component of vector |