Skip to content

Commit a8a31da

Browse files
authored
Merge pull request #3737 from bcostm/dev_can_factorization
STM32: can_api.c files factorization
2 parents 5c28715 + 30565cb commit a8a31da

File tree

16 files changed

+444
-3096
lines changed

16 files changed

+444
-3096
lines changed

targets/TARGET_STM/TARGET_STM32F0/can_api.c

Lines changed: 0 additions & 477 deletions
This file was deleted.
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/* mbed Microcontroller Library
2+
* Copyright (c) 2006-2017 ARM Limited
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
#ifndef MBED_CAN_DEVICE_H
17+
#define MBED_CAN_DEVICE_H
18+
19+
#include "cmsis.h"
20+
21+
#ifdef __cplusplus
22+
extern "C" {
23+
#endif
24+
25+
#ifdef DEVICE_CAN
26+
27+
#define CAN_NUM 1 // Number of CAN peripherals present in the STM32 serie
28+
29+
#define CAN1_IRQ_RX_IRQN CEC_CAN_IRQn
30+
#define CAN1_IRQ_RX_VECT CAN_IRQHandler
31+
#define CAN1_IRQ_TX_IRQN CEC_CAN_IRQn
32+
#define CAN1_IRQ_TX_VECT CAN_IRQHandler
33+
#define CAN1_IRQ_ERROR_IRQN CEC_CAN_IRQn
34+
#define CAN1_IRQ_ERROR_VECT CAN_IRQHandler
35+
#define CAN1_IRQ_PASSIVE_IRQN CEC_CAN_IRQn
36+
#define CAN1_IRQ_PASSIVE_VECT CAN_IRQHandler
37+
#define CAN1_IRQ_BUS_IRQN CEC_CAN_IRQn
38+
#define CAN1_IRQ_BUS_VECT CAN_IRQHandler
39+
40+
#endif // DEVICE_CAN
41+
42+
#endif

targets/TARGET_STM/TARGET_STM32F1/TARGET_BLUEPILL_F103C8/PeripheralPins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ const PinMap PinMap_SPI_SSEL[] = {
167167
};
168168

169169
const PinMap PinMap_CAN_RD[] = {
170-
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
171-
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)},
170+
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)},
171+
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 1)},
172172
{NC, NC, 0}
173173
};
174174

targets/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PeripheralPins.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -181,8 +181,8 @@ const PinMap PinMap_SPI_SSEL[] = {
181181
};
182182

183183
const PinMap PinMap_CAN_RD[] = {
184-
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
185-
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 10)}, // Remap CAN_RX to PB_8
184+
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 0)},
185+
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_INPUT, GPIO_NOPULL, 10)}, // Remap CAN_RX to PB_8
186186
{NC, NC, 0}
187187
};
188188

0 commit comments

Comments
 (0)