helpfor studient
Dependents: STM32_F103-C8T6basecanblink_led
Fork of mbed-dev by
Diff: targets/TARGET_NXP/TARGET_LPC176X/can_api.c
- Revision:
- 167:e84263d55307
- Parent:
- 149:156823d33999
--- a/targets/TARGET_NXP/TARGET_LPC176X/can_api.c Thu Jun 08 15:02:37 2017 +0100 +++ b/targets/TARGET_NXP/TARGET_LPC176X/can_api.c Wed Jun 21 17:46:44 2017 +0100 @@ -292,7 +292,7 @@ } -void can_init(can_t *obj, PinName rd, PinName td) { +void can_init_freq(can_t *obj, PinName rd, PinName td, int hz) { CANName can_rd = (CANName)pinmap_peripheral(rd, PinMap_CAN_RD); CANName can_td = (CANName)pinmap_peripheral(td, PinMap_CAN_TD); obj->dev = (LPC_CAN_TypeDef *)pinmap_merge(can_rd, can_td); @@ -313,11 +313,15 @@ can_reset(obj); obj->dev->IER = 0; // Disable Interrupts - can_frequency(obj, 100000); + can_frequency(obj, hz); LPC_CANAF->AFMR = ACCF_BYPASS; // Bypass Filter } +void can_init(can_t *obj, PinName rd, PinName td) { + can_init_freq(obj, rd, td, 100000); +} + void can_free(can_t *obj) { switch ((int)obj->dev) { case CAN_1: LPC_SC->PCONP &= ~(1 << 13); break;