From cf4540ae900b9054a1a482b2c3172564cf6d6118 Mon Sep 17 00:00:00 2001 From: Max Prokhorov Date: Wed, 9 Oct 2019 21:41:24 +0300 Subject: [PATCH] lights: module declarations in the header --- code/espurna/button.ino | 2 ++ code/espurna/config/prototypes.h | 21 --------------------- code/espurna/light.h | 19 ++++++++++++++++++- 3 files changed, 20 insertions(+), 22 deletions(-) diff --git a/code/espurna/button.ino b/code/espurna/button.ino index 678fda74..909516cf 100644 --- a/code/espurna/button.ino +++ b/code/espurna/button.ino @@ -15,6 +15,8 @@ Copyright (C) 2016-2019 by Xose PĂ©rez #include #include +#include "light.h" + typedef struct { DebounceEvent * button; unsigned long actions; diff --git a/code/espurna/config/prototypes.h b/code/espurna/config/prototypes.h index 21ecd0c0..26f28cce 100644 --- a/code/espurna/config/prototypes.h +++ b/code/espurna/config/prototypes.h @@ -177,27 +177,6 @@ int16_t i2c_read_int16(uint8_t address, uint8_t reg); int16_t i2c_read_int16_le(uint8_t address, uint8_t reg); void i2c_read_buffer(uint8_t address, uint8_t * buffer, size_t len); -// ----------------------------------------------------------------------------- -// Lights -// ----------------------------------------------------------------------------- - -size_t lightChannels(); - -void lightState(unsigned char i, bool state); -bool lightState(unsigned char i); - -void lightState(bool state); -bool lightState(); - -void lightBrightness(long brightness); -long lightBrightness(); - -long lightChannel(unsigned char id); -void lightChannel(unsigned char id, long value); - -void lightBrightnessStep(long steps, long multiplier = LIGHT_STEP); -void lightChannelStep(unsigned char id, long steps, long multiplier = LIGHT_STEP); - // ----------------------------------------------------------------------------- // MQTT // ----------------------------------------------------------------------------- diff --git a/code/espurna/light.h b/code/espurna/light.h index 4fcbb75a..68f5bb4a 100644 --- a/code/espurna/light.h +++ b/code/espurna/light.h @@ -1,5 +1,5 @@ // ----------------------------------------------------------------------------- -// Light +// Lights // ----------------------------------------------------------------------------- #pragma once @@ -29,3 +29,20 @@ namespace Light { COMMS_GROUP = 1 << 1 }; } + +size_t lightChannels(); + +void lightState(unsigned char i, bool state); +bool lightState(unsigned char i); + +void lightState(bool state); +bool lightState(); + +void lightBrightness(long brightness); +long lightBrightness(); + +long lightChannel(unsigned char id); +void lightChannel(unsigned char id, long value); + +void lightBrightnessStep(long steps, long multiplier = LIGHT_STEP); +void lightChannelStep(unsigned char id, long steps, long multiplier = LIGHT_STEP);