]> Git Repo - pov-display-rpi.git/blame - src/tlc59711.c
get to compile but wont link dont know why added readme
[pov-display-rpi.git] / src / tlc59711.c
CommitLineData
4b5f5fcb 1#include "tlc59711.h"
2static uint32_t command = 0;
3static int fd = 0;
a6a035a7 4
5static uint32_t CommandInit();
6
4b5f5fcb 7extern int tlc59711_init(const char *device)
8{
9 command = CommandInit(); // need to set modes
10 spiMode modes = {
11 .mode = 0,
12 .bits = 8,
13 .speed = 500000,
14 .delay = 0};
15
16 int fd = spi_init(&modes, device);
17 return fd;
18}
a6a035a7 19extern void tlc59711_send(const uint16_t data[12])
20{
4b5f5fcb 21 uint8_t rx[24]; // throw away
22 uint8_t tx[24];
23
24 tx[0] = command >> 24;
25 tx[1] = command >> 16;
26 tx[2] = command >> 8;
27 tx[3] = command;
28 transfer(tx,rx,4);
29
30
31 // 12 channels per TLC59711
32 for (int8_t c = 11; c >= 0; c--) {
33
34 // 16 bits per channel, send MSB first
35 //spiSend(data[c] >> 8);
36 //spiSend(data[c]);
37 tx[c << 1] = 0xFF;
38 }
39 transfer(tx,rx,24);
40}
41
42
a6a035a7 43static uint32_t CommandInit()
44{
4b5f5fcb 45 uint32_t commands = 0;
46 commands = 0x25;
47 commands <<= 5;
48 commands |= 0x16;
49 commands <<= 7;
50 commands |= 0x7F;
51 commands <<= 7;
52 commands |= 0x7F;
53 commands <<= 7;
54 commands |= 0x7F;
55 return commands;
56}
This page took 0.026196 seconds and 4 git commands to generate.