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.

Committer:
mbed_official
Date:
Fri Sep 04 09:30:10 2015 +0100
Revision:
619:034e698bc035
Synchronized with git revision 92d1bfad30082571776c810a56fd471d30514ccf

Full URL: https://github.com/mbedmicro/mbed/commit/92d1bfad30082571776c810a56fd471d30514ccf/

Change directory structure and move files.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
mbed_official 619:034e698bc035 1 #include "W7500x.h"
mbed_official 619:034e698bc035 2 #include "W7500x_adc.h"
mbed_official 619:034e698bc035 3
mbed_official 619:034e698bc035 4 void ADC_PowerDownEnable (FunctionalState NewState)
mbed_official 619:034e698bc035 5 {
mbed_official 619:034e698bc035 6 if (NewState != DISABLE) ADC->ADC_CTR = ADC_CTR_PWD_PD;
mbed_official 619:034e698bc035 7 else ADC->ADC_CTR = ADC_CTR_PWD_NRMOP;
mbed_official 619:034e698bc035 8 }
mbed_official 619:034e698bc035 9
mbed_official 619:034e698bc035 10 void ADC_ChannelSelect (ADC_CH num)
mbed_official 619:034e698bc035 11 {
mbed_official 619:034e698bc035 12 assert_param(IS_ADC_CH_NUM(num));
mbed_official 619:034e698bc035 13 ADC->ADC_CHSEL = num;
mbed_official 619:034e698bc035 14 }
mbed_official 619:034e698bc035 15
mbed_official 619:034e698bc035 16 void ADC_Start (void)
mbed_official 619:034e698bc035 17 {
mbed_official 619:034e698bc035 18 ADC->ADC_START = ADC_START_START;
mbed_official 619:034e698bc035 19 }
mbed_official 619:034e698bc035 20
mbed_official 619:034e698bc035 21 uint16_t ADC_ReadData (void)
mbed_official 619:034e698bc035 22 {
mbed_official 619:034e698bc035 23 return ((uint16_t)ADC->ADC_DATA);
mbed_official 619:034e698bc035 24 }
mbed_official 619:034e698bc035 25
mbed_official 619:034e698bc035 26 void ADC_InterruptMask (FunctionalState NewState)
mbed_official 619:034e698bc035 27 {
mbed_official 619:034e698bc035 28 if (NewState != DISABLE) ADC->ADC_INT = ADC_INT_MASK_ENA;
mbed_official 619:034e698bc035 29 else ADC->ADC_INT = ADC_INT_MASK_DIS;
mbed_official 619:034e698bc035 30 }
mbed_official 619:034e698bc035 31
mbed_official 619:034e698bc035 32 uint8_t ADC_IsInterrupt (void)
mbed_official 619:034e698bc035 33 {
mbed_official 619:034e698bc035 34 return (((uint8_t)ADC->ADC_INT && 0x01ul));
mbed_official 619:034e698bc035 35 }
mbed_official 619:034e698bc035 36
mbed_official 619:034e698bc035 37 void ADC_InterruptClear (void)
mbed_official 619:034e698bc035 38 {
mbed_official 619:034e698bc035 39 ADC->ADC_INT = ADC_INTCLEAR;
mbed_official 619:034e698bc035 40 }
mbed_official 619:034e698bc035 41
mbed_official 619:034e698bc035 42 void ADC_Init (void)
mbed_official 619:034e698bc035 43 {
mbed_official 619:034e698bc035 44 // ADC_CLK on
mbed_official 619:034e698bc035 45 ADC_PowerDownEnable(DISABLE);
mbed_official 619:034e698bc035 46 //ADC_ChannelSelect(num);
mbed_official 619:034e698bc035 47 }
mbed_official 619:034e698bc035 48
mbed_official 619:034e698bc035 49 void ADC_DeInit (void)
mbed_official 619:034e698bc035 50 {
mbed_official 619:034e698bc035 51 // ADC_CLK off
mbed_official 619:034e698bc035 52 ADC_PowerDownEnable(ENABLE);
mbed_official 619:034e698bc035 53 ADC_InterruptMask(DISABLE);
mbed_official 619:034e698bc035 54 }
mbed_official 619:034e698bc035 55