Demo to control 4 LEDs
Dependencies: BSP_DISCO_F469NI mbed
ADC_F469/ADC.cpp@2:e6fc24fbd86c, 2017-10-31 (annotated)
- Committer:
- Faberge
- Date:
- Tue Oct 31 14:46:28 2017 +0000
- Revision:
- 2:e6fc24fbd86c
- Parent:
- 1:a6d179a9ffbb
Update
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Faberge | 1:a6d179a9ffbb | 1 | /* |
Faberge | 1:a6d179a9ffbb | 2 | * ADC.cpp |
Faberge | 1:a6d179a9ffbb | 3 | * |
Faberge | 1:a6d179a9ffbb | 4 | * Copyright 2017 Faberge@TsarTeam |
Faberge | 1:a6d179a9ffbb | 5 | * |
Faberge | 1:a6d179a9ffbb | 6 | * This program is free software; you can redistribute it and/or modify |
Faberge | 1:a6d179a9ffbb | 7 | * it under the terms of the GNU General Public License as published by |
Faberge | 1:a6d179a9ffbb | 8 | * the Free Software Foundation; either version 2 of the License, or |
Faberge | 1:a6d179a9ffbb | 9 | * (at your option) any later version. |
Faberge | 1:a6d179a9ffbb | 10 | * |
Faberge | 1:a6d179a9ffbb | 11 | * This program is distributed in the hope that it will be useful, |
Faberge | 1:a6d179a9ffbb | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
Faberge | 1:a6d179a9ffbb | 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
Faberge | 1:a6d179a9ffbb | 14 | * GNU General Public License for more details. |
Faberge | 1:a6d179a9ffbb | 15 | * |
Faberge | 1:a6d179a9ffbb | 16 | */ |
Faberge | 1:a6d179a9ffbb | 17 | |
Faberge | 1:a6d179a9ffbb | 18 | #include "ADC.h" |
Faberge | 1:a6d179a9ffbb | 19 | |
Faberge | 1:a6d179a9ffbb | 20 | uint16_t analogRead(const uint16_t channel) |
Faberge | 1:a6d179a9ffbb | 21 | { |
Faberge | 1:a6d179a9ffbb | 22 | /* If function is called for the first time, |
Faberge | 1:a6d179a9ffbb | 23 | * configure ADC and low level pin settings |
Faberge | 1:a6d179a9ffbb | 24 | */ |
Faberge | 1:a6d179a9ffbb | 25 | |
Faberge | 1:a6d179a9ffbb | 26 | uint16_t result; |
Faberge | 1:a6d179a9ffbb | 27 | |
Faberge | 1:a6d179a9ffbb | 28 | switch(channel) |
Faberge | 1:a6d179a9ffbb | 29 | { |
Faberge | 1:a6d179a9ffbb | 30 | case(A0): break; |
Faberge | 1:a6d179a9ffbb | 31 | case(A1): break; |
Faberge | 1:a6d179a9ffbb | 32 | case(A2): break; |
Faberge | 1:a6d179a9ffbb | 33 | } |
Faberge | 1:a6d179a9ffbb | 34 | |
Faberge | 1:a6d179a9ffbb | 35 | return result; |
Faberge | 1:a6d179a9ffbb | 36 | } |