Browse Source

AP_HAL: fixed example build on ChibiOS

mission-4.1.18
Andrew Tridgell 7 years ago
parent
commit
347c774665
  1. 8
      libraries/AP_HAL/examples/AnalogIn/AnalogIn.cpp

8
libraries/AP_HAL/examples/AnalogIn/AnalogIn.cpp

@ -5,25 +5,25 @@ void loop(); @@ -5,25 +5,25 @@ void loop();
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
AP_HAL::AnalogSource* ch;
AP_HAL::AnalogSource* chan;
void setup(void) {
hal.console->printf("Starting AP_HAL::AnalogIn test\r\n");
ch = hal.analogin->channel(0);
chan = hal.analogin->channel(0);
}
static int8_t pin;
void loop(void)
{
float v = ch->voltage_average();
float v = chan->voltage_average();
if (pin == 0) {
hal.console->printf("\n");
}
hal.console->printf("[%u %.3f] ",
(unsigned)pin, (double)v);
pin = (pin+1) % 16;
ch->set_pin(pin);
chan->set_pin(pin);
hal.scheduler->delay(100);
}

Loading…
Cancel
Save