-
Notifications
You must be signed in to change notification settings - Fork 9
/
max7219.h
67 lines (55 loc) · 1.06 KB
/
max7219.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#pragma once
#include <stdlib.h>
#include <common_lib/spi.h>
typedef enum {
REG_CHANNEL0 = 0x01,
REG_INTENSITY = 0x0A,
REG_SCAN_LIMIT = 0x0B,
REG_SHUTDOWN = 0x0C,
REG_TEST = 0x0F,
} MAX7219_REGISTER;
/**
* Initialize module
*/
spi_device *
max7219_init(uint32_t spi);
/**
* Perform reset operation
*/
void
max7219_reset(const spi_device *device);
/**
* Turn on and off all LEDs on board
*/
void
max7219_self_test(const spi_device *device);
/**
* Turn off all LEDs
*/
void
max7219_clear_display(const spi_device *device);
/**
* Turn on all LEDs
*/
void
max7219_turn_all(const spi_device *device);
/**
* Set new intensity (brightness) of LEDs
*/
void
max7219_set_brightness(const spi_device *device, uint8_t new_value);
/**
* Turn on single LED
*/
void
max7219_set_led(const spi_device *device, uint8_t row, uint8_t column);
/**
* Turn off single LED
*/
void
max7219_reset_led(const spi_device *device, uint8_t row, uint8_t column);
/**
* Draw whole 8x8 segment
*/
void
max7219_set_data(const spi_device *device, uint8_t new_data[8]);