static void tilt(uint32_t counter, uint32_t * mi, Melody * melody) { pitchid = logGetVarId("stabilizer", "pitch"); rollid = logGetVarId("stabilizer", "roll"); pitch = logGetInt(pitchid); roll = logGetInt(rollid); tilt_freq = 0; tilt_ratio = 127; if (abs(pitch) > 5) { tilt_freq = 3000 - 50 * pitch; } buzzerOn(tilt_freq); }
static void tilt(uint32_t counter) { pitchid = logGetVarId("stabilizer", "pitch"); rollid = logGetVarId("stabilizer", "roll"); pitch = logGetInt(pitchid); roll = logGetInt(rollid); tilt_freq = 0; tilt_ratio = 127; if (abs(pitch) > 5) { tilt_freq = 3000 - 50 * pitch; } piezoSetRatio(tilt_ratio); piezoSetFreq(tilt_freq); }
float logGetFloat(int varid) { ASSERT(varid >= 0); if (logs[varid].type == LOG_FLOAT) return *(float *)logs[varid].address; return logGetInt(varid); }
unsigned int logGetUint(int varid) { return (unsigned int)logGetInt(varid); }