feat: 完成 can 初测
This commit is contained in:
@@ -220,10 +220,12 @@ void wk_nvic_config(void)
|
||||
{
|
||||
nvic_priority_group_config(NVIC_PRIORITY_GROUP_4);
|
||||
|
||||
nvic_irq_enable(USBFS_L_CAN1_RX0_IRQn, 0, 0);
|
||||
nvic_irq_enable(USART1_IRQn, 1, 0);
|
||||
nvic_irq_enable(USART2_IRQn, 1, 0);
|
||||
nvic_irq_enable(USART3_IRQn, 1, 0);
|
||||
nvic_irq_enable(TMR6_GLOBAL_IRQn, 0, 0);
|
||||
nvic_irq_enable(CAN2_RX0_IRQn, 0, 0);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -741,13 +743,13 @@ void wk_tmr11_init(void)
|
||||
gpio_init(GPIOB, &gpio_init_struct);
|
||||
|
||||
/* configure counter settings */
|
||||
tmr_base_init(TMR11, 65535, 0);
|
||||
tmr_base_init(TMR11, 2399, 99);
|
||||
tmr_cnt_dir_set(TMR11, TMR_COUNT_UP);
|
||||
tmr_clock_source_div_set(TMR11, TMR_CLOCK_DIV1);
|
||||
tmr_period_buffer_enable(TMR11, FALSE);
|
||||
|
||||
/* configure channel 1 output settings */
|
||||
tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_OFF;
|
||||
tmr_output_struct.oc_mode = TMR_OUTPUT_CONTROL_PWM_MODE_A;
|
||||
tmr_output_struct.oc_output_state = TRUE;
|
||||
tmr_output_struct.occ_output_state = FALSE;
|
||||
tmr_output_struct.oc_polarity = TMR_OUTPUT_ACTIVE_HIGH;
|
||||
@@ -758,6 +760,8 @@ void wk_tmr11_init(void)
|
||||
tmr_channel_value_set(TMR11, TMR_SELECT_CHANNEL_1, 0);
|
||||
tmr_output_channel_buffer_enable(TMR11, TMR_SELECT_CHANNEL_1, FALSE);
|
||||
|
||||
tmr_output_channel_immediately_set(TMR11, TMR_SELECT_CHANNEL_1, FALSE);
|
||||
|
||||
tmr_counter_enable(TMR11, TRUE);
|
||||
|
||||
/* add user code begin tmr11_init 2 */
|
||||
@@ -910,8 +914,19 @@ void wk_can1_init(void)
|
||||
|
||||
can_filter_init(CAN1, &can_filter_init_struct);
|
||||
|
||||
/* add user code begin can1_init 2 */
|
||||
/**
|
||||
* Users need to configure CAN1 interrupt functions according to the actual application.
|
||||
* 1. Call the below function to enable the corresponding CAN1 interrupt.
|
||||
* --can_interrupt_enable(...)
|
||||
* 2. Add the user's interrupt handler code into the below function in the at32f403a_407_int.c file.
|
||||
* --void USBFS_L_CAN1_RX0_IRQHandler(void)
|
||||
*/
|
||||
|
||||
/*can1 rx0 interrupt config--------------------------------------------------------*/
|
||||
// can_interrupt_enable(CAN1, CAN_RF0MIEN_INT, TRUE);
|
||||
|
||||
/* add user code begin can1_init 2 */
|
||||
can_interrupt_enable(CAN1, CAN_RF0MIEN_INT, TRUE);
|
||||
/* add user code end can1_init 2 */
|
||||
}
|
||||
|
||||
@@ -988,8 +1003,19 @@ void wk_can2_init(void)
|
||||
|
||||
can_filter_init(CAN2, &can_filter_init_struct);
|
||||
|
||||
/* add user code begin can2_init 2 */
|
||||
/**
|
||||
* Users need to configure CAN2 interrupt functions according to the actual application.
|
||||
* 1. Call the below function to enable the corresponding CAN2 interrupt.
|
||||
* --can_interrupt_enable(...)
|
||||
* 2. Add the user's interrupt handler code into the below function in the at32f403a_407_int.c file.
|
||||
* --void CAN2_RX0_IRQHandler(void)
|
||||
*/
|
||||
|
||||
/*can2 rx0 interrupt config--------------------------------------------------------*/
|
||||
// can_interrupt_enable(CAN2, CAN_RF0MIEN_INT, TRUE);
|
||||
|
||||
/* add user code begin can2_init 2 */
|
||||
can_interrupt_enable(CAN2, CAN_RF0MIEN_INT, TRUE);
|
||||
/* add user code end can2_init 2 */
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user