From a79711bc79380ee62b782a3eb4a2f1b41266521a Mon Sep 17 00:00:00 2001 From: tryuan99 Date: Sat, 15 Feb 2020 15:49:05 -0800 Subject: [PATCH] Fix LO, PA, DIV supply code --- scm_v3c/scm3c_hw_interface.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/scm_v3c/scm3c_hw_interface.c b/scm_v3c/scm3c_hw_interface.c index 08bece61..ee17a67f 100644 --- a/scm_v3c/scm3c_hw_interface.c +++ b/scm_v3c/scm3c_hw_interface.c @@ -1597,27 +1597,29 @@ void enable_1mhz_ble_ASC() { void disable_1mhz_ble_ASC() { scm3c_hw_interface_vars.ASC[32] |= 0x00060000; } + void set_PA_supply(unsigned int code) { // 7-bit setting (between 0 and 127) // MSB is a "panic" bit that engages the high-voltage settings unsigned int code_ASC = ((~code)&0x0000007F) << 13; scm3c_hw_interface_vars.ASC[30] &= 0xFFF01FFF; scm3c_hw_interface_vars.ASC[30] |= code_ASC; - } + void set_LO_supply(unsigned int code, unsigned char panic) { // 7-bit setting (between 0 and 127) // MSB is a "panic" bit that engages the high-voltage settings unsigned int code_ASC = ((~code)&0x0000007F) << 5; - scm3c_hw_interface_vars.ASC[30] &= 0xFFFFF017; + scm3c_hw_interface_vars.ASC[30] &= 0xFFFFF01F; scm3c_hw_interface_vars.ASC[30] |= code_ASC; } + void set_DIV_supply(unsigned int code, unsigned char panic) { // 7-bit setting (between 0 and 127) // MSB is a "panic" bit that engages the high-voltage settings - unsigned int code_ASC = ((~code)&0x0000007F) << 5; - scm3c_hw_interface_vars.ASC[30] &= 0xFFF01FFF; - scm3c_hw_interface_vars.ASC[30] |= code_ASC; + unsigned int code_ASC = ((~code)&0x0000007F) << 13; + scm3c_hw_interface_vars.ASC[31] &= 0xFFF01FFF; + scm3c_hw_interface_vars.ASC[31] |= code_ASC; } void prescaler(int code) {