mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-26 01:33:56 -04:00
AP_HAL: fixed example build on ChibiOS
This commit is contained in:
parent
2941afa62b
commit
347c774665
@ -5,25 +5,25 @@ void loop();
|
|||||||
|
|
||||||
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
|
const AP_HAL::HAL& hal = AP_HAL::get_HAL();
|
||||||
|
|
||||||
AP_HAL::AnalogSource* ch;
|
AP_HAL::AnalogSource* chan;
|
||||||
|
|
||||||
void setup(void) {
|
void setup(void) {
|
||||||
hal.console->printf("Starting AP_HAL::AnalogIn test\r\n");
|
hal.console->printf("Starting AP_HAL::AnalogIn test\r\n");
|
||||||
ch = hal.analogin->channel(0);
|
chan = hal.analogin->channel(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int8_t pin;
|
static int8_t pin;
|
||||||
|
|
||||||
void loop(void)
|
void loop(void)
|
||||||
{
|
{
|
||||||
float v = ch->voltage_average();
|
float v = chan->voltage_average();
|
||||||
if (pin == 0) {
|
if (pin == 0) {
|
||||||
hal.console->printf("\n");
|
hal.console->printf("\n");
|
||||||
}
|
}
|
||||||
hal.console->printf("[%u %.3f] ",
|
hal.console->printf("[%u %.3f] ",
|
||||||
(unsigned)pin, (double)v);
|
(unsigned)pin, (double)v);
|
||||||
pin = (pin+1) % 16;
|
pin = (pin+1) % 16;
|
||||||
ch->set_pin(pin);
|
chan->set_pin(pin);
|
||||||
hal.scheduler->delay(100);
|
hal.scheduler->delay(100);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user