35type_code_strings = {
'b' :
"int8",
'B' :
"uint8",
36 'h' :
"int16",
'H' :
"uint16",
37 'i' :
"int(?)",
'I' :
"uint(?)",
38 'l' :
"int32",
'L' :
"uint32",
39 'q' :
"int64",
'Q' :
"uint64",
40 'f' :
"float",
'd' :
"double"}
47 gen = (str (item)
for item
in share_list)
48 return '\n'.join (gen)
61 def __init__ (self, type_code, thread_protect = True, name = None):
66 share_list.append (self)
120 def __init__ (self, type_code, size, thread_protect = False,
121 overwrite = False, name = None):
123 super ().__init__ (type_code, thread_protect, name)
127 self.
_name = str (name)
if name !=
None \
128 else 'Queue' + str (Queue.ser_num)
133 self.
_buffer = array.array (type_code, range (size))
168 def put (self, item, in_ISR = False):
182 _irq_state = pyb.disable_irq ()
197 pyb.enable_irq (_irq_state)
218 def get (self, in_ISR = False):
225 irq_state = pyb.disable_irq ()
240 pyb.enable_irq (irq_state)
298 return (
'{:<12s} Queue<{:s}> Max Full {:d}/{:d}'.format (self.
_name,
351 def __init__ (self, type_code, thread_protect = True, name = None):
353 super ().__init__ (type_code, thread_protect, name)
357 self.
_name = str (name)
if name !=
None \
358 else 'Share' + str (Share.ser_num)
371 def put (self, data, in_ISR = False):
375 irq_state = pyb.disable_irq ()
381 pyb.enable_irq (irq_state)
391 def get (self, in_ISR = False):
394 irq_state = pyb.disable_irq ()
400 pyb.enable_irq (irq_state)
409 return (
"{:<12s} Share<{:s}>".format (self.
_name,
Base class for queues and shares which exchange data between tasks.
__init__(self, type_code, thread_protect=True, name=None)
Create a base queue object when called by a child class initializer.
A queue which is used to transfer data from one task to another.
put(self, item, in_ISR=False)
Put an item into the queue.
clear(self)
Remove all contents from the queue.
# Record maximum fillage _max_full
get(self, in_ISR=False)
Read an item from the queue.
full(self)
Check if the queue is full.
__init__(self, type_code, size, thread_protect=False, overwrite=False, name=None)
Initialize a queue object to carry and buffer data between tasks.
__repr__(self)
This method puts diagnostic information about the queue into a string.
any(self)
Check if there are any items in the queue.
num_in(self)
Check how many items are in the queue.
empty(self)
Check if the queue is empty.
An item which holds data to be shared between tasks.
put(self, data, in_ISR=False)
Write an item of data into the share.
__init__(self, type_code, thread_protect=True, name=None)
Create a shared data item used to transfer data between tasks.
get(self, in_ISR=False)
Read an item of data from the share.
__repr__(self)
Puts diagnostic information about the share into a string.
show_all()
Create a string holding a diagnostic printout showing the status of each queue and share in the syste...