Skip to content

Instantly share code, notes, and snippets.

@RaD
Created February 6, 2014 12:22
Show Gist options
  • Save RaD/8843169 to your computer and use it in GitHub Desktop.
Save RaD/8843169 to your computer and use it in GitHub Desktop.
/*
Buffer visualisation thread.
*/
static WORKING_AREA(visual_wa, 128);
static msg_t visual(void *arg) {
(void) arg;
uint8_t col = 0;
chRegSetThreadName("display_refresh");
palWriteGroup(GPIOA, 0b11111111, 0, 0b00000000);
while (!chThdShouldTerminate()) {
palClearPad(GPIOA, col); // cols
col = (col + 1) % DISPLAY_COLUMNS;
chMtxLock(&mtx_page);
PAGE* page = &pages[current_page];
palWriteGroup(GPIOB, 0b11111111, 8, page->columns[col]);
chMtxUnlock();
palSetPad(GPIOA, col); // cols
chThdSleepMilliseconds(3); // brightness
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment