<p></p>
<p><b>@benpicco</b> commented on this pull request.</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/13991#discussion_r418522468">cpu/cc26x2_cc13x2/aux.c</a>:</p>
<pre style='color:#555'>> + * @{
+ */
+#define OPMODE_PDA_ORDER  (0)
+#define OPMODE_A_ORDER    (1)
+#define OPMODE_LP_ORDER   (2)
+#define OPMODE_PDLP_ORDER (3)
+/** @} */
+
+/** Array to map an operation mode to it's order when changing it */
+static const uint8_t _opmode_to_order[4] = {
+    OPMODE_A_ORDER,
+    OPMODE_LP_ORDER,
+    OPMODE_PDA_ORDER,
+    OPMODE_PDLP_ORDER
+};
+/** Array to map an order to an operation mode, used to get the next operation
</pre>
⬇️ Suggested change
<pre style="color: #555">-/** Array to map an order to an operation mode, used to get the next operation
+
+/** Array to map an order to an operation mode, used to get the next operation
</pre>


<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/13991#discussion_r418522935">cpu/cc26x2_cc13x2/include/cc26x2_cc13x2_prcm.h</a>:</p>
<pre style='color:#555'>> +#define OSC_SRC_CLK_HF       0x00000001
+#define OSC_SRC_CLK_LF       0x00000004
</pre>
<p>A comment about what these are doesn't hurt <g-emoji class="g-emoji" alias="wink" fallback-src="https://github.githubassets.com/images/icons/emoji/unicode/1f609.png">😉</g-emoji></p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/13991#discussion_r418523641">cpu/cc26x2_cc13x2/include/cc26x2_cc13x2_prcm.h</a>:</p>
<pre style='color:#555'>> + * If a request to switch the HF clock source has been made, this function can
+ * be used to check if the clock source is ready to be switched.
</pre>
<p>How would such a request look like?</p>

<hr>

<p>In <a href="https://github.com/RIOT-OS/RIOT/pull/13991#discussion_r418524056">cpu/cc26x2_cc13x2/osc.c</a>:</p>
<pre style='color:#555'>> +    if (DDI_0_OSC->STAT0 & DDI_0_OSC_STAT0_PENDINGSCLKHFSWITCHING) {
+        return true;
+    }
+    return false;
+}
+
+void osc_hf_source_switch(void)
+{
+    /* Read SCLK_HF target clock */
+    uint32_t hf_src = DDI_0_OSC->CTL0 & DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_m;
+
+    /* If target clock source is RCOSC, change clock source for DCDC to RCOSC */
+    if (hf_src == DDI_0_OSC_CTL0_SCLK_HF_SRC_SEL_RCOSC) {
+        /* Force DCDC to use RCOSC before switching SCLK_HF to RCOSC */
+        uint32_t mask = DDI_0_OSC_CTL0_CLK_DCDC_SRC_SEL_m;
+        uint32_t data = (DDI_0_OSC_CTL0_CLK_DCDC_SRC_SEL_m >> 16);
</pre>
⬇️ Suggested change
<pre style="color: #555">-        uint32_t data = (DDI_0_OSC_CTL0_CLK_DCDC_SRC_SEL_m >> 16);
+        uint32_t data = DDI_0_OSC_CTL0_CLK_DCDC_SRC_SEL_m >> 16;
</pre>

<p>Makes it easier to compare with the line above.</p>

<p style="font-size:small;-webkit-text-size-adjust:none;color:#666;">—<br />You are receiving this because you are subscribed to this thread.<br />Reply to this email directly, <a href="https://github.com/RIOT-OS/RIOT/pull/13991#pullrequestreview-404137328">view it on GitHub</a>, or <a href="https://github.com/notifications/unsubscribe-auth/ABE7WYFSGEDBMH2FNTOTVTTRPK7IJANCNFSM4MVX4SCQ">unsubscribe</a>.<img src="https://github.com/notifications/beacon/ABE7WYGUZAUX6WC3ETYLHDTRPK7IJA5CNFSM4MVX4SC2YY3PNVWWK3TUL52HS4DFWFIHK3DMKJSXC5LFON2FEZLWNFSXPKTDN5WW2ZLOORPWSZGODALKK4A.gif" height="1" width="1" alt="" /></p>
<script type="application/ld+json">[
{
"@context": "http://schema.org",
"@type": "EmailMessage",
"potentialAction": {
"@type": "ViewAction",
"target": "https://github.com/RIOT-OS/RIOT/pull/13991#pullrequestreview-404137328",
"url": "https://github.com/RIOT-OS/RIOT/pull/13991#pullrequestreview-404137328",
"name": "View Pull Request"
},
"description": "View this Pull Request on GitHub",
"publisher": {
"@type": "Organization",
"name": "GitHub",
"url": "https://github.com"
}
}
]</script>