<?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>Accessing device pins from board overlay</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/83779/accessing-device-pins-from-board-overlay</link><description>Hi, I&amp;#39;m trying to write an app to capture images from a camera and was wondering how to monitor changes on specifc defined pins in the board overlay file. For example if(!pclk-gpios){ do something}</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 Jan 2022 11:24:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/83779/accessing-device-pins-from-board-overlay" /><item><title>RE: Accessing device pins from board overlay</title><link>https://devzone.nordicsemi.com/thread/348257?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 11:24:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2fb7032-e68f-424f-849e-77aca5d5614b</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;That function looks like it should be in the driver file. Take a look at zephyr/samples/basic/button, and how the button pin is monitored there. That should be a viable solution.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing device pins from board overlay</title><link>https://devzone.nordicsemi.com/thread/348254?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 11:21:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:908167c3-1b15-4573-9665-e46d007678b9</guid><dc:creator>sir_hugo</dc:creator><description>&lt;p&gt;Should I be using the GPIO API to achieve this?&lt;/p&gt;
&lt;p&gt;&lt;a href="https://docs.zephyrproject.org/latest/reference/peripherals/gpio.html"&gt;docs.zephyrproject.org/.../gpio.html&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing device pins from board overlay</title><link>https://devzone.nordicsemi.com/thread/348246?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 10:54:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b9cef9d4-7e80-4945-994a-a223b15efbeb</guid><dc:creator>sir_hugo</dc:creator><description>&lt;p&gt;Hi, I&amp;#39;m trying to write image acquisition code for the ov7670 camera. The example code I&amp;#39;ve seen for it monitors the vsync and hsync pins of the camera to determine when and&amp;nbsp;frame and row has ended.&lt;pre class="ui-code" data-mode="c_cpp"&gt;void ov7670_readframe(void)
{ 
  // (1) locals;
  uint8_t byte_first, byte_second;
  //uint16_t r,g,b, value;
  //uint16_t this_color;
  
  // (2) resets of globals here;
  num_cols = 0;
  num_rows_read = 0;
  
  // (3) scan a frame and drive LCD display too;
  while (!ST_VSYNC); // wait for the old frame to end 
  while (ST_VSYNC); // wait for a new frame to start  
  while (!ST_VSYNC) { // while VSYNC is low during a whole frame
    while (!ST_VSYNC &amp;amp;&amp;amp; !ST_HREF); // wait for a line to start 
    if (ST_VSYNC) break; // line didn&amp;#39;t start, but frame ended 
    
    num_pixels_on_row = 0;
    while (ST_HREF) { // wait for a row/line to end 
 
      if (num_rows_read &amp;lt; 144) {
        // first byte 
        while (!ST_PCLK); // wait for clock to go high 
        // just grab P1.26,25,24,23  P0.5,4  P0.1,0 
        if (num_pixels_on_row &amp;lt; 176) { // neglect pixels beyond 320 column
          byte_first = // (1) locals;
  uint8_t byte_first, byte_second;
  //uint16_t r,g,b, value;
  //uint16_t this_color;
  
  // (2) resets of globals here;
  num_cols = 0;
  num_rows_read = 0;
  
  // (3) scan a frame and drive LCD display too;
  while (!ST_VSYNC); // wait for the old frame to end 
  while (ST_VSYNC); // wait for a new frame to start  
  while (!ST_VSYNC) { // while VSYNC is low during a whole frame
    while (!ST_VSYNC &amp;amp;&amp;amp; !ST_HREF); // wait for a line to start 
    if (ST_VSYNC) break; // line didn&amp;#39;t start, but frame ended 
    
    num_pixels_on_row = 0;
    while (ST_HREF) { // wait for a row/line to end 
 
      if (num_rows_read &amp;lt; 144) {
        // first byte 
        while (!ST_PCLK); // wait for clock to go high 
        // just grab P1.26,25,24,23  P0.5,4  P0.1,0 
        if (num_pixels_on_row &amp;lt; 176) { // neglect pixels beyond 320 column
          byte_first = 
            ((LPC_GPIO1-&amp;gt;FIOPIN &amp;gt;&amp;gt; 19) &amp;amp; (0x000000F0)) | 
            ((LPC_GPIO0-&amp;gt;FIOPIN &amp;gt;&amp;gt; 2) &amp;amp; (0x0000000C)) |          
            ((LPC_GPIO0-&amp;gt;FIOPIN) &amp;amp; (0x00000003));  
        }
        while (ST_PCLK); // wait for clock to go back low 
        // second byte 
        while (!ST_PCLK); // wait for clock to go high    
        if (num_pixels_on_row &amp;lt; 176) { 
          byte_second = 
            ((LPC_GPIO1-&amp;gt;FIOPIN &amp;gt;&amp;gt; 19) &amp;amp; (0x000000F0)) |
            ((LPC_GPIO0-&amp;gt;FIOPIN &amp;gt;&amp;gt; 2) &amp;amp; (0x0000000C)) |          
            ((LPC_GPIO0-&amp;gt;FIOPIN) &amp;amp; (0x00000003));

          //value = (byte_first &amp;lt;&amp;lt; 8) | byte_second;    
          //r = (value &amp;amp; 0xF800);
          //g = (value &amp;amp; 0x07E0);
          //b = (value &amp;amp; 0x001F);   
          //this_color = r|g|b;           
          //LCD_SetPoint(num_rows_read, num_pixels_on_row, this_color);
          LCD_SetPoint(num_rows_read, num_pixels_on_row, ((byte_first &amp;lt;&amp;lt; 8) | byte_second));                   
        }       
        while (ST_PCLK); // wait for clock to go back low 
        num_pixels_on_row ++;       
      } 
      else {
        while (!ST_PCLK); // wait for clock to go high 
        while (ST_PCLK); // wait for clock to go back low 
        while (!ST_PCLK); // wait for clock to go high      
        while (ST_PCLK); // wait for clock to go back low 
        num_pixels_on_row ++;      
      }
       
    } // wait for a row/line to end    
    num_rows_read ++;
    if (num_rows_read == 1) num_cols = num_pixels_on_row;
  }
            ((LPC_GPIO1-&amp;gt;FIOPIN &amp;gt;&amp;gt; 19) &amp;amp; (0x000000F0)) | 
            ((LPC_GPIO0-&amp;gt;FIOPIN &amp;gt;&amp;gt; 2) &amp;amp; (0x0000000C)) |          
            ((LPC_GPIO0-&amp;gt;FIOPIN) &amp;amp; (0x00000003));  
        }
        while (ST_PCLK); // wait for clock to go back low 
        // second byte 
        while (!ST_PCLK); // wait for clock to go high    
        if (num_pixels_on_row &amp;lt; 176) { 
          byte_second = 
            ((LPC_GPIO1-&amp;gt;FIOPIN &amp;gt;&amp;gt; 19) &amp;amp; (0x000000F0)) |
            ((LPC_GPIO0-&amp;gt;FIOPIN &amp;gt;&amp;gt; 2) &amp;amp; (0x0000000C)) |          
            ((LPC_GPIO0-&amp;gt;FIOPIN) &amp;amp; (0x00000003));

          //value = (byte_first &amp;lt;&amp;lt; 8) | byte_second;    
          //r = (value &amp;amp; 0xF800);
          //g = (value &amp;amp; 0x07E0);
          //b = (value &amp;amp; 0x001F);   
          //this_color = r|g|b;           
          //LCD_SetPoint(num_rows_read, num_pixels_on_row, this_color);
          LCD_SetPoint(num_rows_read, num_pixels_on_row, ((byte_first &amp;lt;&amp;lt; 8) | byte_second));                   
        }       
        while (ST_PCLK); // wait for clock to go back low 
        num_pixels_on_row ++;       
      } 
      else {
        while (!ST_PCLK); // wait for clock to go high 
        while (ST_PCLK); // wait for clock to go back low 
        while (!ST_PCLK); // wait for clock to go high      
        while (ST_PCLK); // wait for clock to go back low 
        num_pixels_on_row ++;      
      }
       
    } // wait for a row/line to end    
    num_rows_read ++;
    if (num_rows_read == 1) num_cols = num_pixels_on_row;
  }
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Accessing device pins from board overlay</title><link>https://devzone.nordicsemi.com/thread/348244?ContentTypeID=1</link><pubDate>Tue, 18 Jan 2022 10:49:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:639dcb4d-45e6-420f-a24f-e3a2549eec1d</guid><dc:creator>&amp;#216;ivind</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;That is not possible, the devicetree is a data structure used for hardware description, you can&amp;#39;t execute code in it. You can read about how the devicetree functions here: &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/intro.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/guides/dts/intro.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;But what are you trying to achieve? I will try to help you accomplish it another way.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>