Skip to content
Snippets Groups Projects
Commit 2b76b792 authored by jamesimmanuel.magsino@stud.h-da.de's avatar jamesimmanuel.magsino@stud.h-da.de
Browse files

More comments

parent 6283e6ac
No related branches found
No related tags found
No related merge requests found
......@@ -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;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment