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-22
Revision:
0:837e6c48e90d
Child:
4:a0f1fba6c2fb

File content as of revision 0:837e6c48e90d:

#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(const Pin *Pins, char Length)
{
    Pin::bitfield[0] = 0;
    Pin::bitfield[1] = 0;
    for (const Pin *i = Pins; i< Pins + Length; i++) {
        Pin::bitfield[0] |= i->IODet[0];
        Pin::bitfield[1] |= i->IODet[1];
    }
    return Pin::bitfield;
}

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

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