Skip to content

Commit

Permalink
Add Gyver Lamp ESPHome
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewjswan authored Dec 15, 2023
1 parent c54a230 commit be2008e
Showing 1 changed file with 42 additions and 0 deletions.
42 changes: 42 additions & 0 deletions includes/gyver/gyver_lamp_esphome.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#pragma once

class GyverLamp
{
private:
uint8_t CurrentMode = EFF_LAVALAMP;

public:
GyverLamp();
~GyverLamp();

void ShowFrame(uint8_t CurrentMode, esphome::Color current_color, light::AddressableLight *p_it);
};

GyverLamp::GyverLamp()
{
}

GyverLamp::~GyverLamp()
{
FreeLeds();
}

void GyverLamp::ShowFrame(uint8_t CurrentMode, esphome::Color current_color, light::AddressableLight *p_it)
{
InitLeds(p_it->size());

effectsTick();

for (int i = 0; i < p_it->size(); i++)
{
(*p_it)[i] = Color(leds[i].r, leds[i].g, leds[i].b);
}

#if defined delay
delay(1);
#else
esphome::delay(1);
#endif
}

class GyverLamp gyver_lamp;

0 comments on commit be2008e

Please sign in to comment.