Skip to content

Commit 1ef06f5

Browse files
committed
Set size of callback irq array to IrqCnt
Rather than hard coding the size of the callback array for irqs, instead set the size to IrqCnt which is defined by the irq enumeration.
1 parent 9111aa4 commit 1ef06f5

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

hal/api/CAN.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,9 @@ class CAN {
203203
EpIrq,
204204
AlIrq,
205205
BeIrq,
206-
IdIrq
206+
IdIrq,
207+
208+
IrqCnt
207209
};
208210

209211
/** Attach a function to call whenever a CAN frame received interrupt is
@@ -246,7 +248,7 @@ class CAN {
246248
virtual void lock();
247249
virtual void unlock();
248250
can_t _can;
249-
Callback<void()> _irq[9];
251+
Callback<void()> _irq[IrqCnt];
250252
PlatformMutex _mutex;
251253
};
252254

hal/api/SerialBase.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ class SerialBase {
5555

5656
enum IrqType {
5757
RxIrq = 0,
58-
TxIrq
58+
TxIrq,
59+
60+
IrqCnt
5961
};
6062

6163
enum Flow {
@@ -231,7 +233,7 @@ class SerialBase {
231233
#endif
232234

233235
serial_t _serial;
234-
Callback<void()> _irq[2];
236+
Callback<void()> _irq[IrqCnt];
235237
int _baud;
236238

237239
};

0 commit comments

Comments
 (0)