Skip to content

Instantly share code, notes, and snippets.

@insom

insom/pi-dac.c

Created Mar 1, 2021
Embed
What would you like to do?
Quick and Dirty Pi 256x256 Raster Display using a TLC7528CN DAC
#include <stdio.h>
#include "pico/stdlib.h"
#include "hardware/gpio.h"
#include "test.h"
#define FIRST_GPIO 0
char frame[256][256] = {0};
int main() {
for(int i = 0; i < 65536; i++) {
char *target;
target = frame;
target[i] = header_data[i];
}
for (int gpio = FIRST_GPIO; gpio < FIRST_GPIO + 17; gpio++) {
gpio_init(gpio);
gpio_set_dir(gpio, GPIO_OUT);
}
int32_t val = 0;
char x, y;
while (true) {
val++;
val = val & 0xffff;
x = val & 0xff;
y = val >> 8;
if(frame[255-x][y] == 0) {
gpio_put_all(val | 0x10000);
} else {
gpio_put_all(val);
}
}
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment