MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / set_reset_mode

Function set_reset_mode

bsp/loongson/ls1cdev/libraries/ls1c_can.c:16–43  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

14#include "ls1c_delay.h"
15
16unsigned char set_reset_mode(CAN_TypeDef* CANx)
17{
18 unsigned char status;
19 int i;
20
21 /*检查复位标志*/
22 status = CANx->MOD;
23
24 /* 关闭中断 */
25 CANx->IER = 0x00;
26
27 for (i = 0; i < 100; i++)
28 {
29 if((status & CAN_Mode_RM) == CAN_Mode_RM)
30 return 1;
31
32 /* 设置复位*/
33 CANx->MOD |= ((unsigned char)CAN_Mode_RM);
34
35 /*延时*/
36 delay_us(10);
37
38 /*检查复位标志*/
39 status = CANx->MOD;
40 }
41 printf("\r\nSetting SJA1000 into reset mode failed!\r\n");
42 return 0;
43}
44
45static unsigned char set_normal_mode(CAN_TypeDef* CANx)
46{

Callers 4

CAN_InitFunction · 0.85
CAN_FilterInitFunction · 0.85
CAN_SetBpsFunction · 0.85
CAN_SetModeFunction · 0.85

Calls 2

delay_usFunction · 0.70
printfFunction · 0.50

Tested by

no test coverage detected