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

refactored to use a for loop

parent ce97addf
No related branches found
No related tags found
No related merge requests found
......@@ -9,16 +9,20 @@ 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};
const uint8_t empty[17] = {0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t achtel[17] = {0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t viertel[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t dreiachtel[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t hälfte[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t fünfachtel[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t dreiviertel[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00};
const uint8_t siebenachtel[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00};
const uint8_t ganzes[17] = {0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00};
const uint8_t matrix[9][17] = {
{0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // empty
{0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // achtel
{0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // viertel
{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // dreiachtel
{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // hälfte
{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // fünfachtel
{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00}, // dreiviertel
{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0x00, 0x00}, // siebenachtel
{0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00, 0xff, 0x00}, // ganzes
};
int main()
{
......@@ -38,53 +42,14 @@ int main()
i2c_write_blocking(i2c_default, 0x70, empty, 17, false);
i2c_write_blocking(i2c_default, 0x70, achtel, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, viertel, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, dreiachtel, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, hälfte, 17, false);
for (int j = 0; j < 10000000; j++)
for (int i = 0; i <= 8; i++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, fünfachtel, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, matrix[i], 17, false);
i2c_write_blocking(i2c_default, 0x70, dreiviertel, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, siebenachtel, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
i2c_write_blocking(i2c_default, 0x70, ganzes, 17, false);
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
for (int j = 0; j < 10000000; j++)
{
volatile int i = 0;
}
}
return 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