auto-sync
This commit is contained in:
parent
14d6bbd0cf
commit
9d2eddd419
|
@ -24,59 +24,50 @@
|
|||
#include "rfiutil.h"
|
||||
|
||||
/*
|
||||
not used, not sure if we still need it. I guess we will remove it in 2015
|
||||
int mylog10(int param) {
|
||||
if (param < 10)
|
||||
return 0;
|
||||
if (param < 100)
|
||||
return 1;
|
||||
if (param < 1000)
|
||||
return 2;
|
||||
if (param < 10000)
|
||||
return 3;
|
||||
if (param < 100000)
|
||||
return 4;
|
||||
if (param < 1000000)
|
||||
return 5;
|
||||
if (param < 10000000)
|
||||
return 6;
|
||||
if (param < 100000000)
|
||||
return 7;
|
||||
#warning This would be better without recursion
|
||||
return mylog10(param / 10) + 1;
|
||||
}
|
||||
*/
|
||||
not used, not sure if we still need it. I guess we will remove it in 2015
|
||||
int mylog10(int param) {
|
||||
if (param < 10)
|
||||
return 0;
|
||||
if (param < 100)
|
||||
return 1;
|
||||
if (param < 1000)
|
||||
return 2;
|
||||
if (param < 10000)
|
||||
return 3;
|
||||
if (param < 100000)
|
||||
return 4;
|
||||
if (param < 1000000)
|
||||
return 5;
|
||||
if (param < 10000000)
|
||||
return 6;
|
||||
if (param < 100000000)
|
||||
return 7;
|
||||
#warning This would be better without recursion
|
||||
return mylog10(param / 10) + 1;
|
||||
}
|
||||
*/
|
||||
/*
|
||||
char hexChar(int v) {
|
||||
v = v & 0xF;
|
||||
if (v < 10)
|
||||
return (char)('0' + v);
|
||||
return 'A' - 10 + v;
|
||||
}
|
||||
*/
|
||||
char hexChar(int v) {
|
||||
v = v & 0xF;
|
||||
if (v < 10)
|
||||
return (char)('0' + v);
|
||||
return 'A' - 10 + v;
|
||||
}
|
||||
*/
|
||||
|
||||
void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par) {
|
||||
if (isIsrContext()) {
|
||||
bool wasLocked = lockAnyContext();
|
||||
bool wasLocked = lockAnyContext();
|
||||
|
||||
/**
|
||||
* todo: this could be simplified once we migrate to ChibiOS 3.0
|
||||
* See http://www.chibios.org/dokuwiki/doku.php?id=chibios:howtos:porting_from_2_to_3
|
||||
*/
|
||||
if (chVTIsArmedI(vtp))
|
||||
chVTResetI(vtp);
|
||||
/**
|
||||
* todo: this could be simplified once we migrate to ChibiOS 3.0
|
||||
* See http://www.chibios.org/dokuwiki/doku.php?id=chibios:howtos:porting_from_2_to_3
|
||||
*/
|
||||
if (chVTIsArmedI(vtp)) {
|
||||
chVTResetI(vtp);
|
||||
}
|
||||
|
||||
chVTSetI(vtp, time, vtfunc, par);
|
||||
if (!wasLocked)
|
||||
chSysUnlockFromIsr()
|
||||
;
|
||||
} else {
|
||||
chSysLock()
|
||||
;
|
||||
if (chVTIsArmedI(vtp))
|
||||
chVTResetI(vtp);
|
||||
chVTSetI(vtp, time, vtfunc, par);
|
||||
chSysUnlock()
|
||||
;
|
||||
chVTSetI(vtp, time, vtfunc, par);
|
||||
if (!wasLocked) {
|
||||
unlockAnyContext();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue