altos/test: Adjust CRC error rate after FEC fix
[fw/altos] / src / drivers / ao_as1107.h
1 /*
2  * Copyright © 2017 Keith Packard <keithp@keithp.com>
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation, either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful, but
10  * WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * General Public License for more details.
13  */
14
15 #ifndef _AO_AS1107_H_
16 #define _AO_AS1107_H_
17
18 #define AO_AS1107_NO_OP         0x00
19 #define AO_AS1107_DIGIT(n)      (0x01 + (n))
20 #define AO_AS1107_DECODE_MODE   0x09
21 #define AO_AS1107_INTENSITY     0x0a
22 #define AO_AS1107_SCAN_LIMIT    0x0b
23 #define AO_AS1107_SHUTDOWN      0x0c
24 #define  AO_AS1107_SHUTDOWN_SHUTDOWN_RESET      0x00
25 #define  AO_AS1107_SHUTDOWN_SHUTDOWN_NOP        0x80
26 #define  AO_AS1107_SHUTDOWN_NORMAL_RESET        0x01
27 #define  AO_AS1107_SHUTDOWN_NORMAL_NOP          0x81
28
29 #define AO_AS1107_FEATURE       0x0e
30 #define  AO_AS1107_FEATURE_CLK_EN       0       /* external clock enable */
31 #define  AO_AS1107_FEATURE_REG_RES      1
32 #define  AO_AS1107_FEATURE_DECODE_SEL   2       /* select HEX decode */
33 #define  AO_AS1107_FEATURE_SPI_EN       3
34 #define  AO_AS1107_FEATURE_BLINK_EN     4
35 #define  AO_AS1107_FEATURE_BLINK_FREQ   5
36 #define  AO_AS1107_FEATURE_SYNC         6
37 #define  AO_AS1107_FEATURE_BLINK_START  7
38 #define AO_AS1107_DISPLAY_TEST  0x0f
39
40 void ao_as1107_init(void);
41
42 void
43 ao_as1107_write(uint8_t start, uint8_t count, uint8_t *values);
44
45 void
46 ao_as1107_write_8(uint8_t start, uint8_t value);
47
48 void
49 ao_as1107_write_16(uint8_t start, uint16_t value);
50
51 #ifndef AO_AS1107_DECODE
52 #error "must define AO_AS1107_DECODE"
53 #endif
54
55 #ifndef AO_AS1107_NUM_DIGITS
56 #error "must define AO_AS1107_NUM_DIGITS"
57 #endif
58
59 #endif /* _AO_AS1107_H_ */