If we have arrays:
How to fill them from Inline-C ?
This code does not allow it with error:
B4X:
Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Dim FreqX(20), MagX(20), RmsX As Double
Dim FreqY(20), MagY(20), RmsY As Double
Dim FreqZ(20), MagZ(20), RmsZ As Double
End Sub
How to fill them from Inline-C ?
C++:
struct PeakInfo {
double frequency;
double amplitude;
double rms;
};
....
for (int i = 0; i < MAX_PEAKS; i++) {
b4r_espmpu6050_fft::_freqx->data[i] = peaksX[i].frequency;
b4r_espmpu6050_fft::_magx->data[i] = peaksX[i].amplitude;
b4r_espmpu6050_fft::_freqy->data[i] = peaksY[i].frequency;
b4r_espmpu6050_fft::_magy->data[i] = peaksY[i].amplitude;
b4r_espmpu6050_fft::_freqz->data[i] = peaksZ[i].frequency;
b4r_espmpu6050_fft::_magz->data[i] = peaksZ[i].amplitude;
}
This code does not allow it with error:
\b4r_espmpu6050_fft.cpp:282:47: error: 'void*' is not a pointer-to-object type
282 | b4r_espmpu6050_fft::_freqx->data = peaksX.frequency;