def test_register_invalid_val(): reg = RegsRegister(TEST_REG_NAME, TEST_REG_OFFSET, TEST_REG_WIDTH, TEST_REG_DESCR, TEST_REG_REV, TEST_REG_ACCESS) reg.set_value("Invalid") assert reg.get_value() == b'' reg.set_value([1, 2]) assert reg.get_value() == b''
def test_register_invalid_val(): """Invalid value register test.""" reg = RegsRegister( TEST_REG_NAME, TEST_REG_OFFSET, TEST_REG_WIDTH, TEST_REG_DESCR, TEST_REG_REV, TEST_REG_ACCESS, ) val = reg.get_value() with pytest.raises(SPSDKError): reg.set_value("Invalid") assert reg.get_value() == val with pytest.raises(SPSDKError): reg.set_value([1, 2]) assert reg.get_value() == val
def reload_register(self, reg: RegsRegister) -> None: """Reload the value in requested register. :param reg: The register to reload from the HW. """ reg.set_value(self.get_register(reg.name))