The callback functions

Callback functions are the functions used to handle the various TWENET events as they occur (flow diagram), all of which need to be implemented when building an application with the TWENET library. The most important function is cbAppColdStart(), which is the equivalent of the general main() function.

  • cbAppColdStart() – Function called on power up

  • cbAppWarmStart() – Function called when sleep is restored

  • cbToCoNet_vMain() – The main loop is not an infinite loop, but is called when an interrupt or other event occurs.

  • cbToCoNet_vRxEvent() – Called when a radio packet is received

  • cbToCoNet_vTxEvent() – Called when radio packet transmission is complete

  • cbToCoNet_vNwkEvent() – Various event notifications at MAC and network layers

  • cbToCoNet_vHwEvent () – Delayed execution section of peripheral interrupt processing. Called after interrupt processing.

  • cbToCoNet_u8HwInt() – Peripheral interrupt handlers

  • User defined event handling functions – 状Describes task processing with state transitions

Both callback functions need to return control after they have been called, and writing very long processes will affect the overall behaviour. Particular care should be taken when writing interrupt handlers.

最終更新