mbed library sources
Dependents: Encrypted my_mbed lklk CyaSSL_DTLS_Cellular ... more
Superseded
This library was superseded by mbed-dev - https://os.mbed.com/users/mbed_official/code/mbed-dev/.
Development branch of the mbed library sources. This library is kept in synch with the latest changes from the mbed SDK and it is not guaranteed to work.
If you are looking for a stable and tested release, please import one of the official mbed library releases:
Import librarymbed
The official Mbed 2 C/C++ SDK provides the software platform and libraries to build your applications.
targets/cmsis/TARGET_WIZNET/TARGET_W7500x/W7500x_adc.c@558:0880f51c4036, 2015-06-03 (annotated)
- Committer:
- mbed_official
- Date:
- Wed Jun 03 09:00:09 2015 +0100
- Revision:
- 558:0880f51c4036
Synchronized with git revision 927c31ab8457cfef0ee8a8316117b7a41fd79133
Full URL: https://github.com/mbedmicro/mbed/commit/927c31ab8457cfef0ee8a8316117b7a41fd79133/
Add WIZwiki-W7500
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
mbed_official | 558:0880f51c4036 | 1 | #include "W7500x.h" |
mbed_official | 558:0880f51c4036 | 2 | |
mbed_official | 558:0880f51c4036 | 3 | void ADC_PowerDownEnable (FunctionalState NewState) |
mbed_official | 558:0880f51c4036 | 4 | { |
mbed_official | 558:0880f51c4036 | 5 | if (NewState != DISABLE) ADC->ADC_CTR = ADC_CTR_PWD_PD; |
mbed_official | 558:0880f51c4036 | 6 | else ADC->ADC_CTR = ADC_CTR_PWD_NRMOP; |
mbed_official | 558:0880f51c4036 | 7 | } |
mbed_official | 558:0880f51c4036 | 8 | |
mbed_official | 558:0880f51c4036 | 9 | void ADC_ChannelSelect (ADC_CH num) |
mbed_official | 558:0880f51c4036 | 10 | { |
mbed_official | 558:0880f51c4036 | 11 | assert_param(IS_ADC_CH_NUM(num)); |
mbed_official | 558:0880f51c4036 | 12 | ADC->ADC_CHSEL = num; |
mbed_official | 558:0880f51c4036 | 13 | } |
mbed_official | 558:0880f51c4036 | 14 | |
mbed_official | 558:0880f51c4036 | 15 | void ADC_Start (void) |
mbed_official | 558:0880f51c4036 | 16 | { |
mbed_official | 558:0880f51c4036 | 17 | ADC->ADC_START = ADC_START_START; |
mbed_official | 558:0880f51c4036 | 18 | } |
mbed_official | 558:0880f51c4036 | 19 | |
mbed_official | 558:0880f51c4036 | 20 | uint16_t ADC_ReadData (void) |
mbed_official | 558:0880f51c4036 | 21 | { |
mbed_official | 558:0880f51c4036 | 22 | return ((uint16_t)ADC->ADC_DATA); |
mbed_official | 558:0880f51c4036 | 23 | } |
mbed_official | 558:0880f51c4036 | 24 | |
mbed_official | 558:0880f51c4036 | 25 | void ADC_InterruptMask (FunctionalState NewState) |
mbed_official | 558:0880f51c4036 | 26 | { |
mbed_official | 558:0880f51c4036 | 27 | if (NewState != DISABLE) ADC->ADC_INT = ADC_INT_MASK_ENA; |
mbed_official | 558:0880f51c4036 | 28 | else ADC->ADC_INT = ADC_INT_MASK_DIS; |
mbed_official | 558:0880f51c4036 | 29 | } |
mbed_official | 558:0880f51c4036 | 30 | |
mbed_official | 558:0880f51c4036 | 31 | uint8_t ADC_IsInterrupt (void) |
mbed_official | 558:0880f51c4036 | 32 | { |
mbed_official | 558:0880f51c4036 | 33 | return (((uint8_t)ADC->ADC_INT && 0x01ul)); |
mbed_official | 558:0880f51c4036 | 34 | } |
mbed_official | 558:0880f51c4036 | 35 | |
mbed_official | 558:0880f51c4036 | 36 | void ADC_InterruptClear (void) |
mbed_official | 558:0880f51c4036 | 37 | { |
mbed_official | 558:0880f51c4036 | 38 | ADC->ADC_INT = ADC_INTCLEAR; |
mbed_official | 558:0880f51c4036 | 39 | } |
mbed_official | 558:0880f51c4036 | 40 | |
mbed_official | 558:0880f51c4036 | 41 | void ADC_Init (void) |
mbed_official | 558:0880f51c4036 | 42 | { |
mbed_official | 558:0880f51c4036 | 43 | // ADC_CLK on |
mbed_official | 558:0880f51c4036 | 44 | ADC_PowerDownEnable(DISABLE); |
mbed_official | 558:0880f51c4036 | 45 | //ADC_ChannelSelect(num); |
mbed_official | 558:0880f51c4036 | 46 | } |
mbed_official | 558:0880f51c4036 | 47 | |
mbed_official | 558:0880f51c4036 | 48 | void ADC_DeInit (void) |
mbed_official | 558:0880f51c4036 | 49 | { |
mbed_official | 558:0880f51c4036 | 50 | // ADC_CLK off |
mbed_official | 558:0880f51c4036 | 51 | ADC_PowerDownEnable(ENABLE); |
mbed_official | 558:0880f51c4036 | 52 | ADC_InterruptMask(DISABLE); |
mbed_official | 558:0880f51c4036 | 53 | } |
mbed_official | 558:0880f51c4036 | 54 |