Commit 1297d6bc authored by Fence's avatar Fence 🌈

add rainbow

parent 1350444c
Pipeline #1254 passed with stage
in 1 minute and 25 seconds
......@@ -2,7 +2,7 @@
#include <util/delay.h>
void TransPrideProgram::print_stripe(OwOLedAddress *addr, int r, int g, int b, int size) {
void print_stripe(OwOLedAddress *addr, int r, int g, int b, int size) {
for (int i = 0; i<size; i++) {
owoled_send_colors(addr, r, g, b);
}
......@@ -10,17 +10,32 @@ void TransPrideProgram::print_stripe(OwOLedAddress *addr, int r, int g, int b,
void TransPrideProgram::run(OwOLedAddress *addr, int led_count) {
int stripe = led_count/5;
int middle_stripe = 10; //(stripe * 5 - led_count) + stripe;
int middle_stripe = (stripe * 5 - led_count) + stripe;
while(1) {
print_stripe(addr, 0x55, 0xCD, 0xFC, stripe);
print_stripe(addr, 0xF7, 0xA8, 0xB8, stripe);
print_stripe(addr, 0xFF, 0xFF, 0xFF, middle_stripe);
print_stripe(addr, 0xF7, 0xA8, 0xB8, stripe);
print_stripe(addr, 0x55, 0xCD, 0xFC, stripe);
owoled_show();
_delay_ms(1000);
}
}
void RainbowPrideProgram::run(OwOLedAddress *addr, int led_count) {
int stripe = led_count/6;
while(1) {
this->print_stripe(addr, 0x55, 0xCD, 0xFC, stripe);
this->print_stripe(addr, 0xF7, 0xA8, 0xB8, stripe);
this->print_stripe(addr, 0xFF, 0xFF, 0xFF, middle_stripe);
this->print_stripe(addr, 0xF7, 0xA8, 0xB8, stripe);
this->print_stripe(addr, 0x55, 0xCD, 0xFC, stripe);
print_stripe(addr, 0xFF, 0x00, 0x18, stripe);
print_stripe(addr, 0xFF, 0xA5, 0x2C, stripe);
print_stripe(addr, 0xFF, 0xFF, 0x41, stripe);
print_stripe(addr, 0x00, 0x80, 0x18, stripe);
print_stripe(addr, 0x00, 0x00, 0xF9, stripe);
print_stripe(addr, 0x86, 0x00, 0x7D, stripe);
owoled_show();
_delay_ms(1000);
}
}
}
......@@ -6,8 +6,11 @@
class TransPrideProgram: LedProgram {
public:
void run(OwOLedAddress *addr, int led_count);
private:
void print_stripe(OwOLedAddress *addr, int r, int g, int b, int size);
};
class RainbowPrideProgram: LedProgram {
public:
void run(OwOLedAddress *addr, int led_count);
};
#endif
......@@ -3,6 +3,7 @@
#include "./programs/pride.hh"
void run_program(OwOLedAddress *addr, int led_count) {
TransPrideProgram prog = TransPrideProgram();
//TransPrideProgram prog = TransPrideProgram();
RainbowPrideProgram prog = RainbowPrideProgram();
prog.run(addr, led_count);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment