kb_gpio.h File Reference

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

int kb_gpio_init ()
int kb_gpio_cleanup ()
void kb_gpio_dir (unsigned gpio, unsigned dir)
void kb_gpio_set (unsigned gpio)
void kb_gpio_clear (unsigned gpio)
int kb_gpio_get (unsigned gpio)
void kb_gpio_function (unsigned gpio, unsigned function)


Function Documentation

int kb_gpio_cleanup (  ) 

Cleanup the GPIO module. Must be called to free the module ressources.

Definition at line 128 of file kb_gpio.c.

References fd, KB_ERROR, KB_ERROR_MMAP, map_base, and MAP_SIZE.

void kb_gpio_clear ( unsigned  gpio  ) 

Clear a given GPIO. The GPIO must be first configured to ouput mode. If the GPIO is configured as input, it will be cleared when configured as ouput.

Parameters:
gpio A gpio number between 0 and 84

Definition at line 204 of file kb_gpio.c.

References bit_set(), GPCR, KB_ERROR, KB_ERROR_INVALID, and MAXIO.

Referenced by kb_lrf_pwrOff(), main(), and resetio().

Here is the call graph for this function:

void kb_gpio_dir ( unsigned  gpio,
unsigned  dir 
)

Configure the given GPIO as input or output. The GPIO function must be configured as well to use the pin as an IO.

Parameters:
gpio A gpio number between 0 and 84
dir The direction 0:output 1:input

Definition at line 171 of file kb_gpio.c.

References bit_clear(), bit_set(), GPDR, KB_ERROR, KB_ERROR_INVALID, and MAXIO.

Referenced by configio(), gpioinit(), kb_lrf_Init(), kb_pwm_activate(), kh3_init(), and main().

Here is the call graph for this function:

void kb_gpio_function ( unsigned  gpio,
unsigned  function 
)

Configure the given GPIO pin function. Check first if the pin is freely available on the KoreBot.

Parameters:
gpio A gpio number between 0 and 84
function 0:IO mode 1:Alternate function 1 2:Alternate function 2 3:Alternate function 3

Definition at line 148 of file kb_gpio.c.

References bit_clear(), bit_set(), GAFR, KB_ERROR, KB_ERROR_INVALID, and MAXIO.

Referenced by configio(), gpioinit(), kb_lrf_Init(), kb_pwm_activate(), kh3_init(), and main().

Here is the call graph for this function:

int kb_gpio_get ( unsigned  gpio  ) 

Get the current level for a given GPIO. It can be used regardless of the current GPIO configuration.

Parameters:
gpio A gpio number between 0 and 84
Returns:
  • 1 if the GPIO is set
  • 0 if the GPIO is cleared
  • an error code if the GPIO is invalid

Definition at line 223 of file kb_gpio.c.

References bit_test(), GPLR, KB_ERROR, KB_ERROR_INVALID, and MAXIO.

Referenced by braitenbergAvoidance(), kh3_ambiant_ir(), kh3_battery_voltage(), kh3_configure_os(), kh3_measure_us(), kh3_proximity_ir(), kh3_reset_tstamp(), kh3_revision(), readio(), and thread().

Here is the call graph for this function:

int kb_gpio_init (  ) 

Initialize the GPIO module. This function must be called before any other call the gpio functions.

Returns:
  • 0 on success
  • a negative error code on failure

Definition at line 104 of file kb_gpio.c.

References fd, GPIO_BASE, KB_ERROR, KB_ERROR_FILEOPEN, KB_ERROR_MMAP, map_base, MAP_MASK, MAP_SIZE, and MEMDEV.

Referenced by gpioinit(), kb_lrf_Init(), kb_pwm_init(), kh3_init(), and main().

void kb_gpio_set ( unsigned  gpio  ) 

Set a given GPIO. The GPIO must be first configured to ouput mode. If the GPIO is configured as input, it will be set when configured as ouput.

Parameters:
gpio A gpio number between 0 and 84

Definition at line 189 of file kb_gpio.c.

References bit_set(), GPSR, KB_ERROR, KB_ERROR_INVALID, and MAXIO.

Referenced by kb_lrf_pwrOn(), main(), and setio().

Here is the call graph for this function:


Generated on Wed Dec 15 11:49:28 2010 for KoreBot Library by  doxygen 1.5.5