Esempio n. 1
0
 def set_pindetect(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xfb
     self.msr |= 0x04 if not bool(val) else 0x00
Esempio n. 2
0
 def set_uart_passthrough(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xef
     self.msr[1] |= 0x10 if val else 0x00
Esempio n. 3
0
 def set_uart1_remap(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xbf
     self.msr[1] |= 0x40 if val else 0x00
Esempio n. 4
0
 def set_ee_erase(self, val):
     val = Utils.to_bool(val);
     self.msr[12] &= 0xfd
     self.msr[12] |= 0x02 if not val else 0x00
Esempio n. 5
0
 def set_uart_passthrough(self, val):
     val = Utils.to_bool(val)
     self.msr[2] &= 0xbf
     self.msr[2] |= 0x40 if val else 0x00
Esempio n. 6
0
 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
Esempio n. 7
0
 def set_eeprom_lvd(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0x7f
     self.msr[1] |= 0x80 if val else 0x00
Esempio n. 8
0
 def set_eeprom_lvd(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0x7f
     self.msr[1] |= 0x80 if val else 0x00
Esempio n. 9
0
 def set_uart_passthrough(self, val):
     val = Utils.to_bool(val)
     self.msr[2] &= 0xbf
     self.msr[2] |= 0x40 if val else 0x00
Esempio n. 10
0
 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
Esempio n. 11
0
 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
Esempio n. 12
0
 def set_watchdog(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0x7f
     self.msr |= 0x80 if not bool(val) else 0x00
Esempio n. 13
0
 def set_xram(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xbf
     self.msr |= 0x40 if bool(val) else 0x00
Esempio n. 14
0
 def set_ale(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xdf
     self.msr |= 0x20 if bool(val) else 0x00
Esempio n. 15
0
 def set_ale(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xdf
     self.msr |= 0x20 if bool(val) else 0x00
Esempio n. 16
0
 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
Esempio n. 17
0
 def set_watchdog(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0x7f
     self.msr |= 0x80 if not bool(val) else 0x00
Esempio n. 18
0
 def set_watchdog(self, val):
     val = Utils.to_bool(val)
     self.msr[3] &= 0xdf
     self.msr[3] |= 0x20 if not val else 0x00
Esempio n. 19
0
 def set_watchdog_idle(self, val):
     val = Utils.to_bool(val)
     self.msr[2] &= 0xf7
     self.msr[2] |= 0x08 if not val else 0x00
Esempio n. 20
0
 def set_watchdog_idle(self, val):
     val = Utils.to_bool(val)
     self.msr[3] &= 0xf7
     self.msr[3] |= 0x08 if not val else 0x00
Esempio n. 21
0
 def set_pindetect(self, val):
     val = Utils.to_bool(val)
     self.msr[12] &= 0xfe
     self.msr[12] |= 0x01 if not val else 0x00
Esempio n. 22
0
 def set_lvrs(self, val):
     val = Utils.to_bool(val)
     self.msr[2] &= 0xbf
     self.msr[2] |= 0x40 if not val else 0x00
Esempio n. 23
0
 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(""))
Esempio n. 24
0
 def set_ee_erase(self, val):
     val = Utils.to_bool(val)
     self.msr[0] &= 0xfd
     self.msr[0] |= 0x02 if val else 0x00
Esempio n. 25
0
 def set_p20_state(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xf7
     self.msr[1] |= 0x08 if val else 0x00
Esempio n. 26
0
 def set_pindetect(self, val):
     val = Utils.to_bool(val)
     self.msr[0] &= 0xfe
     self.msr[0] |= 0x01 if not val else 0x00
Esempio n. 27
0
 def set_epwm_pp(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xfb
     self.msr[1] |= 0x04 if val else 0x00
Esempio n. 28
0
 def set_p20_state(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xf7
     self.msr[1] |= 0x08 if val else 0x00
Esempio n. 29
0
 def set_t6(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xfe
     self.msr |= 0x01 if not bool(val) else 0x00
Esempio n. 30
0
 def set_uart_passthrough(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xef
     self.msr[1] |= 0x10 if val else 0x00
Esempio n. 31
0
 def set_ee_erase(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xf7
     self.msr |= 0x08 if not bool(val) else 0x00
Esempio n. 32
0
 def set_epwm_pp(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xfb
     self.msr[1] |= 0x04 if val else 0x00
Esempio n. 33
0
 def set_xram(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xbf
     self.msr |= 0x40 if bool(val) else 0x00
Esempio n. 34
0
 def set_uart1_remap(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xbf
     self.msr[1] |= 0x40 if val else 0x00
Esempio n. 35
0
 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
Esempio n. 36
0
 def set_t6(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xfe
     self.msr |= 0x01 if not bool(val) else 0x00
Esempio n. 37
0
 def set_watchdog(self, val):
     val = Utils.to_bool(val)
     self.msr[2] &= 0xdf
     self.msr[2] |= 0x20 if not val else 0x00
Esempio n. 38
0
 def set_pindetect(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xfb
     self.msr |= 0x04 if not bool(val) else 0x00
Esempio n. 39
0
 def set_lvrs(self, val):
     val = Utils.to_bool(val)
     self.msr[1] &= 0xbf
     self.msr[1] |= 0x40 if val else 0x00
Esempio n. 40
0
 def set_ee_erase(self, val):
     val = Utils.to_bool(val)
     self.msr &= 0xf7
     self.msr |= 0x08 if not bool(val) else 0x00
Esempio n. 41
0
 def set_ee_erase(self, val):
     val = Utils.to_bool(val)
     self.msr[12] &= 0xfd
     self.msr[12] |= 0x02 if not val else 0x00
Esempio n. 42
0
 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(""))
Esempio n. 43
0
 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
Esempio n. 44
0
 def set_lvrs(self, val):
     val = Utils.to_bool(val);
     self.msr[1] &= 0xbf
     self.msr[1] |= 0x40 if val else 0x00