Details | Last modification | View Log | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 59 | jlesech | 1 | /**************************************************************************//** |
| 2 | * \brief ADC library - Demonstration program |
||
| 3 | * \author Copyright (C) 2012 Julien Le Sech - www.idreammicro.com |
||
| 4 | * \version 1.0 |
||
| 5 | * \date 20121104 |
||
| 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 adc__demo.c |
||
| 25 | ******************************************************************************/ |
||
| 26 | |||
| 27 | /****************************************************************************** |
||
| 28 | * Header file inclusions. |
||
| 29 | ******************************************************************************/ |
||
| 30 | |||
| 31 | #include "../adc.h" |
||
| 32 | |||
| 33 | #include <util/delay.h> |
||
| 34 | |||
| 35 | /****************************************************************************** |
||
| 36 | * Main function. |
||
| 37 | ******************************************************************************/ |
||
| 38 | |||
| 39 | /**************************************************************************//** |
||
| 40 | * \fn int main(void) |
||
| 41 | * |
||
| 42 | * \brief Main function. |
||
| 43 | ******************************************************************************/ |
||
| 44 | int |
||
| 45 | main |
||
| 46 | ( |
||
| 47 | void |
||
| 48 | ){ |
||
| 49 | // Initialize ADC. |
||
| 50 | adc__single_channel_initialize(ADC__CHANNEL_0); |
||
| 51 | |||
| 52 | for (;;) |
||
| 53 | { |
||
| 54 | // Read ADC value. |
||
| 55 | uint16_t value = adc__single_channel_read(); |
||
| 56 | _delay_ms(100); |
||
| 57 | } |
||
| 58 | |||
| 59 | return 0; |
||
| 60 | } |