summaryrefslogtreecommitdiff
path: root/anzeige.c
diff options
context:
space:
mode:
authorErich Eckner <git@eckner.net>2018-10-19 11:38:36 +0200
committerErich Eckner <git@eckner.net>2018-10-19 11:38:36 +0200
commitd3c8620c6a455be7c1730eab82f33f901db34f78 (patch)
tree6e8374fd18a5bfb55fc03b67fc8a54f0896ccd9f /anzeige.c
parent5d67929e77ce7e9107c791f4d37f36cb1139fb92 (diff)
downloadanzeige-d3c8620c6a455be7c1730eab82f33f901db34f78.tar.xz
actually do something in infinite loop
Diffstat (limited to 'anzeige.c')
-rw-r--r--anzeige.c35
1 files changed, 18 insertions, 17 deletions
diff --git a/anzeige.c b/anzeige.c
index 73b7041..cf83f25 100644
--- a/anzeige.c
+++ b/anzeige.c
@@ -53,7 +53,7 @@ volatile unsigned *gpio;
void setup_io();
void drop_privileges();
-void put_on_display(char *content);
+void *put_on_display(void *content);
void printButton(int g)
{
@@ -65,7 +65,7 @@ void printButton(int g)
int main(int argc, char **argv)
{
- int thread_id;
+ pthread_t thread_id;
char *content;
// Set up gpi pointer for direct register access
@@ -155,7 +155,7 @@ void drop_privileges()
//
// Shift the bits provided in content into the display
//
-void put_on_display(char *content)
+void *put_on_display(void *content)
{
char *raw_output;
int line;
@@ -167,22 +167,23 @@ void put_on_display(char *content)
}
for (line=0; line<7; line++) {
raw_output[line*6] = 1<<line;
- memmove(raw_output+1+6*line,content+5*line,5);
+ memmove(raw_output+1+6*line,((char*)content)+5*line,5);
}
- while (1);
- for (line=0; line<7; line++) {
- GPIO_CLR = 1<<GATE_PIN; // Licht an
- for (int byte=0; byte<6; byte++) {
- for (int bit=0; bit<8; bit++) {
- GPIO_CLR = 1<<SER_CLK_PIN;
- GPIO_ALTER((*(raw_output+6*line+byte)>>bit) & 0x01) = 1<<SER_DAT_PIN;
- GPIO_SET = 1<<SER_CLK_PIN;
+ while (1)
+ for (line=0; line<7; line++) {
+ GPIO_CLR = 1<<GATE_PIN; // Licht an
+ for (int byte=0; byte<6; byte++) {
+ for (int bit=0; bit<8; bit++) {
+ GPIO_CLR = 1<<SER_CLK_PIN;
+ GPIO_ALTER((*(raw_output+6*line+byte)>>bit) & 0x01) = 1<<SER_DAT_PIN;
+ GPIO_SET = 1<<SER_CLK_PIN;
+ }
}
+ usleep(1000);
+ GPIO_SET = 1<<GATE_PIN; // Licht aus
+ GPIO_CLR = 1<<PAR_CLK_PIN;
+ GPIO_SET = 1<<PAR_CLK_PIN;
}
- usleep(1000);
- GPIO_SET = 1<<GATE_PIN; // Licht aus
- GPIO_CLR = 1<<PAR_CLK_PIN;
- GPIO_SET = 1<<PAR_CLK_PIN;
- }
free(raw_output);
+ return NULL;
} // put_on_screen