# example_basic_comms_router_afzdo.c File Reference

Resets Radio, configures this device to be a Zigbee Router, joins a network, then sends a message to the coordinator once per second. Uses the AF/ZDO interface. Pressing the button will display device information. More...

`#include "../HAL/hal.h"`
`#include "../ZNP/znp_interface.h"`
`#include "../ZNP/application_configuration.h"`
`#include "../ZNP/af_zdo.h"`
`#include "znp_example_utils.h"`

## Defines
#define | TEST_CLUSTER 0x77
void(* | buttonIsr )(char)
void | handleButtonPress (char)
int | main (void)

## Detailed Description

Resets Radio, configures this device to be a Zigbee Router, joins a network, then sends a message to the coordinator once per second. Uses the AF/ZDO interface. Pressing the button will display device information.

Resets Radio, configures this device to be a Zigbee Router, joins a network, then sends a message to the coordinator periodically.

Resets Radio, configures this device to be a Zigbee Router, joins a network, then sends a message to the coordinator once per second. Uses the AF/ZDO interface. Reads the ambient light sensor and supply voltage and sends these in the message. Also sends a message upon a motion interrupt from the accelerometer.

This matches example_basic_communications_COORDINATOR.c Get the coordinator running first, or else the router won't have anything to join to. Basic Router Startup:

- Reset Radio
- Set Startup Options = CLEAR_STATE and CLEAR_CONFIG - This will restore the ZNP to "factory" configuration
- Reset Radio
- Set Zigbee DeviceType to ROUTER
- If you want to set a custom PANID or channel list, do that here and then reset the radio
- Register Application (Configure the ZNP for our application)
- Start Application
- Wait for the Start Confirm

If devices are not communicating, look at the device information fields and verify that both the coordinator and router have the same PAN ID and that the Extended PAN ID of the router matches the MAC address of the coordinator.

Note:
  code size for this example is ~0.5kB larger than SAPI example due to getDeviceInformation() in handleButtonPress().

See also:
  http://processors.wiki.ti.com/index.php/Tutorial_on_the_Examples and http://e2e.ti.com/support/low_power_rf/default.aspx

Rev
  721

Author
  dsmith

Date
  2010-08-19 10:52:40 -0700 (Thu, 19 Aug 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

This matches example_basic_communications_COORDINATOR.c Get the coordinator running first, or else the router won't have anything to join to. Basic Router Startup:

- Reset Radio
- Set Startup Options = CLEAR_STATE and CLEAR_CONFIG - This will restore the ZNP to "factory" configuration
- Reset Radio
- Set Zigbee DeviceType to ROUTER
- If you want to set a custom PANID or channel list, do that here and then reset the radio
- Register Application (Configure the ZNP for our application)
- Start Application
- Wait for the Start Confirm

If devices are not communicating, look at the device information fields and verify that both the coordinator and router have the same PAN ID and that the Extended PAN ID of the router matches the MAC address of the coordinator.

Note:
  code size for this example is ~0.5kB larger than SAPI example due to getDeviceInformation() in handleButtonPress().

See also:
  http://processors.wiki.ti.com/index.php/Tutorial_on_the_Examples and http://e2e.ti.com/support/low_power_rf/default.aspx

Rev
  585

Author
  dsmith

Date
  2010-06-09 18:26:07 -0700 (Wed, 09 Jun 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

Note:
  This matches example_simple_application_coordinator.c
  This example will not compile with the IAR Kickstart edition because CODE + CONST exceeds 4kB

See also:
  http://processors.wiki.ti.com/index.php/Tutorial_on_the_Examples and http://e2e.ti.com/support/low_power_rf/default.aspx

Rev
  602

Author
  dsmith

Date
  2010-06-16 13:09:46 -0700 (Wed, 16 Jun 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

Demonstrates using a state machine with the ZNP. Uses the AF/ZDO interface.

Note:
  This matches example_simple_application_coordinator.c

See also:
  http://processors.wiki.ti.com/index.php/Tutorial_on_the_Examples and http://e2e.ti.com/support/low_power_rf/default.aspx

Rev
  602

Author
  dsmith

Date
  2010-06-16 13:09:46 -0700 (Wed, 16 Jun 2010)

YOU ACKNOWLEDGE AND AGREE THAT THE SOFTWARE AND DOCUMENTATION ARE PROVIDED “AS IS” WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION, ANY WARRANTY OF MERCHANTABILITY, TITLE, NON-INFRINGEMENT AND FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT SHALL TEXAS INSTRUMENTS OR ITS LICENSORS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSES INCLUDING BUT NOT LIMITED TO ANY INCIDENTAL, SPECIAL, INDIRECT, PUNITIVE OR CONSEQUENTIAL DAMAGES, LOST PROFITS OR LOST DATA, COST OF PROCUREMENT OF SUBSTITUTE GOODS, TECHNOLOGY, SERVICES, OR ANY CLAIMS BY THIRD PARTIES (INCLUDING BUT NOT LIMITED TO ANY DEFENSE THEREOF), OR OTHER SIMILAR COSTS.

## Function Documentation

void handleButtonPress | ( | char | btn | ) |

When a button is pressed, display device information

int main | ( | void |  | ) |

Wait until we get on the network. We will receive a ZDO_STATE_CHANGE_IND message whenever the state changes.

## Variable Documentation

void(* buttonIsr)(char)

function pointer (in hal file) for the function that gets called when a button is pressed

All Data Structures Files Functions Variables Defines