#include "ledraspberry.h"
+#define GREEN_LED "/sys/class/leds/led0/brightness"
+
LedRaspberry::LedRaspberry()
{
initted = 0;
int LedRaspberry::init(int tdevice)
{
if (initted) return 0;
+ FILE *led=fopen(GREEN_LED,"w");
+ if (led) {
+ fputc('0',led);
+ fclose(led);
+ }
initted = 1;
return 1;
}
int LedRaspberry::on()
{
if (!initted) return 0;
+ FILE *led=fopen(GREEN_LED,"w");
+ if (led) {
+ fputc('1',led);
+ fclose(led);
+ }
return 0;
}
int LedRaspberry::off()
{
if (!initted) return 0;
+ FILE *led=fopen(GREEN_LED,"w");
+ if (led) {
+ fputc('0',led);
+ fclose(led);
+ }
return 0;
}