Browse Source

lights: module declarations in the header

master
Max Prokhorov 5 years ago
parent
commit
cf4540ae90
3 changed files with 20 additions and 22 deletions
  1. +2
    -0
      code/espurna/button.ino
  2. +0
    -21
      code/espurna/config/prototypes.h
  3. +18
    -1
      code/espurna/light.h

+ 2
- 0
code/espurna/button.ino View File

@ -15,6 +15,8 @@ Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
#include <DebounceEvent.h> #include <DebounceEvent.h>
#include <vector> #include <vector>
#include "light.h"
typedef struct { typedef struct {
DebounceEvent * button; DebounceEvent * button;
unsigned long actions; unsigned long actions;


+ 0
- 21
code/espurna/config/prototypes.h View File

@ -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); 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); 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 // MQTT
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------


+ 18
- 1
code/espurna/light.h View File

@ -1,5 +1,5 @@
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
// Light
// Lights
// ----------------------------------------------------------------------------- // -----------------------------------------------------------------------------
#pragma once #pragma once
@ -29,3 +29,20 @@ namespace Light {
COMMS_GROUP = 1 << 1 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);

Loading…
Cancel
Save