Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 68 | jlesech | 1 | /**************************************************************************//** |
| 2 | * \brief USART library - Demonstration program |
||
| 3 | * \author Copyright (C) 2011 Julien Le Sech - www.idreammicro.com |
||
| 4 | * \version 1.0 |
||
| 5 | * \date 20090314 |
||
| 6 | * |
||
| 7 | * This file is part of the iDreamMicro library. |
||
| 8 | * |
||
| 9 | * This library is free software: you can redistribute it and/or modify it under |
||
| 10 | * the terms of the GNU Lesser General Public License as published by the Free |
||
| 11 | * Software Foundation, either version 3 of the License, or (at your option) any |
||
| 12 | * later version. |
||
| 13 | * |
||
| 14 | * This library is distributed in the hope that it will be useful, but WITHOUT |
||
| 15 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS |
||
| 16 | * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more |
||
| 17 | * details. |
||
| 18 | * |
||
| 19 | * You should have received a copy of the GNU Lesser General Public License |
||
| 20 | * along with this program. If not, see http://www.gnu.org/licenses/ |
||
| 21 | ******************************************************************************/ |
||
| 22 | |||
| 23 | /**************************************************************************//** |
||
| 24 | * \file demo_max7219.c |
||
| 25 | ******************************************************************************/ |
||
| 26 | |||
| 27 | /****************************************************************************** |
||
| 28 | * Header file inclusions. |
||
| 29 | ******************************************************************************/ |
||
| 30 | |||
| 31 | #include <max7219/max7219.h> |
||
| 32 | |||
| 33 | #include <util/delay.h> |
||
| 34 | |||
| 35 | #include <stdbool.h> |
||
| 36 | #include <stdlib.h> |
||
| 37 | |||
| 38 | /****************************************************************************** |
||
| 39 | * Main function. |
||
| 40 | ******************************************************************************/ |
||
| 41 | |||
| 42 | /**************************************************************************//** |
||
| 43 | * \fn int main(void) |
||
| 44 | * |
||
| 45 | * \brief Main function. |
||
| 46 | ******************************************************************************/ |
||
| 47 | int |
||
| 48 | main |
||
| 49 | ( |
||
| 50 | void |
||
| 51 | ){ |
||
| 52 | // Initialize and configure MAX7219. |
||
| 53 | max7219__initialize(); |
||
| 54 | max7219__set_scan_limit(max7219__scan_limit__digit_0_to_7); |
||
| 55 | max7219__set_intensity(max7219__intensity__level_15); |
||
| 56 | max7219__set_decode_mode(max7219__decode_mode__all_digits); |
||
| 57 | |||
| 58 | // Switch on MAX7219 display. |
||
| 59 | max7219__set_shutdown_mode(max7219__shutdown_mode__normal_operation); |
||
| 60 | |||
| 61 | // Write values on digits. |
||
| 62 | |||
| 63 | max7219__write_char_on_digit(max7219__digit__0, max7219__character__zero, false); |
||
| 64 | max7219__write_char_on_digit(max7219__digit__1, max7219__character__one, true); |
||
| 65 | max7219__write_char_on_digit(max7219__digit__2, max7219__character__two, false); |
||
| 66 | max7219__write_char_on_digit(max7219__digit__3, max7219__character__three, true); |
||
| 67 | max7219__write_char_on_digit(max7219__digit__4, max7219__character__four, false); |
||
| 68 | max7219__write_char_on_digit(max7219__digit__5, max7219__character__five, true); |
||
| 69 | max7219__write_char_on_digit(max7219__digit__6, max7219__character__six, false); |
||
| 70 | max7219__write_char_on_digit(max7219__digit__7, max7219__character__seven, true); |
||
| 71 | |||
| 72 | for (;;); |
||
| 73 | |||
| 74 | return 0; |
||
| 75 | } |