Skip to content

Commit 859ae4c

Browse files
committed
Merge pull request #1772 from BartSX/can-devel-f1
[STM32F1xx] CAN development for STM32F1xx family
2 parents 47e2e09 + 6e77543 commit 859ae4c

File tree

10 files changed

+517
-9
lines changed

10 files changed

+517
-9
lines changed

hal/targets/hal/TARGET_STM/TARGET_STM32F1/PeripheralPins.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,4 +59,9 @@ extern const PinMap PinMap_SPI_MISO[];
5959
extern const PinMap PinMap_SPI_SCLK[];
6060
extern const PinMap PinMap_SPI_SSEL[];
6161

62+
//*** CAN ***
63+
64+
extern const PinMap PinMap_CAN_RD[];
65+
extern const PinMap PinMap_CAN_TD[];
66+
6267
#endif

hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PeripheralNames.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,10 @@ typedef enum {
6767
PWM_4 = (int)TIM4_BASE
6868
} PWMName;
6969

70+
typedef enum {
71+
CAN_1 = (int)CAN1_BASE
72+
} CANName;
73+
7074
#ifdef __cplusplus
7175
}
7276
#endif

hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/PeripheralPins.c

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -163,3 +163,15 @@ const PinMap PinMap_SPI_SSEL[] = {
163163
{PB_12, SPI_2, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
164164
{NC, NC, 0}
165165
};
166+
167+
const PinMap PinMap_CAN_RD[] = {
168+
{PA_11, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
169+
{PB_8 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)},
170+
{NC, NC, 0}
171+
};
172+
173+
const PinMap PinMap_CAN_TD[] = {
174+
{PA_12, CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 0)},
175+
{PB_9 , CAN_1, STM_PIN_DATA(STM_MODE_AF_PP, GPIO_NOPULL, 1)},
176+
{NC, NC, 0}
177+
};

hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/device.h

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

4242

4343

44+
#define DEVICE_CAN 1
45+
4446
//=======================================
4547

4648
#define DEVICE_ID_LENGTH 24

hal/targets/hal/TARGET_STM/TARGET_STM32F1/TARGET_NUCLEO_F103RB/objects.h

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

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

101106
#ifdef __cplusplus

0 commit comments

Comments
 (0)