sbsSpawn() for AVR

sbsSpawn creates an instance of a port-based object, permitting it to be turned on and off and permitting access to internal data through the sbsSet() and sbsGet() commands. Several unique instances of each module can be created with the sbsSpawn command. Its calling convention is:

char sbsSpawn(charfnc_ptr f_ptr, uint16_t freq, char fRealTime);

where f_ptr is a function pointer to an xxx_init() function, freq is the default execution (cycling) frequency (in Hertz) of the module, and fRealTime is a user-defined parameter passed to the xxx_init() routine. (Set this value to zero if not defined.) The return value is an index into a statically allocated array that permits access and use of the module.

sbsSpawn() creates an instance of the module and calls the function xxx_init(). xxx_init() is called as:


char xxx_init(uint8_t index)

where index is the index to the process pointer created (and returned) by sbsSpawn() and vptr is not implemented in the AVR version of sbsSpawn(). Because dynamic memory allocation is used during sbsSpawn(), it should not be called during real-time operation.


Prof. Voyles' Home Page

Copyright: © 2003,2008-2010 by Richard Voyles. All rights reserved.
Department of Electrical and Computer Engineering, University of Denver.

Maintained by Richard Voyles
Last modified: Apr. 24, 2010