Rev 2 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | jlesech | 1 | /**************************************************************************//** |
2 | * \brief Digital I/O 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 digital_io__demo.c |
||
25 | ******************************************************************************/ |
||
26 | |||
27 | /****************************************************************************** |
||
28 | * Header file inclusions. |
||
29 | ******************************************************************************/ |
||
30 | |||
31 | #include "../digital_io.h" |
||
32 | |||
33 | #include <avr/io.h> |
||
34 | #include <util/delay.h> |
||
35 | |||
36 | /****************************************************************************** |
||
37 | * Main function. |
||
38 | ******************************************************************************/ |
||
39 | |||
40 | /**************************************************************************//** |
||
41 | * \fn int main(void) |
||
42 | * |
||
43 | * \brief Main function. |
||
44 | ******************************************************************************/ |
||
45 | int |
||
46 | main |
||
47 | ( |
||
48 | void |
||
49 | ){ |
||
50 | // Declare pin. |
||
51 | digital_io__pin_position_t pin = DIGITAL_IO__PORT_B | DIGITAL_IO__PIN_5; |
||
52 | |||
53 | // Configure pin as output. |
||
54 | digital_io__configure_pin(pin, DIGITAL_IO__DIRECTION__OUTPUT); |
||
55 | |||
24 | jlesech | 56 | for (;;) |
2 | jlesech | 57 | { |
58 | // Set pin level. |
||
59 | digital_io__set_pin_level(pin, DIGITAL_IO__LEVEL__HIGH); |
||
60 | _delay_ms(1000); |
||
61 | |||
62 | // Reset pin level. |
||
63 | digital_io__set_pin_level(pin, DIGITAL_IO__LEVEL__LOW); |
||
64 | _delay_ms(1000); |
||
65 | } |
||
66 | |||
67 | return 0; |
||
68 | } |