46 bool number_of_ones_to_bool[16] = {
47 1, 0, 0, 1, 0, 1, 1, 0,
48 0, 1, 1, 0, 1, 0, 0, 1
51 uint8_t muse_interval[4] = {MUSE_B7, MUSE_B19, MUSE_B3, MUSE_B28};
52 uint8_t muse_theme[4] = {MUSE_B8, MUSE_B23, MUSE_B18, MUSE_B17};
54 bool muse_timer_1bit = 0;
55 uint8_t muse_timer_2bit = 0;
56 uint8_t muse_timer_2bit_counter = 0;
57 uint8_t muse_timer_4bit = 0;
58 uint32_t muse_timer_31bit = 0;
60 bool bit_for_value(uint8_t value) {
67 return muse_timer_1bit;
69 return (muse_timer_4bit & 1);
71 return (muse_timer_4bit & 2);
73 return (muse_timer_4bit & 4);
75 return (muse_timer_4bit & 8);
77 return (muse_timer_2bit & 1);
79 return (muse_timer_2bit & 2);
81 return muse_timer_31bit & (1UL << (value - MUSE_B1));
85 uint8_t muse_clock_pulse(void) {
87 bool top = number_of_ones_to_bool[
88 bit_for_value(muse_theme[0]) +
89 (bit_for_value(muse_theme[1]) << 1) +
90 (bit_for_value(muse_theme[2]) << 2) +
91 (bit_for_value(muse_theme[3]) << 3)
94 if (muse_timer_1bit == 0) {
95 if (muse_timer_2bit_counter == 0) {
96 muse_timer_2bit = (muse_timer_2bit + 1) % 4;
98 muse_timer_2bit_counter = (muse_timer_2bit_counter + 1) % 3;
99 muse_timer_4bit = (muse_timer_4bit + 1) % 16;
100 muse_timer_31bit = (muse_timer_31bit << 1) + top;
103 muse_timer_1bit = (muse_timer_1bit + 1) % 2;
106 bit_for_value(muse_interval[0]) +
107 (bit_for_value(muse_interval[1]) << 1) +
108 (bit_for_value(muse_interval[2]) << 2) +
109 (bit_for_value(muse_interval[3]) << 3);