mirror of https://github.com/ARMmbed/mbed-os.git
				
				
				
			
						commit
						644f79592c
					
				| 
						 | 
				
			
			@ -60,9 +60,16 @@ void gpio_mode(gpio_t *obj, PinMode mode)
 | 
			
		|||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void gpio_dir(MBED_UNUSED gpio_t *obj, MBED_UNUSED PinDirection direction)
 | 
			
		||||
void gpio_dir(gpio_t *obj, PinDirection direction)
 | 
			
		||||
{
 | 
			
		||||
    // mbed reads from input buffer instead of DR even for output pins so always leave input buffer enabled
 | 
			
		||||
    if (direction == PIN_INPUT) {
 | 
			
		||||
        cyhal_gpio_direction(obj->pin, CYHAL_GPIO_DIR_INPUT);
 | 
			
		||||
        gpio_mode(obj, CYHAL_GPIO_DRIVE_ANALOG);
 | 
			
		||||
    } else if (direction == PIN_OUTPUT) {
 | 
			
		||||
        // mbed reads from input buffer instead of DR even for output pins so always leave input buffer enabled
 | 
			
		||||
        cyhal_gpio_direction(obj->pin, CYHAL_GPIO_DIR_BIDIRECTIONAL);
 | 
			
		||||
        gpio_mode(obj, CYHAL_GPIO_DRIVE_STRONG);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
		Reference in New Issue