예제 #1
0
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);
}
예제 #2
0
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);
}
예제 #3
0
float logGetFloat(int varid)
{
  ASSERT(varid >= 0);

  if (logs[varid].type == LOG_FLOAT)
    return *(float *)logs[varid].address;

  return logGetInt(varid);
}
예제 #4
0
unsigned int logGetUint(int varid)
{
  return (unsigned int)logGetInt(varid);
}