WIP
parent
73ae4f6acf
commit
52838e1c2a
|
@ -31,12 +31,13 @@ bool llcan_set_speed(CAN_TypeDef *CAN, uint32_t speed, bool loopback, bool silen
|
|||
|
||||
#define CAN_TIMEOUT 1000000
|
||||
int tmp = 0;
|
||||
bool ret = false;
|
||||
while((CAN->MSR & CAN_MSR_INAK) == CAN_MSR_INAK && tmp < CAN_TIMEOUT) tmp++;
|
||||
if (tmp < CAN_TIMEOUT) {
|
||||
return true;
|
||||
ret = true;
|
||||
}
|
||||
|
||||
return false;
|
||||
return ret;
|
||||
}
|
||||
|
||||
void llcan_init(CAN_TypeDef *CAN) {
|
||||
|
|
|
@ -139,13 +139,13 @@ void set_can_enable(CAN_TypeDef *CAN, int enabled) {
|
|||
#endif
|
||||
|
||||
void set_led(int led_num, int on) {
|
||||
if (led_num == -1) return;
|
||||
|
||||
if (led_num != -1) {
|
||||
#ifdef PANDA
|
||||
set_gpio_output(GPIOC, led_num, !on);
|
||||
#else
|
||||
set_gpio_output(GPIOB, led_num, !on);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void set_can_mode(int can, bool use_gmlan) {
|
||||
|
|
|
@ -26,10 +26,14 @@ void *memcpy(void *dest, const void *src, unsigned int n) {
|
|||
|
||||
int memcmp(const void * ptr1, const void * ptr2, unsigned int num) {
|
||||
unsigned int i;
|
||||
int ret = 0;
|
||||
for (i = 0; i < num; i++) {
|
||||
if ( ((uint8_t*)ptr1)[i] != ((uint8_t*)ptr2)[i] ) return -1;
|
||||
if ( ((uint8_t*)ptr1)[i] != ((uint8_t*)ptr2)[i] ) {
|
||||
ret = -1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
// ********************* IRQ helpers *********************
|
||||
|
|
Loading…
Reference in New Issue