本文整理汇总了Python中array.array.pop方法的典型用法代码示例。如果您正苦于以下问题:Python array.pop方法的具体用法?Python array.pop怎么用?Python array.pop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类array.array
的用法示例。
在下文中一共展示了array.pop方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: write
# 需要导入模块: from array import array [as 别名]
# 或者: from array.array import pop [as 别名]
def write(self, address, data):
"""SST25 uses a very specific implementation to write data. It offers
very poor performances, because the device lacks an internal buffer
which translates into an ultra-heavy load on SPI bus. However, the
device offers lightning-speed for flash data erasure"""
if address+len(data) > len(self):
raise SerialFlashValueError('Cannot fit in flash area')
if not isinstance(data, Array):
data = Array('B', data)
length = len(data)
if (address&0x1) or (length&0x1) or (length==0):
raise AssertionError("Alignement/size not supported")
self._unprotect()
self._enable_write()
aai_cmd = Array('B', [Sst25FlashDevice.CMD_PROGRAM_WORD,
(address>>16)&0xff,
(address>>8)&0xff,
address&0xff,
data.pop(0), data.pop(0)])
offset = 0
percent = 0.0
while True:
percent = (1000.0*offset/length)
offset += 2
self._spi.exchange(aai_cmd)
while self.is_busy():
time.sleep(0.01) # 10 ms
if not data:
break
aai_cmd = Array('B', [Sst25FlashDevice.CMD_PROGRAM_WORD,
data.pop(0), data.pop(0)])
self._disable_write()