<?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>NCS how to close SPI, I2C, ADC,NVS</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/90477/ncs-how-to-close-spi-i2c-adc-nvs</link><description>Hello, 
 nRF5340, NCS1.9.99, VSCode 
 
 
 adc_dev_ = device_get_binding(&amp;quot;ADC_0&amp;quot;); 
 
 i2c_dev = device_get_binding(&amp;quot;I2C_0&amp;quot;); 
 
 spi_dev = device_get_binding(&amp;quot;SPI_3&amp;quot;); 
 
 
 rc = nvs_init(&amp;amp;fs, flash_dev-&amp;gt;name); 
 
 
 
 
 how to close those devices before</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 29 Jul 2022 14:28:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/90477/ncs-how-to-close-spi-i2c-adc-nvs" /><item><title>RE: NCS how to close SPI, I2C, ADC,NVS</title><link>https://devzone.nordicsemi.com/thread/379347?ContentTypeID=1</link><pubDate>Fri, 29 Jul 2022 14:28:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8e9113f0-8c5e-4561-b0fa-75ae3999aadf</guid><dc:creator>Michal</dc:creator><description>&lt;p&gt;Hello,&lt;br /&gt;&lt;br /&gt;You should be able to use the Power Management API for that.&lt;br /&gt;Add add CONFIG_PM_DEVICE=y to your prj.conf and then you can use the following function to suspend and resume the devices.&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;pm_device_action_run(i2c_dev, PM_DEVICE_ACTION_SUSPEND);

pm_device_action_run(i2c_dev, PM_DEVICE_ACTION_RESUME);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;You can read more about it here&lt;br /&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/services/pm/device_runtime.html"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/services/pm/device_runtime.html&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;And here is the API description:&lt;br /&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/services/pm/api/index.html#c.pm_device_action_run"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.0.2/zephyr/services/pm/api/index.html#c.pm_device_action_run&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Michal&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>