summaryrefslogtreecommitdiff
path: root/anzeige.c
diff options
context:
space:
mode:
Diffstat (limited to 'anzeige.c')
-rw-r--r--anzeige.c45
1 files changed, 16 insertions, 29 deletions
diff --git a/anzeige.c b/anzeige.c
index 31e036f..b10d319 100644
--- a/anzeige.c
+++ b/anzeige.c
@@ -21,6 +21,7 @@ int main(int argc, char **argv)
t_display_data display_data;
int ret_val;
unsigned char *text_buffer;
+ t_scroll_buffer scroll_buffers[2];
// Set up gpi pointer for direct register access
ret_val = multiplexer_setup_root();
@@ -42,39 +43,25 @@ int main(int argc, char **argv)
int i,j,k;
- text_buffer = malloc(8);
+ text_buffer = malloc(24);
if (text_buffer == NULL) {
- fprintf(stderr, "malloc failed to allocate 8 bytes\n");
+ fprintf(stderr, "malloc failed to allocate 24 bytes\n");
exit(EXIT_FAILURE);
}
+ memset(text_buffer, 0, sizeof(text_buffer));
- for (i=0; i<20; i++) {
-// usleep(2500000);
-// if (i & 0x01) {
- ret_val = gadgets_retrieve_temperature(text_buffer,sizeof(text_buffer));
- if (ret_val) {
- free(text_buffer);
- exit(ret_val);
- }
- for (j=0; j<39; j++)
- display_data.buf[(display_data.should_buf+1)%3][j] = 0x00;
- for (j=0; (j<7) && (text_buffer[j]); j++) {
- text_buffer[j] = text_buffer[j] & 0xff;
- printf("%02x %c\n",text_buffer[j],text_buffer[j]);
- if (text_buffer[j] >= 0x7f) {
- if (text_buffer[j] <= 0xaf)
- continue;
- text_buffer[j] -= 0xaf - 0x7f + 1;
- }
- text_buffer[j] -= 0x20;
- if ((text_buffer[j] < 0) || (text_buffer[j] >= (sizeof(symbols)/5))) {
- printf("EXCESS: %d %d %d\n", text_buffer[j], (text_buffer[j] < 0), (text_buffer[j] >= (sizeof(symbols)/5)));
- continue;
- }
- for (k=0; k<5; k++)
- display_data.buf[(display_data.should_buf+1)%3][6*j+k] = symbols[5*(text_buffer[j])+k];
-// }
- }
+ ret_val = gadgets_retrieve_temperature(text_buffer,sizeof(text_buffer));
+ if (ret_val) {
+ free(text_buffer);
+ exit(ret_val);
+ }
+
+ scroll_buffers[0].scroll_len = render(text_buffer, sizeof(text_buffer), scroll_buffers[0].buf, sizeof(scroll_buffers[0].buf), 1);
+
+ for (i=0; i<100; i++) {
+ usleep(250000);
+ for (j=0; j<39; j++)
+ display_data.buf[(display_data.should_buf+1)%3][j] = scroll_buffers[0].buf[(i+j) % scroll_buffers[0].scroll_len];
display_data.should_buf = (display_data.should_buf+1)%3;
}