XBee and XBee-PRO ZigBee RF modules provide cost-effective wireless connectivity to electronic devices. They are interoperable with other ZigBee PRO feature set devices, including devices from other vendors.

Dependencies:   BufferedArray

Dependents:   MBEDminiproject

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers Pin.cpp Source File

Pin.cpp

00001 #include "Pin.h"
00002 
00003 unsigned char Pin::bitfield[2] = {0,0};
00004 
00005 Pin::Pin(unsigned char number)
00006 {
00007     num = number;
00008 }
00009 
00010 Pin::Pin(unsigned char number, unsigned char msbCom, unsigned char lsbCom, unsigned char msbIODet, unsigned char lsbIODet)
00011 {
00012     num = number;
00013     com[0] = msbCom;
00014     com[1] = lsbCom;
00015     IODet[0] = msbIODet;
00016     IODet[1] = lsbIODet;
00017 }
00018 
00019 unsigned char Pin::getNumber()
00020 {
00021     return num;
00022 }
00023 
00024 char * Pin::getCommand()
00025 {
00026     return com;
00027 }
00028 
00029 unsigned  char * Pin::IOChangeDetectionConfiguration(Pin ** pins, unsigned char size)
00030 {
00031     Pin::bitfield[0] = 0;
00032     Pin::bitfield[1] = 0;
00033     for (int i = 0; i < size; i++) {
00034         Pin::bitfield[0] |= pins[i]->IODet[0];
00035         Pin::bitfield[1] |= pins[i]->IODet[1];
00036     }
00037     return Pin::bitfield;
00038 }
00039 
00040 unsigned  char * Pin::getIODetection()
00041 {
00042     return IODet;
00043 }
00044 
00045 bool operator ==(const Pin &a,const Pin &b)
00046 {
00047     return a.num == b.num;
00048 }