File tree Expand file tree Collapse file tree 6 files changed +15
-12
lines changed Expand file tree Collapse file tree 6 files changed +15
-12
lines changed Original file line number Diff line number Diff line change @@ -77,7 +77,7 @@ class BusIn {
77
77
78
78
/* * Access to particular bit in random-iterator fashion
79
79
*/
80
- DigitalIn & operator [] (unsigned int index);
80
+ DigitalIn & operator [] (int index);
81
81
#endif
82
82
83
83
protected:
Original file line number Diff line number Diff line change @@ -90,6 +90,10 @@ class BusInOut {
90
90
BusInOut& operator = (int v);
91
91
BusInOut& operator = (BusInOut& rhs);
92
92
93
+ /* * Access to particular bit in random-iterator fashion
94
+ */
95
+ DigitalInOut& operator [] (int index);
96
+
93
97
/* * A shorthand for read()
94
98
*/
95
99
operator int ();
@@ -108,7 +112,6 @@ class BusInOut {
108
112
private:
109
113
BusInOut (const BusInOut&);
110
114
BusInOut & operator = (const BusInOut&);
111
- DigitalInOut& operator [] (unsigned int index);
112
115
};
113
116
114
117
} // namespace mbed
Original file line number Diff line number Diff line change @@ -76,7 +76,7 @@ class BusOut {
76
76
77
77
/* * Access to particular bit in random-iterator fashion
78
78
*/
79
- DigitalOut& operator [] (unsigned int index);
79
+ DigitalOut& operator [] (int index);
80
80
81
81
/* * A shorthand for read()
82
82
*/
Original file line number Diff line number Diff line change @@ -72,9 +72,9 @@ BusIn::operator int() {
72
72
return read ();
73
73
}
74
74
75
- DigitalIn& BusIn::operator [] (unsigned int index) {
76
- // MBED_ASSERT(index >= MBED_BUS_SIZE);
77
- // MBED_ASSERT(_pin[index]);
75
+ DigitalIn& BusIn::operator [] (int index) {
76
+ MBED_ASSERT (index < 0 || index >= MBED_BUS_SIZE);
77
+ MBED_ASSERT (_pin[index]);
78
78
if (index >= 16 || _pin[index] == NULL ) {
79
79
return din_dummy;
80
80
}
Original file line number Diff line number Diff line change @@ -102,9 +102,9 @@ BusInOut& BusInOut::operator= (BusInOut& rhs) {
102
102
return *this ;
103
103
}
104
104
105
- DigitalInOut& BusInOut::operator [] (unsigned int index) {
106
- // MBED_ASSERT(index >= MBED_BUS_SIZE);
107
- // MBED_ASSERT(_pin[index]);
105
+ DigitalInOut& BusInOut::operator [] (int index) {
106
+ MBED_ASSERT (index < 0 || index >= MBED_BUS_SIZE);
107
+ MBED_ASSERT (_pin[index]);
108
108
if (index >= 16 || _pin[index] == NULL ) {
109
109
return dinout_dummy;
110
110
}
Original file line number Diff line number Diff line change @@ -78,9 +78,9 @@ BusOut& BusOut::operator= (BusOut& rhs) {
78
78
return *this ;
79
79
}
80
80
81
- DigitalOut& BusOut::operator [] (unsigned int index) {
82
- // MBED_ASSERT(index >= MBED_BUS_SIZE);
83
- // MBED_ASSERT(_pin[index]);
81
+ DigitalOut& BusOut::operator [] (int index) {
82
+ MBED_ASSERT (index < 0 || index >= MBED_BUS_SIZE);
83
+ MBED_ASSERT (_pin[index]);
84
84
if (index >= 16 || _pin[index] == NULL ) {
85
85
return dout_dummy;
86
86
}
You can’t perform that action at this time.
0 commit comments