2 * Copyright © 2017 Keith Packard <keithp@keithp.com>
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.
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.
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
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
40 void ao_as1107_init(void);
43 ao_as1107_write(uint8_t start, uint8_t count, uint8_t *values);
46 ao_as1107_write_8(uint8_t start, uint8_t value);
49 ao_as1107_write_16(uint8_t start, uint16_t value);
51 #ifndef AO_AS1107_DECODE
52 #error "must define AO_AS1107_DECODE"
55 #ifndef AO_AS1107_NUM_DIGITS
56 #error "must define AO_AS1107_NUM_DIGITS"
59 #endif /* _AO_AS1107_H_ */