Начало
This commit is contained in:
parent
a5edbf0286
commit
037bae7065
20
CanPorts.c
20
CanPorts.c
|
|
@ -149,6 +149,8 @@ static void vCanPort_InitCan1() {
|
|||
void CAN1_SE_IRQHandler(void) {
|
||||
__IO uint32_t err_index = 0;
|
||||
if (can_flag_get(CAN1, CAN_ETR_FLAG) != RESET) {
|
||||
uint32_t ests = CAN1->ests;
|
||||
|
||||
err_index = CAN1->ests & 0x70;
|
||||
can_flag_clear(CAN1, CAN_ETR_FLAG);
|
||||
if (err_index == 0x00000010) {
|
||||
|
|
@ -160,6 +162,23 @@ void CAN1_SE_IRQHandler(void) {
|
|||
|
||||
static void vCanPort_InitCAN2RxTxPin() {
|
||||
gpio_init_type gpio_init_struct;
|
||||
// enable the gpio clock
|
||||
crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
|
||||
|
||||
gpio_default_para_init(&gpio_init_struct);
|
||||
|
||||
// configure the can tx, rx pin
|
||||
gpio_init_struct.gpio_drive_strength = GPIO_DRIVE_STRENGTH_STRONGER;
|
||||
gpio_init_struct.gpio_out_type = GPIO_OUTPUT_PUSH_PULL;
|
||||
gpio_init_struct.gpio_mode = GPIO_MODE_MUX;
|
||||
gpio_init_struct.gpio_pins = GPIO_PINS_12 | GPIO_PINS_13;
|
||||
gpio_init_struct.gpio_pull = GPIO_PULL_NONE;
|
||||
gpio_init(GPIOB, &gpio_init_struct);
|
||||
|
||||
gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE12, GPIO_MUX_9);
|
||||
gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE13, GPIO_MUX_9);
|
||||
/*
|
||||
gpio_init_type gpio_init_struct;
|
||||
|
||||
// enable the gpio clock
|
||||
crm_periph_clock_enable(CRM_GPIOB_PERIPH_CLOCK, TRUE);
|
||||
|
|
@ -176,6 +195,7 @@ static void vCanPort_InitCAN2RxTxPin() {
|
|||
|
||||
gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE5, GPIO_MUX_9);
|
||||
gpio_pin_mux_config(GPIOB, GPIO_PINS_SOURCE6, GPIO_MUX_9);
|
||||
*/
|
||||
}
|
||||
|
||||
void CAN2_RX0_IRQHandler(void) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue