/************************************************************************/ /* */ /* File: gpio.c */ /* Description: general purpose input/output driver. */ /* Version: 1.0 */ /* Author: Otto Mattik */ /* */ /* (C)Copyright Otto Mattik 2014-2021. */ /* */ /* This file is a part of 'armen' (a tiny operating system). */ /* 'armen' is distributed under the CeCILL-V2.1 licence. For more */ /* details about this licence, please visit the website cecill.info */ /* */ /************************************************************************/ #include #include "armen.h" #ifdef __AVR_ARCH__ #define AVR_GPIO_C #include "avr/gpio.c" #endif /* * initialize a gpio pin * * input: * gpio gpio pin * mode input or output */ void gpio_pin_mode( uint8_t gpio, uint8_t mode, ... ) { #ifdef CHECK_PARAM if( gpio < (GPIO_MAX_PORT << 3) ) #endif { if( mode == GPIO_INPUT ) gpio_pin_mode_input( gpio ); else #ifdef CHECK_PARAM if( mode == GPIO_OUTPUT ) #endif { va_list args; uint8_t value; va_start( args, mode ); value = (uint8_t)va_arg( args, int ); gpio_pin_mode_output( gpio, value ); va_end( args ); } } }