From 2b76b7924c84549ff6ee2d5900dfa7740adfed3a Mon Sep 17 00:00:00 2001 From: "jamesimmanuel.magsino@stud.h-da.de" <James Immanuel Magsino> Date: Wed, 20 Nov 2024 11:13:11 +0100 Subject: [PATCH] More comments --- src/main.c | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/src/main.c b/src/main.c index 67778a8..36b9d76 100644 --- a/src/main.c +++ b/src/main.c @@ -3,9 +3,6 @@ #include <stdio.h> #include <unistd.h> -unsigned *SDApinctrl = (void *)(IO_BANK0_BASE + IO_BANK0_GPIO0_CTRL_OFFSET); -unsigned *SCLpinctrl = (void *)(IO_BANK0_BASE + IO_BANK0_GPIO1_CTRL_OFFSET); - const uint8_t init[4] = {0x21, 0xa0, 0xe1, 0x81}; const uint8_t zeile[8] = {0x00, 0x02, 0x04, 0x06, 0x08, 0x10, 0x12, 0x14}; const uint8_t fill[17] = {0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; @@ -34,13 +31,20 @@ const uint8_t matrix[9][17] = { }; int main() { - + // clock enable: 100000 baud (bit/s) i2c_init(i2c_default, 100000); + // Pin 0 and 1 are given I2C functionality (they're the ones connected to the led matrix) gpio_set_function(0, GPIO_FUNC_I2C); gpio_set_function(1, GPIO_FUNC_I2C); - gpio_pull_up(1); - gpio_pull_up(0); + // refer to page 439 in RP2040, redundant with write_blocking - pins are used as output (write enable) (sort of) + // gpio_pull_up(1); + // gpio_pull_up(0); + + // 0x70 i2c address for 28 pin (refer to matrix.pdf page 21) + // can't be directly written cuz we need pointers + // system setup (clock enable), ROW/INT set, dimming, display setup + // const uint8_t init[4] = {0x21, 0xa0, 0xe1, 0x81}; i2c_write_blocking(i2c_default, 0x70, &init[0], 1, false); i2c_write_blocking(i2c_default, 0x70, &init[1], 1, false); @@ -55,6 +59,7 @@ int main() { i2c_write_blocking(i2c_default, 0x70, matrix[i], 17, false); + // sleep for (int j = 0; j < 10000000; j++) { volatile int i = 0; -- GitLab