![]() |
Hummingbird Flight Software
Flight software for the Hummingbird FCU quadcopter flight controller. Designed to run on the Teensy 4.1. Developed with VSCode+PlatformIO.
|
Go to the source code of this file.
Classes | |
class | Matrix |
A matrix object is definied by it's rows and columns. More... | |
Macros | |
#define | MATRIX_ELEMENT(MAT, i, j, rows, cols) *(MAT + i*cols + j) |
A matrix object is definied by it's rows and columns. More... | |
#define MATRIX_ELEMENT | ( | MAT, | |
i, | |||
j, | |||
rows, | |||
cols | |||
) | *(MAT + i*cols + j) |
A matrix object is definied by it's rows and columns.
When a matrix object is created, the array is allocated on the heap (RAM2 for Teensy 4.1) with the C++ 'new' keyword as an array of pointers. See the following resource to learn more.
https://www.techiedelight.com/dynamic-memory-allocation-in-c-for-2d-3d-array/ https://dev.to/drakargx/c-contiguous-allocation-of-2-d-arrays-446m Macro to extract the value in matrix "MAT" at "MAT(i, j)" with dims. "(rows, cols)." Matrices are stored as a long 1D array, so this macro makes 2D array indexing a bit easier. IT IS UP TO THE USER TO ENSURE THAT THE INDICES DO NOT EXCEED THE MATRIX DIMENSIONS!
MAT | Matrix variable name |
i | Row index |
j | Column index |
rows | Number of rows in the matrix |
cols | Number of cols in the matrix |