summaryrefslogtreecommitdiff
path: root/led.c
diff options
context:
space:
mode:
authorDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2020-01-04 19:13:56 -0800
committerDavid Vazgenovich Shakaryan <dvshakaryan@gmail.com>2020-01-04 19:13:56 -0800
commite01381a40290f1dcf8eb1ff467a621050f5a9948 (patch)
tree7420bc114eba77cfe45cfe40abdcbb26e564ddd6 /led.c
parentfbd4c9cc4f101cf2dacb3521517facfbd36c41ac (diff)
downloadchristmas_lights-e01381a40290f1dcf8eb1ff467a621050f5a9948.tar.gz
christmas_lights-e01381a40290f1dcf8eb1ff467a621050f5a9948.tar.xz
consistent function braces
Diffstat (limited to 'led.c')
-rw-r--r--led.c15
1 files changed, 10 insertions, 5 deletions
diff --git a/led.c b/led.c
index 8d53dea..72ff250 100644
--- a/led.c
+++ b/led.c
@@ -3,7 +3,8 @@
#include <avr/io.h>
-static void signal_bit_0() {
+static void signal_bit_0()
+{
asm volatile (
"sbi %0, %1\n\t"
"cbi %0, %1\n\t"
@@ -15,7 +16,8 @@ static void signal_bit_0() {
);
}
-static void signal_bit_1() {
+static void signal_bit_1()
+{
asm volatile (
"sbi %0, %1\n\t"
"rjmp .+0\n\t"
@@ -28,7 +30,8 @@ static void signal_bit_1() {
);
}
-static void signal_byte(unsigned char byte) {
+static void signal_byte(unsigned char byte)
+{
for (unsigned char mask = 0x80; mask != 0; mask >>= 1) {
if (byte & mask)
signal_bit_1();
@@ -37,13 +40,15 @@ static void signal_byte(unsigned char byte) {
}
}
-static void signal_led(struct colour *c) {
+static void signal_led(struct colour *c)
+{
signal_byte(c->r);
signal_byte(c->g);
signal_byte(c->b);
}
-void led_signal_sequence(int num_leds, struct colour *seq, int num_seq, int col_width, int seq_start) {
+void led_signal_sequence(int num_leds, struct colour *seq, int num_seq, int col_width, int seq_start)
+{
for(int i = 0; i < num_leds; ++i) {
int j, p = i - seq_start;