Hi, I have configured CON4 for IO. Out of 13 available pins i want to configure 4 pins as input and remaining for output. I am able to work with output pins i.e. setpin and getpin both are working on these output pins. I want to know to how to configure input pins. Will my getpin work with input pins too? If yes, can i attach the input directly to pins (e.g. 2.5 volts signal received from PIR sensor)? TIA Kailas Shetye
Configuring input for PINS
Is the PIR an analogue varying voltage? If you are just looking for a HI or a LO and 2.5V is above the HI threshold for the logic then you should be able to connect it directly. Make sure you don't exceed the maximum allowed input voltage. If you are looking for changes in voltage you'll have to dig into the ADC. Fortunately, there is an example in the example code.
Hi Vikas, To configure pins as input/output take a look at these files: C headers: #include <mach/regs-gpio.h> #include <mach/regs-gpioj.h> #include <linux/gpio.h> Take a look at the file "gpio.txt", available on "linux-2.6.32.2/Documentation$" folder. Look for how to use this functions: s3c2410_gpio_getpin() s3c2410_gpio_setpin() s3c2410_gpio_cfgpin() hope it helps! regards