LibDriver MAX7219
Loading...
Searching...
No Matches
driver_max7219_basic.c
Go to the documentation of this file.
1
37
39
40static max7219_handle_t gs_handle;
41
49uint8_t max7219_basic_init(void)
50{
51 uint8_t res;
52
53 /* link functions */
61
62 /* max7219 init */
63 res = max7219_init(&gs_handle);
64 if (res != 0)
65 {
66 max7219_interface_debug_print("max7219: init failed.\n");
67
68 return 1;
69 }
70
71 /* max7219 set default decode */
73 if (res != 0)
74 {
75 max7219_interface_debug_print("max7219: set decode failed.\n");
76 (void)max7219_deinit(&gs_handle);
77
78 return 1;
79 }
80
81 /* max7219 set default mode */
83 if (res != 0)
84 {
85 max7219_interface_debug_print("max7219: set mode failed.\n");
86 (void)max7219_deinit(&gs_handle);
87
88 return 1;
89 }
90
91 /* max7219 set default display test mode */
93 if (res != 0)
94 {
95 max7219_interface_debug_print("max7219: set display test mode failed.\n");
96 (void)max7219_deinit(&gs_handle);
97
98 return 1;
99 }
100
101 /* max7219 set default intensity */
103 if (res != 0)
104 {
105 max7219_interface_debug_print("max7219: set intensity failed.\n");
106 (void)max7219_deinit(&gs_handle);
107
108 return 1;
109 }
110
111 /* max7219 set default scan limit */
113 if (res != 0)
114 {
115 max7219_interface_debug_print("max7219: set scan limit failed.\n");
116 (void)max7219_deinit(&gs_handle);
117
118 return 1;
119 }
120
121 return 0;
122}
123
132uint8_t max7219_basic_set_matrix(uint8_t matrix[8])
133{
134 /* set matrix */
135 if (max7219_set_matrix(&gs_handle, matrix) != 0)
136 {
137 return 1;
138 }
139 else
140 {
141 return 0;
142 }
143}
144
154uint8_t max7219_basic_set_display(max7219_digital_t digital, uint8_t data)
155{
156 /* set display */
157 if (max7219_set_display(&gs_handle, digital, data) != 0)
158 {
159 return 1;
160 }
161 else
162 {
163 return 0;
164 }
165}
166
175{
176 /* close max7219 */
177 if (max7219_deinit(&gs_handle) != 0)
178 {
179 return 1;
180 }
181 else
182 {
183 return 0;
184 }
185}
driver max7219 basic header file
uint8_t max7219_set_display(max7219_handle_t *handle, max7219_digital_t digital, uint8_t data)
set the display content
uint8_t max7219_set_decode(max7219_handle_t *handle, max7219_decode_t decode)
set the decode mode
uint8_t max7219_set_scan_limit(max7219_handle_t *handle, max7219_scan_limit_t limit)
set the scan limit
uint8_t max7219_init(max7219_handle_t *handle)
initialize the chip
max7219_digital_t
max7219 digital enumeration definition
uint8_t max7219_set_intensity(max7219_handle_t *handle, max7219_intensity_t intensity)
set the display intensity
uint8_t max7219_set_mode(max7219_handle_t *handle, max7219_mode_t mode)
set the chip mode
uint8_t max7219_deinit(max7219_handle_t *handle)
close the chip
struct max7219_handle_s max7219_handle_t
max7219 handle structure definition
uint8_t max7219_set_matrix(max7219_handle_t *handle, uint8_t matrix[8])
set the content matrix
uint8_t max7219_set_display_test_mode(max7219_handle_t *handle, max7219_display_test_mode_t mode)
set the display test mode
uint8_t max7219_basic_deinit(void)
basic example deinit
uint8_t max7219_basic_set_display(max7219_digital_t digital, uint8_t data)
basic example set the display
uint8_t max7219_basic_set_matrix(uint8_t matrix[8])
basic example set the matrix
#define MAX7219_BASIC_DEFAULT_SCAN_LIMIT
#define MAX7219_BASIC_DEFAULT_DECODE
max7219 basic example default definition
#define MAX7219_BASIC_DEFAULT_INTENSITY
#define MAX7219_BASIC_DEFAULT_TEST_MODE
uint8_t max7219_basic_init(void)
basic example init
#define MAX7219_BASIC_DEFAULT_MODE
uint8_t max7219_interface_spi_init(void)
interface spi bus init
uint8_t max7219_interface_spi_deinit(void)
interface spi bus deinit
uint8_t max7219_interface_spi_write(uint8_t reg, uint8_t *buf, uint16_t len)
interface spi bus write
uint8_t max7219_interface_spi_write_cmd(uint8_t *buf, uint16_t len)
interface spi bus write command
void max7219_interface_delay_ms(uint32_t ms)
interface delay ms
void max7219_interface_debug_print(const char *const fmt,...)
interface print format data