lol: styling fix and remove static gpio tables for gen1

Signed-off-by: Brendan Le Foll <brendan.le.foll@intel.com>
This commit is contained in:
Brendan Le Foll 2014-11-13 16:02:53 +00:00
parent 8174b6c59b
commit e3bdef0ef0
2 changed files with 23 additions and 64 deletions

View File

@ -51,24 +51,9 @@ static int charlie_pairs [12][22] = {
{0,13, 1,11, 2,9, 3,119, 4,105,5,91, 6,77, 7,63, 8,49, 9,35, 10,21} {0,13, 1,11, 2,9, 3,119, 4,105,5,91, 6,77, 7,63, 8,49, 9,35, 10,21}
}; };
//static int gpios_map[] = {
//14,15,28,17,24,27,26,19,16,25,38,39,
//};
void clear_gpio(int gpio) void clear_gpio(int gpio)
{ {
/* FIXME AK hack around Galileo gen1 issue, to remove
if(gpio == 0)
{
mraa_gpio_mode(c1, MRAA_GPIO_HIZ);
mraa_gpio_mode(c2, MRAA_GPIO_HIZ);
}
else if (gpio == 1) {
mraa_gpio_mode(c3, MRAA_GPIO_HIZ);
mraa_gpio_mode(c4, MRAA_GPIO_HIZ);
} else*/
mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_HIZ); mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_HIZ);
mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_IN); mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_IN);
} }
@ -76,12 +61,12 @@ void clear_prev_cycle(int cycle)
{ {
int i; int i;
// What is prev cycle? // What is prev cycle?
cycle--; cycle--;
if (cycle == -1) if (cycle == -1)
cycle = 11; cycle = 11;
// Disable all "1"'s // Disable all "1"'s
for (i = 0; i < 11; i++) { for (i = 0; i < 11; i++) {
if (charlie_pairs[cycle][i*2] == -1) if (charlie_pairs[cycle][i*2] == -1)
break; break;
@ -96,16 +81,6 @@ void clear_prev_cycle(int cycle)
void set_strong_one(int gpio) void set_strong_one(int gpio)
{ {
mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_OUT); mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_OUT);
/* FIXME AK hack around Galileo gen1 issue, to remove
if(gpio == 0)
{
mraa_gpio_mode(c1, MRAA_GPIO_STRONG);
mraa_gpio_mode(c2, MRAA_GPIO_STRONG);
}
else if (gpio == 1) {
mraa_gpio_mode(c3, MRAA_GPIO_STRONG);
mraa_gpio_mode(c4, MRAA_GPIO_STRONG);
} else*/
mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_STRONG); mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_STRONG);
mraa_gpio_write(m_Ctx[gpio], 1); mraa_gpio_write(m_Ctx[gpio], 1);
} }
@ -113,16 +88,6 @@ void set_strong_one(int gpio)
void set_strong_zero(int gpio) void set_strong_zero(int gpio)
{ {
mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_OUT); mraa_gpio_dir(m_Ctx[gpio], MRAA_GPIO_OUT);
/* FIXME AK hack around Galileo gen1 issue, to remove
if(gpio == 0)
{
mraa_gpio_mode(c1, MRAA_GPIO_STRONG);
mraa_gpio_mode(c2, MRAA_GPIO_STRONG);
}
else if (gpio == 1) {
mraa_gpio_mode(c3, MRAA_GPIO_STRONG);
mraa_gpio_mode(c4, MRAA_GPIO_STRONG);
} else*/
mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_STRONG); mraa_gpio_mode(m_Ctx[gpio], MRAA_GPIO_STRONG);
mraa_gpio_write(m_Ctx[gpio], 0); mraa_gpio_write(m_Ctx[gpio], 0);
} }
@ -137,27 +102,21 @@ static void clear_gpios()
void *do_draw(void *arg) void *do_draw(void *arg)
{ {
/* c1 = mraa_gpio_init_raw(31);
c2 = mraa_gpio_init_raw(32);
c3 = mraa_gpio_init_raw(30);
c4 = mraa_gpio_init_raw(18);
*/
clear_gpios(); clear_gpios();
while (1) { while (1) {
int i, cur; int i, cur;
uint8_t cycle = 0; uint8_t cycle = 0;
// 12 Cycles of Matrix // 12 Cycles of Matrix
for (cycle = 0; cycle < 12; cycle++) for (cycle = 0; cycle < 12; cycle++)
{ {
if (cycle == 12) cycle = 0; if (cycle == 12) cycle = 0;
clear_prev_cycle(cycle); clear_prev_cycle(cycle);
// set strong/0 on current cycle line // set strong/0 on current cycle line
set_strong_zero(cycle); set_strong_zero(cycle);
// draw ones from framebuffer // draw ones from framebuffer
for (i = 0; i < 11; i++) { for (i = 0; i < 11; i++) {
cur = charlie_pairs[cycle][i*2]; cur = charlie_pairs[cycle][i*2];
if (cur == -1) break; if (cur == -1) break;