<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>LPC MicrocontrollersのトピックSmall question about GPIO function</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573570#M18847</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by zepedrowdp on Fri Apr 04 10:22:07 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While I was studying the files regarding the GPIO on LPCOpen2.10 I became intrigued with the way the parameter pGPIO works. It seems to be a pointer to a structure and it's described on the briefs of the function's headers as "The base of GPIO peripheral on the chip". &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was expecting that in case you wanted to change the state of a pin on port2 you would used LPC_GPIO2, or in case of port1 LPC_GPIO1. Although, the functions only seem to work when you assign LPC_GPIO as the pGPIO. I found it odd, because when I took a look at #define of LPC_GPIO, it has the base address of GPIO0, and LPC_GPIO1 the base address of GPIO1, and so on...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If want to set the pin P[1]31, with this function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/**
 * @briefSet an individual GPIO output pin to the low state
 * @parampGPIO: The base of GPIO peripheral on the chip
 * @paramport: GPIO Port number where pin is located
 * @parampin: pin number (0..n) to set low
 * @returnNone
 * @noteAny bit set as a '0' will not have it's state changed. This only
 * applies to ports configured as an output.
 */
STATIC INLINE void Chip_GPIO_SetPinOutLow(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The expected code to write would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_GPIO_SetPinOutLow(LPC_GPIO1, 1, 31);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But in fact it only works if you write:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_GPIO_SetPinOutLow(LPC_GPIO, 1, 31);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does it happens?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:15:01 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:15:01Z</dc:date>
    <item>
      <title>Small question about GPIO function</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573570#M18847</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by zepedrowdp on Fri Apr 04 10:22:07 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hey!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;While I was studying the files regarding the GPIO on LPCOpen2.10 I became intrigued with the way the parameter pGPIO works. It seems to be a pointer to a structure and it's described on the briefs of the function's headers as "The base of GPIO peripheral on the chip". &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I was expecting that in case you wanted to change the state of a pin on port2 you would used LPC_GPIO2, or in case of port1 LPC_GPIO1. Although, the functions only seem to work when you assign LPC_GPIO as the pGPIO. I found it odd, because when I took a look at #define of LPC_GPIO, it has the base address of GPIO0, and LPC_GPIO1 the base address of GPIO1, and so on...&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;For example:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If want to set the pin P[1]31, with this function:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
/**
 * @briefSet an individual GPIO output pin to the low state
 * @parampGPIO: The base of GPIO peripheral on the chip
 * @paramport: GPIO Port number where pin is located
 * @parampin: pin number (0..n) to set low
 * @returnNone
 * @noteAny bit set as a '0' will not have it's state changed. This only
 * applies to ports configured as an output.
 */
STATIC INLINE void Chip_GPIO_SetPinOutLow(LPC_GPIO_T *pGPIO, uint8_t port, uint8_t pin)
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The expected code to write would be:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_GPIO_SetPinOutLow(LPC_GPIO1, 1, 31);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But in fact it only works if you write:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;Chip_GPIO_SetPinOutLow(LPC_GPIO, 1, 31);&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Why does it happens?&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:15:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573570#M18847</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:15:01Z</dc:date>
    </item>
    <item>
      <title>Re: Small question about GPIO function</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573571#M18848</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by wellsk on Fri Apr 04 13:03:43 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If you passed in the base of a specific GPIO port peripheral to the GPIO block, you wouldn't need the port number.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All GPIO driver functions use the same API with the same based address (LPC_GPIO) on all platforms. Implementation of those functions varies per platform (ie, some platforms only have 1 GPIO peripheral block that handles multiple ports).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This appears to be an oversight on the lpc17xx platform. The only definition that should be there and should plug into that function should be LPC_GPIO.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_GPIO1, 2, 3, etc. shouldn't exist and will be removed in future packages to prevent any confusion with the GPIO calls....&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:15:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573571#M18848</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:15:02Z</dc:date>
    </item>
    <item>
      <title>Re: Small question about GPIO function</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573572#M18849</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by Walker91 on Mon Jun 30 23:45:54 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hello,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;When you have to manage two interruptions with gpio, how do you proceed to differentiate the register ? &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thank you.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:15:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/Small-question-about-GPIO-function/m-p/573572#M18849</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:15:02Z</dc:date>
    </item>
  </channel>
</rss>

