Skip to content

Commit

Permalink
lights: module declarations in the header
Browse files Browse the repository at this point in the history
  • Loading branch information
mcspr committed Oct 9, 2019
1 parent 038cb91 commit cf4540a
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 22 deletions.
2 changes: 2 additions & 0 deletions code/espurna/button.ino
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Copyright (C) 2016-2019 by Xose Pérez <xose dot perez at gmail dot com>
#include <DebounceEvent.h>
#include <vector>

#include "light.h"

typedef struct {
DebounceEvent * button;
unsigned long actions;
Expand Down
21 changes: 0 additions & 21 deletions code/espurna/config/prototypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
// -----------------------------------------------------------------------------
Expand Down
19 changes: 18 additions & 1 deletion code/espurna/light.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// -----------------------------------------------------------------------------
// Light
// Lights
// -----------------------------------------------------------------------------

#pragma once
Expand Down Expand Up @@ -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);

0 comments on commit cf4540a

Please sign in to comment.