problem with large tables. Teensy 3.6

Status
Not open for further replies.
not sure if this is a bug or if I am missing something.
I'm porting something over from a Due to test on a Teensy 3.6
I have a giant LUT that I have as a separate file (for readability on my part).
it is a table of 12801 entries.
I have used both PROGMEM (which is what I did in the Due) and const to try and sti
neither works.

the error is:

struct_space_wtf: In function 'void setup()':
struct_space_wtf:9: error: 'synthCalc' was not declared in this scope
myTimer.begin(synthCalc, 25);
^
'synthCalc' was not declared in this scope

if I comment out the #include, it works fine, if I don't I get this error.

code attached:
 

Attachments

  • struct_space_wtf.ino
    333 bytes · Views: 122
  • cents_fp226_out.h
    75 KB · Views: 126
Perhaps this example shows it done in a usable way: ...\hardware\teensy\avr\libraries\Audio\examples\Tutorial\Part_3_02_Fourier_Transform

It includes the data array in a cpp file:
const unsigned int AudioSampleGuitar[36929] = {
0x02024100,0x15100903,0x17171817, ... };
then uses the .h file to share with the .ino file:
extern const unsigned int AudioSampleGuitar[36929];

Not sure why but when I was doing something similar - this made it work when other attempts failed.
 
Just looks to me that you need a function prototype or definition of synthCalc before you use it.

So either put the following line above the setup function

void synthCalc (void);

or put the synthCalc function before the setup function.


The only thing that's puzzling is that you say it works without the #include.
 
Just looks to me that you need a function prototype or definition of synthCalc before you use it.

So either put the following line above the setup function

void synthCalc (void);

or put the synthCalc function before the setup function.

Yes,
it is typical for Arduino precompiler (ino to cpp) that to allow bad programming style (no need for function declaration before use)
it not only includes Arduino.h but also generates forward function declarations, ignoring the program structure of the user.
It is always good idea to check the generated *.ino.cpp file if compile errors do not make sense.
 
Just looks to me that you need a function prototype or definition of synthCalc before you use it.

So either put the following line above the setup function

void synthCalc (void);

or put the synthCalc function before the setup function.


The only thing that's puzzling is that you say it works without the #include.


okay, either of those two approaches work fine, so I'm going to stop messing with it while I am ahead!

I double checked this morning (after everything had been off a while) just to make sure it wasn't an odd computer (PC) glitch and I still get the same behavior of: working not #include, error with #include.
Ultimately I don't care since your solution works and apparently is better form anyway!

Thx!

--Marcus
 
Status
Not open for further replies.
Back
Top