diff options
| author | Aleksa Vučković <56649122+aleksav013@users.noreply.github.com> | 2023-02-10 13:36:41 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2023-02-10 13:36:41 +0000 |
| commit | 41df7ff00ffd45283e3f713d267a356044623384 (patch) | |
| tree | 44cbe85ceef276f5da513bfc339b1d91e9644ce3 | |
| parent | 43d1a561ac635ca82e408f252870491c0b725e06 (diff) | |
| parent | e1285b056a5083722850b48059895d6f8e2549e1 (diff) | |
Merge pull request #1 from vmisovic/master
map, config.h
| -rw-r--r-- | config.h | 15 | ||||
| -rw-r--r-- | led_cube.c | 36 |
2 files changed, 26 insertions, 25 deletions
diff --git a/config.h b/config.h new file mode 100644 index 0000000..53d409b --- /dev/null +++ b/config.h @@ -0,0 +1,15 @@ +// define the pins used controlling 74HC595 +#define DATA_PIN 2 +#define CLOCK_PIN 3 +#define LATCH_PIN 4 + +// define the order of 74HC595 chain +#define CHIP_0 0 +#define CHIP_1 1 +#define CHIP_2 3 +#define CHIP_3 5 +#define CHIP_4 7 +#define CHIP_5 8 +#define CHIP_6 6 +#define CHIP_7 4 +#define CHIP_8 2 @@ -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(); |
