JasonWB007
Programmer
Hi all,
I am in the process of reworking some of my code so that some of the more resuable functions are collected into libraries that will be linked in with multiple applications. One of these functions is a serial port driver and the way it is set up, it requires access to several flags and also a timer that is incremented by an ISR outside of the serial port driver library.
My question is this - what is the best and most proper way to define an interface to this .lib file that is linked in with the final code. Specifically:
1. Should I strive to eliminate variables accessed within the libray that need to be defined externally?
2. If I have large (static) buffers that need to be defined (e.g. int bigbuf[BUF_SIZE]), should this best be done internally to the library or externally and have pointers passed to the library routines.
3. Up until now, I have had three flags that control execution (e.g. OutputBusyFlag, etc.) How should I handle these?
Thanks,
Jason
I am in the process of reworking some of my code so that some of the more resuable functions are collected into libraries that will be linked in with multiple applications. One of these functions is a serial port driver and the way it is set up, it requires access to several flags and also a timer that is incremented by an ISR outside of the serial port driver library.
My question is this - what is the best and most proper way to define an interface to this .lib file that is linked in with the final code. Specifically:
1. Should I strive to eliminate variables accessed within the libray that need to be defined externally?
2. If I have large (static) buffers that need to be defined (e.g. int bigbuf[BUF_SIZE]), should this best be done internally to the library or externally and have pointers passed to the library routines.
3. Up until now, I have had three flags that control execution (e.g. OutputBusyFlag, etc.) How should I handle these?
Thanks,
Jason