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

Device/Pin.cpp

Committer:
yangcq88517
Date:
2015-10-30
Revision:
4:a0f1fba6c2fb
Parent:
0:837e6c48e90d
Child:
6:5f31ddc17239

File content as of revision 4:a0f1fba6c2fb:

#include "Pin.h"

char Pin::bitfield[2] = {0,0};

Pin::Pin(char number)
{
    num = number;
}

Pin::Pin(char number, char msbCom, char lsbCom, char msbIODet, char lsbIODet)
{
    num = number;
    com[0] = msbCom;
    com[1] = lsbCom;
    IODet[0] = msbIODet;
    IODet[1] = lsbIODet;
}

char Pin::getNumber()
{
    return num;
}

char * Pin::getCommand()
{
    return com;
}

char * Pin::IOChangeDetectionConfiguration(Pin ** pins, char size)
{
    Pin::bitfield[0] = 0;
    Pin::bitfield[1] = 0;
    for (int i = 0; i < size; i++) {
        Pin::bitfield[0] |= pins[i]->IODet[0];
        Pin::bitfield[1] |= pins[i]->IODet[1];
    }
    return Pin::bitfield;
}

char * Pin::getIODetection()
{
    return IODet;
}

bool operator <(const Pin &a,const Pin &b)
{
    return a.num < b.num;
}