1
0
Fork 0

Relocate common backlight functionally (#7273)

This commit is contained in:
Joel Challis 2020-01-13 01:30:56 +00:00 committed by GitHub
parent 2ce3025be2
commit b89e35bdd3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
6 changed files with 55 additions and 81 deletions

View file

@ -21,6 +21,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
backlight_config_t backlight_config;
// TODO: migrate to backlight_config_t
static uint8_t breathing_period = BREATHING_PERIOD;
/** \brief Backlight initialization
*
* FIXME: needs doc
@ -191,3 +194,21 @@ void backlight_disable_breathing(void) {
*/
bool is_backlight_breathing(void) { return backlight_config.breathing; }
#endif
// following are marked as weak purely for backwards compatibility
__attribute__((weak)) void breathing_period_set(uint8_t value) { breathing_period = value ? value : 1; }
__attribute__((weak)) uint8_t get_breathing_period(void) { return breathing_period; }
__attribute__((weak)) void breathing_period_default(void) { breathing_period_set(BREATHING_PERIOD); }
__attribute__((weak)) void breathing_period_inc(void) { breathing_period_set(breathing_period + 1); }
__attribute__((weak)) void breathing_period_dec(void) { breathing_period_set(breathing_period - 1); }
// defaults for backlight api
__attribute__((weak)) void backlight_init_ports(void) {}
__attribute__((weak)) void backlight_set(uint8_t level) {}
__attribute__((weak)) void backlight_task(void) {}