static int logStartBlock(int id, unsigned int period) { int i; for (i=0; i<LOG_MAX_BLOCKS; i++) if (logBlocks[i].id == id) break; if (i >= LOG_MAX_BLOCKS) { ERROR("Trying to start block id %d that doesn't exist.", id); return ENOENT; } DEBUG("Starting block %d with period %dms\n", id, period); if (period>0) { xTimerChangePeriod(logBlocks[i].timer, M2T(period), 100); xTimerStart(logBlocks[i].timer, 100); } else { // single-shoot run workerSchedule(logRunBlock, &logBlocks[i]); } return 0; }
/* This function is called by the timer subsystem */ void logBlockTimed(xTimerHandle timer) { workerSchedule(logRunBlock, pvTimerGetTimerID(timer)); }
/* This function is called by the timer subsystem */ void logBlockTimed(void* parameter) { workerSchedule(logRunBlock, parameter); }