def set_pindetect(self, val): val = Utils.to_bool(val) self.msr &= 0xfb self.msr |= 0x04 if not bool(val) else 0x00
def set_uart_passthrough(self, val): val = Utils.to_bool(val) self.msr[1] &= 0xef self.msr[1] |= 0x10 if val else 0x00
def set_uart1_remap(self, val): val = Utils.to_bool(val) self.msr[1] &= 0xbf self.msr[1] |= 0x40 if val else 0x00
def set_ee_erase(self, val): val = Utils.to_bool(val); self.msr[12] &= 0xfd self.msr[12] |= 0x02 if not val else 0x00
def set_uart_passthrough(self, val): val = Utils.to_bool(val) self.msr[2] &= 0xbf self.msr[2] |= 0x40 if val else 0x00
def set_low_voltage_detect(self, val): val = Utils.to_bool(val) self.msr[0] &= 0xbf self.msr[0] |= 0x40 if not val else 0x00
def set_eeprom_lvd(self, val): val = Utils.to_bool(val) self.msr[1] &= 0x7f self.msr[1] |= 0x80 if val else 0x00
def set_reset_pin_enabled(self, val): val = Utils.to_bool(val) self.msr[0] &= 0xfe self.msr[0] |= 0x01 if bool(val) else 0x00
def set_watchdog(self, val): val = Utils.to_bool(val) self.msr &= 0x7f self.msr |= 0x80 if not bool(val) else 0x00
def set_xram(self, val): val = Utils.to_bool(val) self.msr &= 0xbf self.msr |= 0x40 if bool(val) else 0x00
def set_ale(self, val): val = Utils.to_bool(val) self.msr &= 0xdf self.msr |= 0x20 if bool(val) else 0x00
def set_reset_pin_enabled(self, val): val = Utils.to_bool(val) self.msr[2] &= 0xef self.msr[2] |= 0x10 if not bool(val) else 0x00
def set_watchdog(self, val): val = Utils.to_bool(val) self.msr[3] &= 0xdf self.msr[3] |= 0x20 if not val else 0x00
def set_watchdog_idle(self, val): val = Utils.to_bool(val) self.msr[2] &= 0xf7 self.msr[2] |= 0x08 if not val else 0x00
def set_watchdog_idle(self, val): val = Utils.to_bool(val) self.msr[3] &= 0xf7 self.msr[3] |= 0x08 if not val else 0x00
def set_pindetect(self, val): val = Utils.to_bool(val) self.msr[12] &= 0xfe self.msr[12] |= 0x01 if not val else 0x00
def set_lvrs(self, val): val = Utils.to_bool(val) self.msr[2] &= 0xbf self.msr[2] |= 0x40 if not val else 0x00
def test_to_bool(self): """Test special utility function for bool conversion""" self.assertTrue(Utils.to_bool(True)) self.assertTrue(Utils.to_bool("true")) self.assertTrue(Utils.to_bool("True")) self.assertTrue(Utils.to_bool("t")) self.assertTrue(Utils.to_bool("T")) self.assertTrue(Utils.to_bool(1)) self.assertTrue(Utils.to_bool(-1)) self.assertFalse(Utils.to_bool(0)) self.assertFalse(Utils.to_bool(None)) self.assertFalse(Utils.to_bool("false")) self.assertFalse(Utils.to_bool("False")) self.assertFalse(Utils.to_bool("f")) self.assertFalse(Utils.to_bool("F")) self.assertFalse(Utils.to_bool(""))
def set_ee_erase(self, val): val = Utils.to_bool(val) self.msr[0] &= 0xfd self.msr[0] |= 0x02 if val else 0x00
def set_p20_state(self, val): val = Utils.to_bool(val) self.msr[1] &= 0xf7 self.msr[1] |= 0x08 if val else 0x00
def set_pindetect(self, val): val = Utils.to_bool(val) self.msr[0] &= 0xfe self.msr[0] |= 0x01 if not val else 0x00
def set_epwm_pp(self, val): val = Utils.to_bool(val) self.msr[1] &= 0xfb self.msr[1] |= 0x04 if val else 0x00
def set_t6(self, val): val = Utils.to_bool(val) self.msr &= 0xfe self.msr |= 0x01 if not bool(val) else 0x00
def set_ee_erase(self, val): val = Utils.to_bool(val) self.msr &= 0xf7 self.msr |= 0x08 if not bool(val) else 0x00
def set_watchdog(self, val): val = Utils.to_bool(val) self.msr[2] &= 0xdf self.msr[2] |= 0x20 if not val else 0x00
def set_lvrs(self, val): val = Utils.to_bool(val) self.msr[1] &= 0xbf self.msr[1] |= 0x40 if val else 0x00
def set_ee_erase(self, val): val = Utils.to_bool(val) self.msr[12] &= 0xfd self.msr[12] |= 0x02 if not val else 0x00
def set_lvrs(self, val): val = Utils.to_bool(val); self.msr[1] &= 0xbf self.msr[1] |= 0x40 if val else 0x00