<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[Detecting when plugged in VS when charging]]></title><description><![CDATA[<p dir="auto">Hello, please excuse me for all the posts lately. I am trying to figure out how to detect when the device has been unplugged VS when it's plugged in.<br />
Lile</p>
<p dir="auto">If plugged in run xyz<br />
And if disconnected from USB run abc.</p>
<p dir="auto">If it's inside the mcore2.h file I haven't seen it. I'm also legally blind so I very well could, have missed it too.  Thank you giys.</p>
]]></description><link>https://community.m5stack.com/topic/3611/detecting-when-plugged-in-vs-when-charging</link><generator>RSS for Node</generator><lastBuildDate>Thu, 16 Apr 2026 04:14:38 GMT</lastBuildDate><atom:link href="https://community.m5stack.com/topic/3611.rss" rel="self" type="application/rss+xml"/><pubDate>Fri, 01 Oct 2021 14:56:25 GMT</pubDate><ttl>60</ttl><item><title><![CDATA[Reply to Detecting when plugged in VS when charging on Sat, 02 Oct 2021 21:48:29 GMT]]></title><description><![CDATA[<p dir="auto">Awesome! Thank you so much for taking the time to look. I really appriciate it.</p>
]]></description><link>https://community.m5stack.com/post/15046</link><guid isPermaLink="true">https://community.m5stack.com/post/15046</guid><dc:creator><![CDATA[babygirl1248]]></dc:creator><pubDate>Sat, 02 Oct 2021 21:48:29 GMT</pubDate></item><item><title><![CDATA[Reply to Detecting when plugged in VS when charging on Sat, 02 Oct 2021 21:18:48 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/12442">@babygirl1248</a></p>
<p dir="auto">I was wrong. There already is a function to detect whether USB is plugged in or not. Please try:</p>
<pre><code>bool M5.Axp.isACIN();
</code></pre>
<p dir="auto">You can find the function in AXP192.h.</p>
<p dir="auto">Sorry about that.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/15045</link><guid isPermaLink="true">https://community.m5stack.com/post/15045</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sat, 02 Oct 2021 21:18:48 GMT</pubDate></item><item><title><![CDATA[Reply to Detecting when plugged in VS when charging on Sat, 02 Oct 2021 13:07:03 GMT]]></title><description><![CDATA[<p dir="auto">Thank you so much! I will look into this further.</p>
]]></description><link>https://community.m5stack.com/post/15038</link><guid isPermaLink="true">https://community.m5stack.com/post/15038</guid><dc:creator><![CDATA[babygirl1248]]></dc:creator><pubDate>Sat, 02 Oct 2021 13:07:03 GMT</pubDate></item><item><title><![CDATA[Reply to Detecting when plugged in VS when charging on Sat, 02 Oct 2021 07:26:08 GMT]]></title><description><![CDATA[<p dir="auto">Hello <a class="mention plugin-mentions-user plugin-mentions-a" href="https://community.m5stack.com/uid/12442">@babygirl1248</a></p>
<p dir="auto">you didn't overlook it. It's not in M5Core2.h. But I think it could be done.</p>
<p dir="auto">According to the M5Core2 schematic USB power goes into ACIN of the AXP192 IC and with that the AXP192 should be able to detect when USB is connected or disconnected.</p>
<p dir="auto">According to the <a href="https://github.com/m5stack/M5-Schematic/blob/master/Core/AXP192%20Datasheet_v1.1_en_draft_2211.pdf" target="_blank" rel="noopener noreferrer nofollow ugc">AXP192 datasheet</a> this information should be available in the interrupt status register 1 (0x44).</p>
<p dir="auto">You cannot actually use the interrupt since in M5Core2 the interrupt out line of the AXP192 is unused and has not been connected to anything, but you should be able to poll the interrupt status register 1.</p>
<p dir="auto">Thanks<br />
Felix</p>
]]></description><link>https://community.m5stack.com/post/15034</link><guid isPermaLink="true">https://community.m5stack.com/post/15034</guid><dc:creator><![CDATA[felmue]]></dc:creator><pubDate>Sat, 02 Oct 2021 07:26:08 GMT</pubDate></item></channel></rss>