Refactored bits of gpio_api.c

In between the last two commits, I added debugging lines using serial to
try and locate the line of code that was causing the issues with GPIO.
However, didn't get anywhere with this because the gpio_write function
is defined in a header file, rather than in an implementation file, so
the printf function can't go there. As a result, it's just refactoring.
pull/17/head
Matthew Else 2013-07-19 15:23:25 +01:00
parent c703096234
commit 66ca1c9db2
1 changed files with 16 additions and 14 deletions

View File

@ -63,7 +63,9 @@ void gpio_init(gpio_t *obj, PinName pin, PinDirection direction) {
obj->reg_in = &port_reg->DATA; obj->reg_in = &port_reg->DATA;
obj->reg_data= &port_reg->DATA; obj->reg_data= &port_reg->DATA;
gpio_dir(obj, direction); gpio_dir(obj, direction);
switch (direction) { switch (direction) {
case PIN_OUTPUT: pin_mode(pin, PullNone); break; case PIN_OUTPUT: pin_mode(pin, PullNone); break;
case PIN_INPUT : pin_mode(pin, PullDown); break; case PIN_INPUT : pin_mode(pin, PullDown); break;