mirror of https://github.com/ArduPilot/ardupilot
AP_Notify: enable toshibaled on all I2C capable platforms
This commit is contained in:
parent
291369db7f
commit
dd081ab23b
|
@ -23,22 +23,17 @@ struct AP_Notify::notify_type AP_Notify::flags;
|
|||
void AP_Notify::init(void)
|
||||
{
|
||||
boardled.init();
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2 || CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
toshibaled.init();
|
||||
#endif
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
tonealarm.init();
|
||||
#endif
|
||||
toshibaled.init();
|
||||
}
|
||||
|
||||
// main update function, called at 50Hz
|
||||
void AP_Notify::update(void)
|
||||
{
|
||||
boardled.update();
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2 || CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
toshibaled.update();
|
||||
#endif
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
tonealarm.update();
|
||||
|
|
|
@ -55,11 +55,11 @@ public:
|
|||
private:
|
||||
// individual drivers
|
||||
AP_BoardLED boardled;
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
ToshibaLED_I2C toshibaled;
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
ToshibaLED_PX4 toshibaled;
|
||||
ToneAlarm_PX4 tonealarm;
|
||||
#else
|
||||
ToshibaLED_I2C toshibaled;
|
||||
#endif
|
||||
};
|
||||
|
||||
|
|
|
@ -1,39 +1,42 @@
|
|||
/*
|
||||
* Example of AC_Notify library .
|
||||
* DIYDrones.com
|
||||
*/
|
||||
|
||||
#include <AP_Common.h>
|
||||
#include <AP_Progmem.h>
|
||||
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
|
||||
#include <AP_Param.h>
|
||||
#include <AP_HAL.h>
|
||||
#include <AP_HAL_AVR.h>
|
||||
#include <AP_Notify.h> // Notify library
|
||||
#include <AP_BoardLED.h> // Board LED library
|
||||
|
||||
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
|
||||
|
||||
// create board led object
|
||||
AP_BoardLED board_led;
|
||||
|
||||
void setup()
|
||||
{
|
||||
hal.console->println("AP_Notify library test");
|
||||
|
||||
// initialise the board leds
|
||||
board_led.init();
|
||||
|
||||
// turn on initialising notification
|
||||
AP_Notify::flags.initialising = true;
|
||||
AP_Notify::flags.gps_status = 1;
|
||||
AP_Notify::flags.armed = 1;
|
||||
AP_Notify::flags.pre_arm_check = 1;
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
hal.scheduler->delay(1000);
|
||||
}
|
||||
|
||||
AP_HAL_MAIN();
|
||||
/*
|
||||
* Example of AC_Notify library .
|
||||
* DIYDrones.com
|
||||
*/
|
||||
|
||||
#include <AP_Common.h>
|
||||
#include <AP_Progmem.h>
|
||||
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
|
||||
#include <AP_Param.h>
|
||||
#include <AP_HAL.h>
|
||||
#include <AP_HAL_AVR.h>
|
||||
#include <AP_HAL_Linux.h>
|
||||
#include <AP_HAL_PX4.h>
|
||||
#include <AP_HAL_Empty.h>
|
||||
#include <AP_Notify.h> // Notify library
|
||||
#include <AP_BoardLED.h> // Board LED library
|
||||
|
||||
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
|
||||
|
||||
// create board led object
|
||||
AP_BoardLED board_led;
|
||||
|
||||
void setup()
|
||||
{
|
||||
hal.console->println("AP_Notify library test");
|
||||
|
||||
// initialise the board leds
|
||||
board_led.init();
|
||||
|
||||
// turn on initialising notification
|
||||
AP_Notify::flags.initialising = true;
|
||||
AP_Notify::flags.gps_status = 1;
|
||||
AP_Notify::flags.armed = 1;
|
||||
AP_Notify::flags.pre_arm_check = 1;
|
||||
}
|
||||
|
||||
void loop()
|
||||
{
|
||||
hal.scheduler->delay(1000);
|
||||
}
|
||||
|
||||
AP_HAL_MAIN();
|
||||
|
|
|
@ -4,21 +4,30 @@
|
|||
#include <AP_Progmem.h>
|
||||
#include <AP_Math.h> // ArduPilot Mega Vector/Matrix math Library
|
||||
#include <AP_Param.h>
|
||||
#include <Filter.h>
|
||||
#include <AP_ADC.h>
|
||||
#include <GCS_MAVLink.h>
|
||||
#include <AP_Declination.h>
|
||||
#include <AP_HAL.h>
|
||||
#include <AP_HAL_AVR.h>
|
||||
#include <AP_HAL_AVR_SITL.h>
|
||||
#include <AP_HAL_Linux.h>
|
||||
#include <AP_HAL_PX4.h>
|
||||
#include <AP_HAL_Empty.h>
|
||||
#include <AP_HAL_FLYMAPLE.h>
|
||||
#include <AP_Notify.h> // Notify library
|
||||
#include <ToshibaLED.h>
|
||||
|
||||
const AP_HAL::HAL& hal = AP_HAL_BOARD_DRIVER;
|
||||
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_APM1 || CONFIG_HAL_BOARD == HAL_BOARD_APM2
|
||||
ToshibaLED_I2C toshiba_led;
|
||||
#elif CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
ToshibaLED_PX4 toshiba_led;
|
||||
#if CONFIG_HAL_BOARD == HAL_BOARD_PX4
|
||||
static ToshibaLED_PX4 toshiba_led;
|
||||
#else
|
||||
static ToshibaLED_I2C toshiba_led;
|
||||
#endif
|
||||
|
||||
uint8_t led_state;
|
||||
uint8_t red, green, blue;
|
||||
static uint8_t led_state;
|
||||
static uint8_t red, green, blue;
|
||||
|
||||
void setup(void)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue