<p>laforge would like tsaitgaist to <strong>review</strong> this change.</p><p><a href="https://gerrit.osmocom.org/c/simtrace2/+/23616">View Change</a></p><pre style="font-family: monospace,monospace; white-space: pre-wrap;">different voltage comparison on powerup<br><br>Change-Id: I71b703162219484e43638f1f2f692e9dd554ef55<br>---<br>M firmware/libcommon/source/mode_cardemu.c<br>1 file changed, 8 insertions(+), 2 deletions(-)<br><br></pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;">git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/16/23616/1</pre><pre style="font-family: monospace,monospace; white-space: pre-wrap;"><span>diff --git a/firmware/libcommon/source/mode_cardemu.c b/firmware/libcommon/source/mode_cardemu.c</span><br><span>index 7a37317..1dbd2d3 100644</span><br><span>--- a/firmware/libcommon/source/mode_cardemu.c</span><br><span>+++ b/firmware/libcommon/source/mode_cardemu.c</span><br><span>@@ -62,6 +62,7 @@</span><br><span>      const Pin pin_insert;</span><br><span> #ifdef DETECT_VCC_BY_ADC</span><br><span>    uint32_t vcc_uv;</span><br><span style="color: hsl(120, 100%, 40%);">+      uint32_t vcc_uv_last;</span><br><span> #endif</span><br><span>      bool vcc_active;</span><br><span>     bool vcc_active_last;</span><br><span>@@ -197,6 +198,7 @@</span><br><span> /* FIXME: integrate this with actual irq handler */</span><br><span> static void usart_irq_rx(uint8_t inst_num)</span><br><span> {</span><br><span style="color: hsl(120, 100%, 40%);">+ OSMO_ASSERT(inst_num < ARRAY_SIZE(cardem_inst));</span><br><span>  Usart *usart = get_usart_by_chan(inst_num);</span><br><span>  struct cardem_inst *ci = &cardem_inst[inst_num];</span><br><span>         uint32_t csr;</span><br><span>@@ -319,10 +321,14 @@</span><br><span> </span><br><span> static void process_vcc_adc(struct cardem_inst *ci)</span><br><span> {</span><br><span style="color: hsl(0, 100%, 40%);">-   if (ci->vcc_uv >= VCC_UV_THRESH_3V)</span><br><span style="color: hsl(120, 100%, 40%);">+     if (ci->vcc_uv >= VCC_UV_THRESH_3V &&</span><br><span style="color: hsl(120, 100%, 40%);">+       ci->vcc_uv_last < VCC_UV_THRESH_3V) {</span><br><span>              ci->vcc_active = true;</span><br><span style="color: hsl(0, 100%, 40%);">-       else</span><br><span style="color: hsl(120, 100%, 40%);">+  } else if (ci->vcc_uv < VCC_UV_THRESH_3V &&</span><br><span style="color: hsl(120, 100%, 40%);">+              ci->vcc_uv_last >= VCC_UV_THRESH_3V) {</span><br><span>                ci->vcc_active = false;</span><br><span style="color: hsl(120, 100%, 40%);">+    }</span><br><span style="color: hsl(120, 100%, 40%);">+     ci->vcc_uv_last = ci->vcc_uv;</span><br><span> }</span><br><span> </span><br><span> void ADC_IrqHandler(void)</span><br><span></span><br></pre><p>To view, visit <a href="https://gerrit.osmocom.org/c/simtrace2/+/23616">change 23616</a>. To unsubscribe, or for help writing mail filters, visit <a href="https://gerrit.osmocom.org/settings">settings</a>.</p><div itemscope itemtype="http://schema.org/EmailMessage"><div itemscope itemprop="action" itemtype="http://schema.org/ViewAction"><link itemprop="url" href="https://gerrit.osmocom.org/c/simtrace2/+/23616"/><meta itemprop="name" content="View Change"/></div></div>

<div style="display:none"> Gerrit-Project: simtrace2 </div>
<div style="display:none"> Gerrit-Branch: master </div>
<div style="display:none"> Gerrit-Change-Id: I71b703162219484e43638f1f2f692e9dd554ef55 </div>
<div style="display:none"> Gerrit-Change-Number: 23616 </div>
<div style="display:none"> Gerrit-PatchSet: 1 </div>
<div style="display:none"> Gerrit-Owner: laforge <laforge@osmocom.org> </div>
<div style="display:none"> Gerrit-Reviewer: tsaitgaist <kredon@sysmocom.de> </div>
<div style="display:none"> Gerrit-MessageType: newchange </div>