ckbot :: ckmodule :: MemInterface :: Class MemInterface
[hide private]
[frames] | no frames]

Class MemInterface

source code


Implementation of the .mem sub-object for modules that provide the generic IO memory interface

Instances of this class are created by the module subclass constructor, for those module software versions that actually implement the interface.

Typical usage, assuming m is a module: >>> m.mem[0xBAD] = 0xC0ED >>> print m.mem[0xDEAD] >>> m.mem[[0xBAD, 0xD00D]] = [0xBE, 0xEF] >>> print m.mem[[0xC0ED, 0xBABE]] >>> m.mem[0xF00] |= (1<<5) # set bit 5 >>> m.mem[0xF00] &= ~(1<<5) # clear bit 5 >>> m.mem[0xF00] ^= (1<<5) # toggle bit 5

If the module also has a .mcu sub-object, it will typically provide the constants needed instead of the literals in the example above.

Instance Methods [hide private]
 
__init__(self, module)
Attach memory sub-object to this module
source code
 
__getitem__(self, key)
Read memory from microcontroller.
source code
 
__setitem__(self, key, val)
Write memory values in microcontroller
source code

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, module)
(Constructor)

source code 

Attach memory sub-object to this module

Overrides: object.__init__

__getitem__(self, key)
(Indexing operator)

source code 

Read memory from microcontroller.

key can either be an integer memory address, or a list of such addresses. When a list is used, returns a list of the results

__setitem__(self, key, val)
(Index assignment operator)

source code 

Write memory values in microcontroller

key can be an address and val a byte value, or key is a list of addresses, and val a sequence of values (i.e. val can also be a tuple, or any other sequence type).