Skip to content

Commit

Permalink
fan: experiment with relay provider
Browse files Browse the repository at this point in the history
early init plus simple state switch w/ api
  • Loading branch information
mcspr committed Jan 11, 2023
1 parent b5a03da commit 7362068
Show file tree
Hide file tree
Showing 5 changed files with 321 additions and 159 deletions.
3 changes: 3 additions & 0 deletions code/espurna/config/hardware.h
Expand Up @@ -1099,6 +1099,9 @@
#define BUTTON4_PIN 14
#define BUTTON4_CLICK BUTTON_ACTION_FAN_HIGH

// Relay
#define RELAY1_PROVIDER RELAY_PROVIDER_FAN

// LEDs
#define LED1_PIN 13
#define LED1_PIN_INVERSE 1
Expand Down
1 change: 1 addition & 0 deletions code/espurna/config/types.h
Expand Up @@ -107,6 +107,7 @@
#define RELAY_PROVIDER_DUAL RelayProvider::Dual
#define RELAY_PROVIDER_STM RelayProvider::Stm
#define RELAY_PROVIDER_LIGHT_STATE RelayProvider::LightState
#define RELAY_PROVIDER_FAN RelayProvider::Fan

#define RFB_PROVIDER_RCSWITCH 0
#define RFB_PROVIDER_EFM8BB1 1
Expand Down
9 changes: 9 additions & 0 deletions code/espurna/fan.h
Expand Up @@ -8,13 +8,22 @@ Copyright (C) 2021 by Maxim Prokhorov <prokhorov dot max at outlook dot com>

#pragma once

#include <cstddef>
#include <memory>

enum class FanSpeed {
Off,
Low,
Medium,
High
};

class RelayProviderBase;
std::unique_ptr<RelayProviderBase> fanMakeRelayProvider(size_t);

bool fanStatus();
void fanStatus(bool);

void fanSpeed(FanSpeed);
FanSpeed fanSpeed();

Expand Down

0 comments on commit 7362068

Please sign in to comment.