Zigbee Module Examples

- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Macros
example_basic_comms_end_device_afzdo.c File Reference
Communications Examples

Resets Radio, configures this device to be a Zigbee End Device, joins a network, then sends a message to the coordinator every few seconds. Sleeps inbetween transmissions. Will also transmit a message when the button is pressed. More...

`#include "../HAL/hal.h"`
`#include "../ZM/module.h"`
`#include "../ZM/module_errors.h"`
`#include "../ZM/module_utilities.h"`
`#include "../ZM/af.h"`
`#include "../ZM/zdo.h"`
`#include "module_example_utils.h"`

## Macros
#define | MODULE_START_DELAY_IF_FAIL_MS 5000
#define | TEST_CLUSTER 0x77
#define | RESTART_AFTER_ZM_FAILURE
#define | SEND_MESSAGE_ON_TIMER
void(* | timerIsr )(void)
void(* | buttonIsr )(int8_t)
moduleResult_t | result
uint8_t | counter = 0
uint8_t | testMessage [] = {0xA0,0xA1,0xA2,0xA3,0xA4}
void | handleTimer ()
void | handleButtonPress (int8_t whichButton)
int | main (void)

## Detailed Description

Resets Radio, configures this device to be a Zigbee End Device, joins a network, then sends a message to the coordinator every few seconds. Sleeps inbetween transmissions. Will also transmit a message when the button is pressed.

Calibrates the Very-Low-Power Oscillator (VLO) in the MSP430. Uses VLO to wakup the processor. Note: you could also use an external 32kHz xtal for more accuracy/stability

Uses the AF/ZDO interface.

This matches example_basic_communications_coordinator.c Get the coordinator running first, or else the end device won't have anything to join to.

Rev:
  1642

Author:
  dsmith

Date:
  2012-10-31 11:17:04 -0700 (Wed, 31 Oct 2012)

# Support

Please refer to the wiki at www.anaren.com/air-wiki-zigbee for more information. Additional support is available via email at the following addresses:

- Questions on how to use the product: AIR@a.nosp@m.nare.nosp@m.n.com
- Feature requests, comments, and improvements: featu.nosp@m.rere.nosp@m.quest.nosp@m.s@te.nosp@m.slaco.nosp@m.ntro.nosp@m.ls.co.nosp@m.m
- Consulting engagements: sales.nosp@m.@tes.nosp@m.lacon.nosp@m.trol.nosp@m.s.com

# License

Copyright (c) 2012 Tesla Controls. All rights reserved. This Software may only be used with an Anaren A2530E24AZ1, A2530E24CZ1, A2530R24AZ1, or A2530R24CZ1 module. Redistribution and use in source and binary forms, with or without modification, are subject to the Software License Agreement in the file "anaren_eula.txt"

YOU FURTHER 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 ANAREN MICROWAVE OR TESLA CONTROLS BE LIABLE OR OBLIGATED UNDER CONTRACT, NEGLIGENCE, STRICT LIABILITY, CONTRIBUTION, BREACH OF WARRANTY, OR OTHER LEGAL EQUITABLE THEORY ANY DIRECT OR INDIRECT DAMAGES OR EXPENSE 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

static void handleButtonPress | ( | int8_t | button | ) |

Handles button interrupt

When a button is pressed, display device information

    Button interrupt service routine. Called when interrupt generated on the button.

Parameters:

  button | which button was pressed.

Precondition:
  Button connects input to GND.
  pins are configured as interrupts appropriately and have pull-UP resistors.

Button interrupt service routine. Called when interrupt generated on the button.

Precondition:
  Button connects input to GND.
  pins are configured as interrupts appropriately and have pull-UP resistors.

void handleTimer | ( |  | ) |

Handles timer interrupt

    Timer interrupt service routine. Called when interrupt generated by the timer.

Precondition:
  global interrupts have been enabled
  timerIsr function pointer has been pointed to this function, e.g.

      timerIsr =

  Timer has been configured with initTimer()

int main | ( | void |  | ) |

Calibrate the Very Low Power Oscillator (VLO) to use for sleep timing

## Variable Documentation

void(* buttonIsr)(int8_t)

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

    Function pointer for the ISR called when the button is pressed.

Parameter is which button was pressed.

Function pointer for the ISR called when the button is pressed. Parameter is which button was pressed.

Function pointer for the ISR called when a button is pressed. Parameter is which button.

moduleResult_t result

Used to store return value from module operations

void(* timerIsr)(void)

function pointer (in hal file) for the function that gets called when the timer generates an int

Function pointer for the ISR called when a timer generates an interrupt