8 Commits

Author SHA1 Message Date
Uwe Hermann
f1a6e56f5c gpio: Fix some issues with gpio_set_mode().
This patch, a slightly modified version of a patch from Thomas Otto,
should fix the following two issues:

 - It generally sets the submited config to the mentioned GPIO pins but
   kills configs for other pins on the same GPIO port. So if we want to set
   PB6 and PB7 to push-pull and I2C2 SDA and SCL (PB10 and PB11) to open
   drain it's simply impossible, because the second config try kills the first.

 - The floating-bit thing isn't working correctly. If we enable a config
   for PB6 for instance, the same config will also apply to all following
   pins of that port (i.e. PB7-PB15). That's because the shifting isn't only
   done if a pin isn't to configure, if you are hitting a matching bit the
   shiftig is missing. I think shifting isn't nessessary for a separate
   variable. We have the counting index from the for statement.

Both issues should now be fixed.
2010-03-05 19:46:57 +01:00
Uwe Hermann
e7cadf0822 Use direct #includes instead of libopenstm32.h. 2010-03-04 21:25:25 +01:00
Piotr Esden-Tempski
446de38728 Changed all includes to use <foo.h> notation. 2009-07-20 17:54:33 +02:00
Uwe Hermann
3bef8767f9 Add gpio_get() API function. 2009-07-18 17:41:31 +02:00
Uwe Hermann
83f5c58eb9 Switch the license to GPL, version 3 or later. 2009-07-18 16:27:47 +02:00
Uwe Hermann
3262983d27 Add initial GPIO API implementation.
This currently includes a number of basic functions. Example usage:

 gpio_set_mode(GPIOC, GPIO_MODE_OUTPUT_2_MHZ,
               GPIO_CNF_OUTPUT_PUSHPULL, GPIO12);
 gpio_set(GPIOB, GPIO4);
 gpio_clear(GPIOG, GPIO2 | GPIO9);
 gpio_toggle(GPIOA, GPIO7);
 reg16 = gpio_port_read(GPIOD);
 gpio_port_write(GPIOF, 0xc8fe);
2009-07-18 16:20:32 +02:00
Uwe Hermann
c62ca6143d Make gpio number argument 'unsigned int', there are no negative GPIOs. 2009-07-16 14:23:25 +02:00
Uwe Hermann
0a8135395a Add dummy gpio.c implementation and final Makefile.
The whole lib should now build and install fine. It's not yet tested
on hardware, though.
2009-07-16 03:27:05 +02:00