summaryrefslogtreecommitdiff
path: root/led_cube.c
diff options
context:
space:
mode:
authorAleksa Vučković <56649122+aleksav013@users.noreply.github.com>2023-02-10 13:36:41 +0000
committerGitHub <noreply@github.com>2023-02-10 13:36:41 +0000
commit41df7ff00ffd45283e3f713d267a356044623384 (patch)
tree44cbe85ceef276f5da513bfc339b1d91e9644ce3 /led_cube.c
parent43d1a561ac635ca82e408f252870491c0b725e06 (diff)
parente1285b056a5083722850b48059895d6f8e2549e1 (diff)
Merge pull request #1 from vmisovic/master
map, config.h
Diffstat (limited to 'led_cube.c')
-rw-r--r--led_cube.c36
1 files changed, 11 insertions, 25 deletions
diff --git a/led_cube.c b/led_cube.c
index 26d8e58..5893acc 100644
--- a/led_cube.c
+++ b/led_cube.c
@@ -1,13 +1,9 @@
#include "pico/stdlib.h"
+#include "config.h"
#include <stdio.h>
#include <stdint.h>
#include <string.h>
-// define the pins used controlling 74HC595
-#define DATA_PIN 2
-#define CLOCK_PIN 3
-#define LATCH_PIN 4
-
void init_pins(void)
{
gpio_init(DATA_PIN);
@@ -21,28 +17,17 @@ void init_pins(void)
uint8_t map[9];
-// define the order of 74HC595 chain
-#define MINUS 0
-#define FIRST_PLUS 1
-#define SECOND_PLUS 2
-#define THIRD_PLUS 3
-#define FOURTH_PLUS 4
-#define FIFTH_PLUS 5
-#define SIXTH_PLUS 6
-#define SEVENTH_PLUS 7
-#define EIGHTH_PLUS 8
-
void init_map(void)
{
- map[0] = MINUS;
- map[1] = FIRST_PLUS;
- map[2] = SECOND_PLUS;
- map[3] = THIRD_PLUS;
- map[4] = FOURTH_PLUS;
- map[5] = FIFTH_PLUS;
- map[6] = SIXTH_PLUS;
- map[7] = SEVENTH_PLUS;
- map[8] = EIGHTH_PLUS;
+ map[0] = CHIP_0;
+ map[1] = CHIP_1;
+ map[2] = CHIP_2;
+ map[3] = CHIP_3;
+ map[4] = CHIP_4;
+ map[5] = CHIP_5;
+ map[6] = CHIP_6;
+ map[7] = CHIP_7;
+ map[8] = CHIP_8;
}
void send_raw_data(uint8_t data[9])
@@ -103,6 +88,7 @@ void test_every_pin(void)
int main()
{
+ stdio_init_all();
init_pins();
init_map();