forked
Diff: drivers/CAN.cpp
- Revision:
- 167:e84263d55307
- Parent:
- 163:74e0ce7f98e8
- Child:
- 169:e3b6fe271b81
diff -r c97ed07ec1a8 -r e84263d55307 drivers/CAN.cpp --- a/drivers/CAN.cpp Thu Jun 08 15:02:37 2017 +0100 +++ b/drivers/CAN.cpp Wed Jun 21 17:46:44 2017 +0100 @@ -34,6 +34,17 @@ can_irq_init(&_can, (&CAN::_irq_handler), (uint32_t)this); } +CAN::CAN(PinName rd, PinName td, int hz) : _can(), _irq() { + // No lock needed in constructor + + for (int i = 0; i < sizeof _irq / sizeof _irq[0]; i++) { + _irq[i].attach(donothing); + } + + can_init_freq(&_can, rd, td, hz); + can_irq_init(&_can, (&CAN::_irq_handler), (uint32_t)this); +} + CAN::~CAN() { // No lock needed in destructor can_irq_free(&_can);