<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>PCA10056 Board Definition</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75463/pca10056-board-definition</link><description>Hi, 
 
 I&amp;#39;m using nrf52840 and trying to define the pin mappings for my custom board. In order to do this I&amp;#39;m studying the board definition of pca10056 (pca10056.h). 
 
 In that file I saw some definitions are mapped to single pin number, for example</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 25 May 2021 12:03:27 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75463/pca10056-board-definition" /><item><title>RE: PCA10056 Board Definition</title><link>https://devzone.nordicsemi.com/thread/311438?ContentTypeID=1</link><pubDate>Tue, 25 May 2021 12:03:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:df89ed92-d2dc-4437-be6b-6b5b66141fc5</guid><dc:creator>J&amp;#248;rgen Holmefjord</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;NRF_GPIO_PIN_MAP() is a utility-macro that can be used to define the correct pin numbers. You are not forced to use this, but it will likely make the code more readable. When a GPIO is assigned to a &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/uarte.html#register.PSEL.TXD"&gt;peripheral pin&lt;/a&gt;, pins on port 1 are given by setting bit 5 of the register. This is equal to adding 32 to the pin number, i.e. P1.13 would be 32+13=45. The output from the&amp;nbsp;&lt;span&gt;NRF_GPIO_PIN_MAP() macro would be the same.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;It can be used for pins on both port 0 and port 1. The port argument (0 or 1) is simply left-shifted 5 places.&lt;/span&gt;&lt;/li&gt;
&lt;li&gt;&lt;span&gt;As mentioned before, it is not strictly necessary, but it increases readability of the code. It may also help for future maintenance/compatibility to be consistent with use of macros like this.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;&lt;span&gt;Best regards,&lt;br /&gt;Jørgen&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>