Added simulated tone_alarm and enabled led for POSIX

Added simulated tone_alarm class and enabled led class for posix build.

The simulator implements the led_init, led_on, led_off, led_toggle calls.

Signed-off-by: Mark Charlebois <charlebm@gmail.com>
This commit is contained in:
Mark Charlebois
2015-04-27 14:00:06 -07:00
parent 7fa33d0d2b
commit 58a33dd26a
6 changed files with 924 additions and 5 deletions
+45
View File
@@ -42,6 +42,7 @@
#include <stdio.h>
#include <string.h>
#include <sys/types.h>
#include <drivers/drv_led.h>
#ifndef __PX4_QURT
#include <sys/socket.h>
#include <netinet/in.h>
@@ -79,6 +80,8 @@ int Simulator::start(int argc, char *argv[])
int ret = 0;
_instance = new Simulator();
if (_instance) {
printf("Simulator started\n");
drv_led_start();
#ifndef __PX4_QURT
_instance->updateSamples();
#endif
@@ -186,3 +189,45 @@ int simulator_main(int argc, char *argv[])
}
__BEGIN_DECLS
extern void led_init(void);
extern void led_on(int led);
extern void led_off(int led);
extern void led_toggle(int led);
__END_DECLS
bool static _led_state = false;
__EXPORT void led_init()
{
printf("LED_ON\n");
}
__EXPORT void led_on(int led)
{
if (led == 1)
{
printf("LED_ON\n");
_led_state = true;
}
}
__EXPORT void led_off(int led)
{
if (led == 1)
{
printf("LED_OFF\n");
_led_state = false;
}
}
__EXPORT void led_toggle(int led)
{
if (led == 1)
{
_led_state = !_led_state;
printf("LED_TOGGLE: %s\n", _led_state ? "ON" : "OFF");
}
}