User`s guide
FreeStar Pro SMAC Programmers’ Guide
Rev B 0006-00-08-02-000 Page 7 of 34
Table 2 – Code, “generic_app.c” – “main” function
generic
_
app.c
/************************************************************************************
* main function
*
* Executes the main function.
*
************************************************************************************/
void Main(void)
{
MSG_INIT(TX_msg, &dataTX, NULL);
MSG_INIT(RX_msg, &dataRX, (callback_t)(application_rx_cb));
RX_msg.u8BufSize = APP_PACK_SZ;
generic_app_init();
for(;;)
{
// (void)process_radio_msg();
// data_indication_execute();
// process_uart_data();
// generic_app();
MainState();
}
}
/************************************************************************************
In the Main() function in
Table 2, notice that the default contents of the ‘for’ loop are commented out and a function
named ‘MainState()’; is called instead. This makes porting the application code to new
codebases, or other projects quicker and cleaner.
Several files created by BeeKit™ had to be modified. They include changes to:
o project settings
o TransceiverConfigMngmnt.h file
o generic_app.c file
o UartUtil.c file
o WirelessLinkMngmt.c file
These changes are fully documented at the top of the ‘main_state.c’ file and are shown in
Table 3.
Table 3 – Code, “main_state.c” – Changes to BeeStack Generated Code
main
_
state.c
//////////////////////////////////////////////////////////////////////////////////
// Filename: main_state.c
//
// Description: this is the main state machine for the application
// it is kept in a different function than main() so that
// it is easier to keep the project in tact as new versions
// of the SMAC codebase are released. An attempt will be made
// in this file to document any changes to BeeKit generated
// code. This will again make it easier to keep the project in