Skip to content

Commit c70aedc

Browse files
committed
Merge branch 'can-devel-f0' of https://github.com/BartSX/mbed into BartSX-can-devel-f0
2 parents 99fb83a + fad2190 commit c70aedc

File tree

21 files changed

+564
-9
lines changed

21 files changed

+564
-9
lines changed

hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/stm32f042x6.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ typedef struct
672672
#define IWDG ((IWDG_TypeDef *) IWDG_BASE)
673673
#define USART2 ((USART_TypeDef *) USART2_BASE)
674674
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
675-
#define CAN ((CAN_TypeDef *) CAN_BASE)
675+
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
676676
#define CRS ((CRS_TypeDef *) CRS_BASE)
677677
#define PWR ((PWR_TypeDef *) PWR_BASE)
678678
#define CEC ((CEC_TypeDef *) CEC_BASE)

hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/stm32f072xb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ typedef struct
732732
#define USART4 ((USART_TypeDef *) USART4_BASE)
733733
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
734734
#define I2C2 ((I2C_TypeDef *) I2C2_BASE)
735-
#define CAN ((CAN_TypeDef *) CAN_BASE)
735+
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
736736
#define CRS ((CRS_TypeDef *) CRS_BASE)
737737
#define PWR ((PWR_TypeDef *) PWR_BASE)
738738
#define DAC ((DAC_TypeDef *) DAC_BASE)

hal/targets/cmsis/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F091RC/stm32f091xc.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -708,7 +708,7 @@ typedef struct
708708
#define USART5 ((USART_TypeDef *) USART5_BASE)
709709
#define I2C1 ((I2C_TypeDef *) I2C1_BASE)
710710
#define I2C2 ((I2C_TypeDef *) I2C2_BASE)
711-
#define CAN ((CAN_TypeDef *) CAN_BASE)
711+
#define CAN1 ((CAN_TypeDef *) CAN_BASE)
712712
#define CRS ((CRS_TypeDef *) CRS_BASE)
713713
#define PWR ((PWR_TypeDef *) PWR_BASE)
714714
#define DAC ((DAC_TypeDef *) DAC_BASE)

hal/targets/hal/TARGET_STM/TARGET_STM32F0/PeripheralPins.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,9 @@ extern const PinMap PinMap_SPI_MISO[];
6363
extern const PinMap PinMap_SPI_SCLK[];
6464
extern const PinMap PinMap_SPI_SSEL[];
6565

66+
//*** CAN ***
67+
68+
extern const PinMap PinMap_CAN_RD[];
69+
extern const PinMap PinMap_CAN_TD[];
70+
6671
#endif

hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/PeripheralNames.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ typedef enum {
6868
PWM_17 = (int)TIM17_BASE
6969
} PWMName;
7070

71+
typedef enum {
72+
CAN_1 = (int)CAN_BASE
73+
} CANName;
74+
7175
#ifdef __cplusplus
7276
}
7377
#endif

hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/PeripheralPins.c

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,3 +146,14 @@ const PinMap PinMap_SPI_SSEL[] = {
146146
// {PA_15, SPI_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF0_SPI1)},
147147
{NC, NC, 0}
148148
};
149+
150+
const PinMap PinMap_CAN_RD[] = {
151+
// {PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
152+
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
153+
{NC, NC, 0}
154+
};
155+
156+
const PinMap PinMap_CAN_TD[] = {
157+
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
158+
{NC, NC, 0}
159+
};

hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/device.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@
5454

5555
#define DEVICE_SLEEP 1
5656

57+
#define DEVICE_CAN 1
58+
5759
//=======================================
5860

5961
#define DEVICE_SEMIHOST 0

hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F042K6/objects.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,11 @@ struct pwmout_s {
9595
uint32_t pulse;
9696
};
9797

98+
struct can_s {
99+
CANName can;
100+
int index;
101+
};
102+
98103
#include "gpio_object.h"
99104

100105
#ifdef __cplusplus

hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/PeripheralNames.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,10 @@ typedef enum {
7575
PWM_17 = (int)TIM17_BASE
7676
} PWMName;
7777

78+
typedef enum {
79+
CAN_1 = (int)CAN_BASE
80+
} CANName;
81+
7882
#ifdef __cplusplus
7983
}
8084
#endif

hal/targets/hal/TARGET_STM/TARGET_STM32F0/TARGET_NUCLEO_F072RB/PeripheralPins.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,3 +196,15 @@ const PinMap PinMap_SPI_SSEL[] = {
196196
{PB_12, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_PULLUP, GPIO_AF0_SPI2)},
197197
{NC, NC, 0}
198198
};
199+
200+
const PinMap PinMap_CAN_RD[] = {
201+
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
202+
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
203+
{NC, NC, 0}
204+
};
205+
206+
const PinMap PinMap_CAN_TD[] = {
207+
{PB_9 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
208+
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, GPIO_AF4_CAN)},
209+
{NC, NC, 0}
210+
};

0 commit comments

Comments
 (0)