Skip to content
Snippets Groups Projects
Commit 8350bccf authored by Eric Brombaugh's avatar Eric Brombaugh
Browse files

Cycle through graphic test modes

parent f971695d
No related branches found
No related tags found
No related merge requests found
......@@ -13,8 +13,7 @@
int main()
{
uint32_t count = 0;
// 48MHz internal clock
SystemInit48HSI();
// start serial @ default 115200bps
......@@ -27,49 +26,72 @@ int main()
printf("initializing i2c oled...");
if(!oled_init())
{
//memset(oled_buffer, 0, sizeof(oled_buffer));
//for(int i=0;i<sizeof(oled_buffer);i++)
// oled_buffer[i] = i;
//for(int i=0;i<OLED_W;i++)
//{
// oled_drawPixel(i, i>>2, 1);
// oled_drawPixel(i, OLED_H-1-(i>>2), 1);
//}
//uint8_t y= 0;
//for(uint8_t x=0;x<OLED_W;x+=16)
//{
// oled_drawLine(x, 0, OLED_W, y, 1);
// oled_drawLine(OLED_W-x, OLED_H, 0, OLED_H-y, 1);
// y+= 4;
//}
//for(uint8_t x=0;x<OLED_W;x+=16)
// if(x<64)
// oled_drawCircle(x,16, 15, 1);
// else
// oled_fillCircle(x,16, 15, 1);
oled_drawstr(0,0, "This is a test", 1);
oled_drawstr(0,8, "of the emergency", 1);
oled_drawstr(0,16,"broadcasting", 1);
oled_drawstr(0,24,"system.",1);
oled_xorrect(64, 0, 64, 32);
oled_refresh();
printf("done.\n\r");
printf("Looping on test modes...");
while(1)
{
for(uint8_t mode=0;mode<5;mode++)
{
// clear buffer for next mode
oled_setbuf(0);
switch(mode)
{
case 0:
for(int i=0;i<sizeof(oled_buffer);i++)
oled_buffer[i] = i;
break;
case 1:
for(int i=0;i<OLED_W;i++)
{
oled_drawPixel(i, i>>2, 1);
oled_drawPixel(i, OLED_H-1-(i>>2), 1);
}
break;
case 2:
{
uint8_t y= 0;
for(uint8_t x=0;x<OLED_W;x+=16)
{
oled_drawLine(x, 0, OLED_W, y, 1);
oled_drawLine(OLED_W-x, OLED_H, 0, OLED_H-y, 1);
y+= 4;
}
}
break;
case 3:
for(uint8_t x=0;x<OLED_W;x+=16)
if(x<64)
oled_drawCircle(x,16, 15, 1);
else
oled_fillCircle(x,16, 15, 1);
break;
case 4:
oled_drawstr(0,0, "This is a test", 1);
oled_drawstr(0,8, "of the emergency", 1);
oled_drawstr(0,16,"broadcasting", 1);
oled_drawstr(0,24,"system.",1);
oled_xorrect(64, 0, 64, 32);
break;
default:
break;
}
oled_refresh();
Delay_Ms(2000);
}
}
}
else
printf("failed.\n\r");
printf("looping...\n\r");
while(1)
{
count++;
count &= 255;
Delay_Ms( 5 );
}
printf("Stuck here forever...\n\r");
while(1);
}
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