2016-09-25 21:51:15 -06:00
|
|
|
#pragma once
|
|
|
|
#include <Arduino.h>
|
|
|
|
#include <Adafruit_NeoPixel.h>
|
|
|
|
|
|
|
|
|
|
|
|
class Synchrotron {
|
|
|
|
Adafruit_NeoPixel *pxl;
|
|
|
|
uint16_t npixels; // How many pixels there are
|
|
|
|
int cur; // Which pixel the synchrotron is on, currently
|
|
|
|
int tickrate; // How many millis between pixel position changes
|
|
|
|
int ticks; // How many ticks have elapsed since last position change
|
|
|
|
byte r, g, b; // Current color
|
2016-09-27 22:20:03 -06:00
|
|
|
|
|
|
|
int transition_length, transition_elapsed;
|
|
|
|
int initial_tickrate, initial_r, initial_g, initial_b;
|
|
|
|
float dtickrate, dr, dg, db;
|
2016-10-02 11:59:11 -06:00
|
|
|
float ftickrate;
|
2016-09-25 21:51:15 -06:00
|
|
|
public:
|
|
|
|
Synchrotron(uint16_t n, uint8_t p=6, neoPixelType t=NEO_GRB + NEO_KHZ800);
|
2016-09-27 22:20:03 -06:00
|
|
|
transition(int duration, int final_tickrate, byte final_r, byte final_g, byte final_b);
|
2016-10-02 11:59:11 -06:00
|
|
|
bool transitioned();
|
|
|
|
float speed();
|
2016-09-25 21:51:15 -06:00
|
|
|
standby();
|
|
|
|
charge();
|
|
|
|
fire();
|
|
|
|
discharge();
|
|
|
|
tick(unsigned long jiffies); // Try to call this every jiffy
|
|
|
|
};
|