working, but need to write test

This commit is contained in:
2021-06-25 18:35:16 +02:00
parent 55ebd21975
commit d059c3d72d
5 changed files with 142 additions and 79 deletions
-53
View File
@@ -1,53 +0,0 @@
#pragma once
#include "PCA9685.h"
class Treppe {
private:
uint8_t stairs;
uint16_t time_per_stair = 100; // dimmtime per stair [ms]
uint16_t idle_brightness = 25;
uint16_t active_brightness = 500;
uint8_t direction = 0;
uint8_t state = 0;
uint8_t switch_state = 0;
uint32_t tick = 0;
uint32_t stufe = 0;
uint32_t ticks_treppe = 0;
uint32_t ticks_pro_stufe = 0;
float differenz_pwm_pro_tick = 0.0;
// initialize with i2c-Address 0, use Wire Library
PCA9685 pwmController;
uint8_t softstart_led(uint8_t led, uint16_t startval, uint16_t stopval);
void ledsequence();
public:
Treppe(uint8_t _stairs) : stairs(_stairs){
ticks_pro_stufe = time_per_stair / 20; // [ms]
ticks_treppe = ticks_pro_stufe * stairs;
differenz_pwm_pro_tick = (active_brightness - idle_brightness)
/ ticks_pro_stufe;
}
void task(); // call periodically
void setup();
void elelel();
// Parameter section
uint16_t setIdle(uint16_t _idle_brightness);
uint16_t setActive(uint16_t _active_brightness);
uint16_t setTime(uint16_t _time_per_stair);
// Runtime Parameter section
uint8_t setDirection(uint8_t _direction);
uint8_t setState(uint8_t _state);
uint8_t getState() { return state;};
uint8_t getDirection() {return direction;};
};