-
1. Re: Simple GPIO LED usage.
MichaelF_56Oct 31, 2014 7:47 AM (in response to userc_8351)
We admittedly do not do a very good job of documenting how to enable these types of simple functions.
However, I think this one has been discussed in detail here and userc_3711 provided some sample code that you will find helpful.
-
2. Re: Simple GPIO LED usage.
userc_8351 Oct 31, 2014 7:51 AM (in response to MichaelF_56)thanks for the response
so to conclude: if you want to turn an LED on (where the LED is grounded via the attached GPIO) you call the following:
gpio_configurePin(n/16, n%16, GPIO_OUTPUT_ENABLE, 0);
Where "n" is the number in "Pn" e.g. n=14 when P14?
-
3. Re: Simple GPIO LED usage.
MichaelF_56Nov 1, 2014 6:28 AM (in response to userc_8351)
I believe the following is correct:
// The following will drive P14 low, and if the LED is hooked up right, it will turn on
gpio_configurePin(14/16, 14%16, GPIO_OUTPUT_ENABLE, 0);
I believe that the /16 and Modulus operator are being used to map the Port and the physical pin.
Ex.
P0 – P15 = PORT0
P16-P31 = PORT1
P32-P38 = PORT2