|
def | __init__ (self, type_code, thread_protect=True, name=None) |
| Create a shared data item used to transfer data between tasks. More...
|
|
def | put (self, data, in_ISR=False) |
| Write an item of data into the share. More...
|
|
def | get (self, in_ISR=False) |
| Read an item of data from the share. More...
|
|
def | __repr__ (self) |
| Puts diagnostic information about the share into a string. More...
|
|
|
int | ser_num = 0 |
| A counter used to give serial numbers to shares for diagnostic use.
|
|
◆ __init__()
def task_share.Share.__init__ |
( |
|
self, |
|
|
|
type_code, |
|
|
|
thread_protect = True , |
|
|
|
name = None |
|
) |
| |
Create a shared data item used to transfer data between tasks.
This method allocates memory in which the shared data will be buffered.
Each share can only carry data of one particular type which must be
chosen from the following list. The data type is specified by a
one-letter type code which is given as for the Python @c array.array
type, which can be any of the following:
| | | |
|:-----|:-----|:-----|
| **b** (signed char) | **B** (unsigned char) | 8 bit integers |
| **h** (signed short) | **H** (unsigned short) | 16 bit integers |
| **i** (signed int) | **I** (unsigned int) | 32 bit integers (probably) |
| **l** (signed long) | **L** (unsigned long) | 32 bit integers |
| **q** (signed long long) | **Q** (unsigned long long) | 64 bit integers |
| **f** (float) | **d** (double-precision float) | |
@param type_code The type of data items which the share can hold
@param thread_protect True if mutual exclusion protection is used
@param name A short name for the share, default @c ShareN where @c N
is a serial number for the share
Reimplemented from task_share.BaseShare.
◆ __repr__()
def task_share.Share.__repr__ |
( |
|
self | ) |
|
Puts diagnostic information about the share into a string.
Shares are pretty simple, so we just put the name and type.
◆ get()
def task_share.Share.get |
( |
|
self, |
|
|
|
in_ISR = False |
|
) |
| |
Read an item of data from the share.
If thread protection is enabled, interrupts are disabled during the time
that the data is being read so as to prevent data corruption by changes
in the data as it is being read.
@param in_ISR Set this to True if calling from within an ISR
◆ put()
def task_share.Share.put |
( |
|
self, |
|
|
|
data, |
|
|
|
in_ISR = False |
|
) |
| |
Write an item of data into the share.
This method puts data into the share; any old data is overwritten.
This code disables interrupts during the writing so as to prevent
data corrupting by an interrupt service routine which might access
the same data.
@param data The data to be put into this share
@param in_ISR Set this to True if calling from within an ISR
The documentation for this class was generated from the following file: