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_simple_application_coordinator_afzdo.c File Reference
Simple Applications

Resets Module, configures this device to be a Zigbee Coordinator, and displays any messages that are received. If the message contains a known object-identifier (OID) then parses the contents of the OID. Also displays received value to RGB LED and allows user to use the pushbutton to select which OID is displayed on the RGB LED. More...

`#include "../HAL/hal.h"`
`#include "../ZM/module.h"`
`#include "../ZM/application_configuration.h"`
`#include "../ZM/af.h"`
`#include "../ZM/zdo.h"`
`#include "../ZM/zm_phy_spi.h"`
`#include "../ZM/module_errors.h"`
`#include "../ZM/module_utilities.h"`
`#include "../Common/utilities.h"`
`#include "Messages/infoMessage.h"`
`#include "Messages/kvp.h"`
`#include "Messages/oids.h"`
`#include "module_example_utils.h"`
`#include <stdint.h>`

## Macros
#define | BUTTON_DEBOUNCE_TIME_MS 150
#define | BUTTON_POLL_INTERVAL_MS 5
#define | MODULE_START_DELAY_IF_FAIL_MS 5000
#define | NO_VALUE_RECEIVED 0xFF
#define | RED_VALUE (im.kvps[redIndex].value)
#define | BLUE_VALUE (im.kvps[blueIndex].value)
#define | GREEN_VALUE (im.kvps[greenIndex].value)
#define | STATE_FLAG_MESSAGE_WAITING 0x01
#define | STATE_FLAG_BUTTON_PRESSED 0x02
#define | NWK_OFFLINE 0
#define | NWK_ONLINE 1
#define | RGB_LED_DISPLAY_MODE_NONE 0
#define | RGB_LED_DISPLAY_MODE_TEMP_IR 1
#define | RGB_LED_DISPLAY_MODE_COLOR 2
#define | RGB_LED_DISPLAY_MODE_MAX RGB_LED_DISPLAY_MODE_COLOR
#define | IS_INFO_MESSAGE_CLUSTER() (CONVERT_TO_INT(zmBuf[AF_INCOMING_MESSAGE_CLUSTER_LSB_FIELD], zmBuf[AF_INCOMING_MESSAGE_CLUSTER_MSB_FIELD]) == INFO_MESSAGE_CLUSTER)
enum | STATE { STATE_IDLE, STATE_INIT, STATE_MODULE_STARTUP, STATE_GET_DEVICE_TYPE, STATE_DISPLAY_NETWORK_INFORMATION, STATE_SEND_MESSAGE_VIA_LONG_ADDRESS, STATE_SEND_MESSAGE_VIA_SHORT_ADDRESS, STATE_VALID_SHORT_ADDRESS_ENTERED, STATE_VALID_LONG_ADDRESS_ENTERED, STATE_FIND_VIA_SHORT_ADDRESS, STATE_FIND_VIA_LONG_ADDRESS, STATE_IDLE, STATE_MODULE_STARTUP, STATE_DISPLAY_NETWORK_INFORMATION, STATE_IDLE, STATE_MODULE_STARTUP, STATE_SEND_INFO_MESSAGE, STATE_DISPLAY_NETWORK_INFORMATION, STATE_IDLE, STATE_MODULE_STARTUP, STATE_SEND_INFO_MESSAGE, STATE_DISPLAY_NETWORK_INFORMATION }
void(* | buttonIsr )(int8_t)
enum STATE | state = STATE_MODULE_STARTUP
volatile uint16_t | stateFlags = 0
uint8_t | zigbeeNetworkStatus = NWK_OFFLINE
uint8_t | rgbLedDisplayMode = 0
uint8_t | zmBuf [ZIGBEE_MODULE_BUFFER_SIZE]
int | main (void)
void | processButtonPress ()

## Detailed Description

Resets Module, configures this device to be a Zigbee Coordinator, and displays any messages that are received. If the message contains a known object-identifier (OID) then parses the contents of the OID. Also displays received value to RGB LED and allows user to use the pushbutton to select which OID is displayed on the RGB LED.

Uses the AF/ZDO interface.

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.

## Enumeration Type Documentation

enum STATE

STATES for state machine

## Function Documentation

void processButtonPress | ( |  | ) |

Called from state machine when a button was pressed. Selects which KVP value is displayed on the RGB LED.

## 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.

enum STATE state = STATE_MODULE_STARTUP

This is the current state of the application. Gets changed by other states, or based on messages that arrive.

volatile uint16_t stateFlags = 0

Various flags between states

uint8_t zigbeeNetworkStatus = NWK_OFFLINE

Whether the zigbee network has been started, etc.

uint8_t zmBuf[ZIGBEE_MODULE_BUFFER_SIZE]

    This buffer will hold the transmitted messages and received SRSP Payload after sendMessage() was

called. If fragmentation support is not required then this can be smaller, e.g. 100B.