Skip to content
Snippets Groups Projects
Commit 6de32fc9 authored by f4grx's avatar f4grx
Browse files

build fixes

parent 3b30975c
No related branches found
No related tags found
No related merge requests found
......@@ -36,7 +36,7 @@
#ifndef HN70AP_TIMER
#define HN70AP_TIMER
int led_init(void);
int leds_init(void);
int leds_state(int led, int state);
#endif //HN70AP_TIMER
......@@ -36,16 +36,45 @@
#include <nuttx/config.h>
#include <stdint.h>
#include "timer.h"
#include <stdbool.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/ioctl.h>
#include <unistd.h>
#include <nuttx/leds/userled.h>
#include <hn70ap/timer.h>
int leds_init(void)
{
}
int leds_state(int led, int state)
int leds_state(int lednum, bool state)
{
struct userled_s led;
int fd;
int ret;
fd = open("/dev/userleds", O_RDWR);
if(fd<0)
{
fprintf(stderr, "Failed to open LEDS device\n");
return -1;
}
led.ul_led = lednum;
led.ul_on = state;
ret = ioctl(fd, ULEDIOC_SETLED, (unsigned long)&led);
if(ret<0)
{
fprintf(stderr, "Failed to change LED state\n");
return -1;
}
close(fd);
return 0;
}
......
......@@ -36,7 +36,8 @@
#include <nuttx/config.h>
#include <stdint.h>
#include "timer.h"
#include <hn70ap/timer.h>
int timer_init(void)
{
......
......@@ -45,6 +45,8 @@
#include <sys/mount.h>
#include <hn70ap/eeprom.h>
#include <hn70ap/timer.h>
#include <hn70ap/leds.h>
#include "sysdaemon_internal.h"
......@@ -90,17 +92,17 @@ int sysdaemon_main(int argc, char *argv[])
ret = timer_init();
if(ret != 0)
{
printf("Failed to initialize timers\n");
printf("FATAL: Failed to initialize timers\n");
goto lfail;
}
/* Initialize the leds */
/* Requires timer for blinking */
ret = led_init();
ret = leds_init();
if(ret != 0)
{
printf("Failed to initialize timers\n");
printf("FATAL: Failed to initialize Leds\n");
goto lfail;
}
......@@ -143,5 +145,6 @@ lfail:
/* Panic... something could not be initialized
* Try to switch on the red LED
*/
return ERROR;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment