I'm using the teensy 4.1 for a new project. The project uses a lot of IO. I have maxed out the T41 pins and added a few analogue and digital multiplexers as well.
I am designing the code structure now and, I am considering avoiding hard coding all the IO and instead using a data defined structure to the program. All the state information would be stored in a linked list of objects that get created at setup time according to a config file and updated at run time according to a set of rules.
The low level code that actually manipulates the pins, or rather makes the library calls to manipulate the pins, would be more of less the same in both cases.
One difference between this approach and a simpler hard code everything approach is that I think this approach would use primarily heap memory where as the simpler hard coding everything approach would use stack memory. (Even though it would be using the heap the memory would be allocated at setup and not changed, so there would not be a problem with fragmentation.)
I would be very grateful if someone experienced in T41 could advise if there is a big speed difference in using the heap v stack and if there are any other pitfalls of this approach?
I am designing the code structure now and, I am considering avoiding hard coding all the IO and instead using a data defined structure to the program. All the state information would be stored in a linked list of objects that get created at setup time according to a config file and updated at run time according to a set of rules.
The low level code that actually manipulates the pins, or rather makes the library calls to manipulate the pins, would be more of less the same in both cases.
One difference between this approach and a simpler hard code everything approach is that I think this approach would use primarily heap memory where as the simpler hard coding everything approach would use stack memory. (Even though it would be using the heap the memory would be allocated at setup and not changed, so there would not be a problem with fragmentation.)
I would be very grateful if someone experienced in T41 could advise if there is a big speed difference in using the heap v stack and if there are any other pitfalls of this approach?