Stairs/src/modes/custom.cpp

30 lines
633 B
C++

#include "custom.h"
#include <stdint.h>
void CustomMode::read(uint8_t* data)
{
// The packet is zeroed before we get our hands on it and
// the size should also be larger as noted in main.cpp,
// so a straight-up copy should be safe.
memcpy(this->values, data, sizeof(this->values));
}
void CustomMode::write(Stream* stream)
{
stream->write((uint8_t*)&this->values, sizeof(this->values));
}
void CustomMode::init(IStairs* stairs, uint32_t currentTime)
{
for (uint8_t step = 0; step < StepCount; step++)
stairs->set(step, this->values[step]);
}
void CustomMode::tick(IStairs* stairs, uint32_t currentTime)
{
}