Backlight support. TOUCH events feed backlight_keepalive(); After a timeout, we fade the backlight to 0 using timers. When the backlight is not active, TOUCH events are not passed to widgets, but the backlight is re-enabled; Add some flags to mos.yml to drive timeout and PWM pin for the backlight on Featherwing

This commit is contained in:
Pim van Pelt
2017-11-27 21:30:01 +01:00
parent 5f10481fb7
commit d07a0e053c
5 changed files with 118 additions and 0 deletions

17
include/backlight.h Normal file
View File

@ -0,0 +1,17 @@
#ifndef __BACKLIGHT_H
#define __BACKLIGHT_H
#include "mgos.h"
#include "mgos_pwm.h"
#include "mgos_config.h"
#include "mgos_timers.h"
#define BACKLIGHT_PWM_HZ 10000
#define BACKLIGHT_STEP_USEC 10000 // 10ms per step.
void backlight_init(void);
void backlight_set(float new_duty, int fader_msec);
void backlight_keepalive();
bool backlight_active();
#endif // __BACKLIGHT_H

View File

@ -3,6 +3,7 @@
#include "widget.h"
#include "screen.h"
#include "backlight.h"
void widget_time_ev(int ev, struct widget_t *w, void *ev_data);