mirror of https://github.com/ARMmbed/mbed-os.git
* Changed Bus operator[]() parameter from unsigned int to int to match mbed code
guidelines. * Uncommented assertions in operators and added check for operator[] index < 0. * Moved one operator from private to public, this was a typo thing.pull/808/head
parent
32cea97577
commit
7d54c82331
|
@ -77,7 +77,7 @@ public:
|
||||||
|
|
||||||
/** Access to particular bit in random-iterator fashion
|
/** Access to particular bit in random-iterator fashion
|
||||||
*/
|
*/
|
||||||
DigitalIn & operator[] (unsigned int index);
|
DigitalIn & operator[] (int index);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
|
@ -90,6 +90,10 @@ public:
|
||||||
BusInOut& operator= (int v);
|
BusInOut& operator= (int v);
|
||||||
BusInOut& operator= (BusInOut& rhs);
|
BusInOut& operator= (BusInOut& rhs);
|
||||||
|
|
||||||
|
/** Access to particular bit in random-iterator fashion
|
||||||
|
*/
|
||||||
|
DigitalInOut& operator[] (int index);
|
||||||
|
|
||||||
/** A shorthand for read()
|
/** A shorthand for read()
|
||||||
*/
|
*/
|
||||||
operator int();
|
operator int();
|
||||||
|
@ -108,7 +112,6 @@ protected:
|
||||||
private:
|
private:
|
||||||
BusInOut(const BusInOut&);
|
BusInOut(const BusInOut&);
|
||||||
BusInOut & operator = (const BusInOut&);
|
BusInOut & operator = (const BusInOut&);
|
||||||
DigitalInOut& operator[] (unsigned int index);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace mbed
|
} // namespace mbed
|
||||||
|
|
|
@ -76,7 +76,7 @@ public:
|
||||||
|
|
||||||
/** Access to particular bit in random-iterator fashion
|
/** Access to particular bit in random-iterator fashion
|
||||||
*/
|
*/
|
||||||
DigitalOut& operator[] (unsigned int index);
|
DigitalOut& operator[] (int index);
|
||||||
|
|
||||||
/** A shorthand for read()
|
/** A shorthand for read()
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -72,9 +72,9 @@ BusIn::operator int() {
|
||||||
return read();
|
return read();
|
||||||
}
|
}
|
||||||
|
|
||||||
DigitalIn& BusIn::operator[] (unsigned int index) {
|
DigitalIn& BusIn::operator[] (int index) {
|
||||||
//MBED_ASSERT(index >= MBED_BUS_SIZE);
|
MBED_ASSERT(index < 0 || index >= MBED_BUS_SIZE);
|
||||||
//MBED_ASSERT(_pin[index]);
|
MBED_ASSERT(_pin[index]);
|
||||||
if (index >= 16 || _pin[index] == NULL) {
|
if (index >= 16 || _pin[index] == NULL) {
|
||||||
return din_dummy;
|
return din_dummy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,9 +102,9 @@ BusInOut& BusInOut::operator= (BusInOut& rhs) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
DigitalInOut& BusInOut::operator[] (unsigned int index) {
|
DigitalInOut& BusInOut::operator[] (int index) {
|
||||||
//MBED_ASSERT(index >= MBED_BUS_SIZE);
|
MBED_ASSERT(index < 0 || index >= MBED_BUS_SIZE);
|
||||||
//MBED_ASSERT(_pin[index]);
|
MBED_ASSERT(_pin[index]);
|
||||||
if (index >= 16 || _pin[index] == NULL) {
|
if (index >= 16 || _pin[index] == NULL) {
|
||||||
return dinout_dummy;
|
return dinout_dummy;
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,9 +78,9 @@ BusOut& BusOut::operator= (BusOut& rhs) {
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
DigitalOut& BusOut::operator[] (unsigned int index) {
|
DigitalOut& BusOut::operator[] (int index) {
|
||||||
//MBED_ASSERT(index >= MBED_BUS_SIZE);
|
MBED_ASSERT(index < 0 || index >= MBED_BUS_SIZE);
|
||||||
//MBED_ASSERT(_pin[index]);
|
MBED_ASSERT(_pin[index]);
|
||||||
if (index >= 16 || _pin[index] == NULL) {
|
if (index >= 16 || _pin[index] == NULL) {
|
||||||
return dout_dummy;
|
return dout_dummy;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue