Subversion Repositories idreammicro-avr

Rev

Blame | Last modification | View Log | Download | RSS feed

/**************************************************************************//**
 * \brief USART library - Demonstration program
 * \author Copyright (C) 2011  Julien Le Sech - www.idreammicro.com
 * \version 1.0
 * \date 20090314
 *
 * This file is part of the iDreamMicro library.
 *
 * This library is free software: you can redistribute it and/or modify it under
 * the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any
 * later version.
 *
 * This library is distributed in the hope that it will be useful, but WITHOUT
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
 * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
 * details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see http://www.gnu.org/licenses/
 ******************************************************************************/


/**************************************************************************//**
 * \file demo_max7219.c
 ******************************************************************************/


/******************************************************************************
 * Header file inclusions.
 ******************************************************************************/


#include <max7219/max7219.h>

#include <util/delay.h>

#include <stdbool.h>
#include <stdlib.h>

/******************************************************************************
 * Main function.
 ******************************************************************************/


/**************************************************************************//**
 * \fn int main(void)
 *
 * \brief Main function.
 ******************************************************************************/

int
main
(
    void
){
    // Initialize and configure MAX7219.
    max7219__initialize();
    max7219__set_scan_limit(max7219__scan_limit__digit_0_to_7);
    max7219__set_intensity(max7219__intensity__level_15);
    max7219__set_decode_mode(max7219__decode_mode__all_digits);

    // Switch on MAX7219 display.
    max7219__set_shutdown_mode(max7219__shutdown_mode__normal_operation);

    // Write values on digits.

    max7219__write_char_on_digit(max7219__digit__0, max7219__character__zero, false);
    max7219__write_char_on_digit(max7219__digit__1, max7219__character__one, true);
    max7219__write_char_on_digit(max7219__digit__2, max7219__character__two, false);
    max7219__write_char_on_digit(max7219__digit__3, max7219__character__three, true);
    max7219__write_char_on_digit(max7219__digit__4, max7219__character__four, false);
    max7219__write_char_on_digit(max7219__digit__5, max7219__character__five, true);
    max7219__write_char_on_digit(max7219__digit__6, max7219__character__six, false);
    max7219__write_char_on_digit(max7219__digit__7, max7219__character__seven, true);

    for (;;);

    return 0;
}