auto-sync

This commit is contained in:
rusEfi 2015-02-27 14:04:43 -06:00
parent 14d6bbd0cf
commit 9d2eddd419
1 changed files with 40 additions and 49 deletions

View File

@ -56,27 +56,18 @@ char hexChar(int v) {
*/
void chVTSetAny(virtual_timer_t *vtp, systime_t time, vtfunc_t vtfunc, void *par) {
if (isIsrContext()) {
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))
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()
;
if (!wasLocked) {
unlockAnyContext();
}
}