Modified coding style of mbed.

- deleted dead code
- deleted test code
pull/4226/head
justinkim 2017-04-27 08:34:33 +09:00
parent 4fa76dc4f9
commit fe4edaeeb1
4 changed files with 7 additions and 19 deletions

View File

@ -36,21 +36,21 @@ uint8_t ADC_IsInterrupt (void)
void ADC_InterruptClear (void) void ADC_InterruptClear (void)
{ {
ADC->ADC_INT = ADC_INTCLEAR; ADC->ADC_INT = ADC_INTCLEAR;
} }
void ADC_Init (void) void ADC_Init (void)
{ {
// ADC_CLK on // ADC_CLK on
ADC_PowerDownEnable(ENABLE); ADC_PowerDownEnable(ENABLE);
ADC_PowerDownEnable(DISABLE); ADC_PowerDownEnable(DISABLE);
//ADC_ChannelSelect(num); //ADC_ChannelSelect(num);
} }
void ADC_DeInit (void) void ADC_DeInit (void)
{ {
// ADC_CLK off // ADC_CLK off
ADC_PowerDownEnable(ENABLE); ADC_PowerDownEnable(ENABLE);
ADC_InterruptMask(DISABLE); ADC_InterruptMask(DISABLE);
} }

View File

@ -42,8 +42,6 @@
ADC_TypeDef * AdcHandle; ADC_TypeDef * AdcHandle;
static int adc_inited = 0;
void analogin_init(analogin_t *obj, PinName pin) void analogin_init(analogin_t *obj, PinName pin)
{ {
// Get the peripheral name from the pin and assign it to the object // Get the peripheral name from the pin and assign it to the object
@ -57,12 +55,8 @@ void analogin_init(analogin_t *obj, PinName pin)
// Save pin number for the read function // Save pin number for the read function
obj->pin = pin; obj->pin = pin;
// The ADC initialization is done once // The ADC initialization
//if (adc_inited == 0) { ADC_Init();
adc_inited = 1;
ADC_Init();
//}
} }
static inline uint16_t adc_read(analogin_t *obj) static inline uint16_t adc_read(analogin_t *obj)

View File

@ -43,7 +43,6 @@ static gpio_irq_handler irq_handler;
static uint32_t channel_ids[4][16]; static uint32_t channel_ids[4][16];
uint32_t test_tmp = 0;
#ifdef __cplusplus #ifdef __cplusplus
extern "C"{ extern "C"{
@ -54,25 +53,21 @@ void PORT0_Handler(void)
{ {
NVIC_ClearPendingIRQ(PORT0_IRQn); NVIC_ClearPendingIRQ(PORT0_IRQn);
port_generic_handler(GPIOA, 0); port_generic_handler(GPIOA, 0);
test_tmp++;
} }
void PORT1_Handler(void) void PORT1_Handler(void)
{ {
port_generic_handler(GPIOB, 1); port_generic_handler(GPIOB, 1);
test_tmp++;
} }
void PORT2_Handler(void) void PORT2_Handler(void)
{ {
port_generic_handler(GPIOC, 2); port_generic_handler(GPIOC, 2);
test_tmp++;
} }
void PORT3_Handler(void) void PORT3_Handler(void)
{ {
port_generic_handler(GPIOD, 3); port_generic_handler(GPIOD, 3);
test_tmp++;
} }
void port_generic_handler(GPIO_TypeDef* GPIOx, uint32_t port_num) void port_generic_handler(GPIO_TypeDef* GPIOx, uint32_t port_num)
@ -119,7 +114,6 @@ int gpio_irq_init(gpio_irq_t *obj, PinName pin, gpio_irq_handler handler, uint32
else else
obj->irq_n = PORT3_IRQn; obj->irq_n = PORT3_IRQn;
obj->event = EDGE_NONE;
obj->pin = pin; obj->pin = pin;
// Enable EXTI interrupt // Enable EXTI interrupt

View File

@ -117,7 +117,7 @@ void pin_mode(PinName pin, PinMode pupd)
uint32_t port_num = WIZ_PORT(pin); uint32_t port_num = WIZ_PORT(pin);
uint32_t pin_num = WIZ_PIN_NUM(pin); uint32_t pin_num = WIZ_PIN_NUM(pin);
switch(port_num) { switch(port_num) {
case PortA: case PortA:
if(pupd != 0) if(pupd != 0)
{ {