test bench
/
led_matrix_smile
led matrix based on max7219 connected to nucleo-l476rg
main.cpp@0:f11d86c27d4c, 2020-01-21 (annotated)
- Committer:
- stek542
- Date:
- Tue Jan 21 13:46:13 2020 +0000
- Revision:
- 0:f11d86c27d4c
init commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
stek542 | 0:f11d86c27d4c | 1 | #include "max7219.h" |
stek542 | 0:f11d86c27d4c | 2 | |
stek542 | 0:f11d86c27d4c | 3 | Max7219 max7219(D11, NC, D13, D10); |
stek542 | 0:f11d86c27d4c | 4 | //DigitalOut my_sck(D13); |
stek542 | 0:f11d86c27d4c | 5 | int main() |
stek542 | 0:f11d86c27d4c | 6 | { |
stek542 | 0:f11d86c27d4c | 7 | |
stek542 | 0:f11d86c27d4c | 8 | max7219_configuration_t cfg = { |
stek542 | 0:f11d86c27d4c | 9 | .device_number = 1, |
stek542 | 0:f11d86c27d4c | 10 | .decode_mode = 0, |
stek542 | 0:f11d86c27d4c | 11 | .intensity = Max7219::MAX7219_INTENSITY_3, |
stek542 | 0:f11d86c27d4c | 12 | .scan_limit = Max7219::MAX7219_SCAN_8 |
stek542 | 0:f11d86c27d4c | 13 | }; |
stek542 | 0:f11d86c27d4c | 14 | |
stek542 | 0:f11d86c27d4c | 15 | max7219.init_device(cfg); |
stek542 | 0:f11d86c27d4c | 16 | max7219.enable_device(1); |
stek542 | 0:f11d86c27d4c | 17 | |
stek542 | 0:f11d86c27d4c | 18 | |
stek542 | 0:f11d86c27d4c | 19 | |
stek542 | 0:f11d86c27d4c | 20 | max7219.write_digit(1,1,0b00111100); |
stek542 | 0:f11d86c27d4c | 21 | max7219.write_digit(1,2,0b01000010); |
stek542 | 0:f11d86c27d4c | 22 | max7219.write_digit(1,3,0b10000001); |
stek542 | 0:f11d86c27d4c | 23 | max7219.write_digit(1,4,0b10100101); |
stek542 | 0:f11d86c27d4c | 24 | max7219.write_digit(1,5,0b10000001); |
stek542 | 0:f11d86c27d4c | 25 | max7219.write_digit(1,6,0b10100101); |
stek542 | 0:f11d86c27d4c | 26 | max7219.write_digit(1,7,0b01011010); |
stek542 | 0:f11d86c27d4c | 27 | max7219.write_digit(1,8,0b00111100); |
stek542 | 0:f11d86c27d4c | 28 | |
stek542 | 0:f11d86c27d4c | 29 | while (1) { |
stek542 | 0:f11d86c27d4c | 30 | |
stek542 | 0:f11d86c27d4c | 31 | |
stek542 | 0:f11d86c27d4c | 32 | } |
stek542 | 0:f11d86c27d4c | 33 | } |