Luisa Chiu Portfolio
Lab2_task_encoder.Task_Encoder Class Reference

Encoder task for cooperative multitasking example. More...

Public Member Functions

def __init__ (self, period, enc_pos, z_flag, enc_delta, enc_obj, my_Q)
 Constructs an encoder task. More...
 
def run (self)
 Runs one iteration of the FSM.
 

Public Attributes

 period
 The frequency of the task. More...
 
 enc_pos
 The encoder position that counts total movement. More...
 
 z_flag
 A boolean flag used to reset encoder position to 0. More...
 
 my_Q
 A shares object that represents the queue for holding list items. More...
 
 enc_obj
 The encoder object that calls encoders 1 or 2. More...
 
 enc_delta
 The change in position. More...
 
 state
 Sets initial state to State 1. More...
 
 runs
 Sets the number of runs to 0. More...
 
 next_time
 The utime.ticks_us() value associated with the next run of the FSM. More...
 

Detailed Description

Encoder task for cooperative multitasking example.

Implements a finite state machine that interacts with the encoder driver and task user interface

Constructor & Destructor Documentation

◆ __init__()

def Lab2_task_encoder.Task_Encoder.__init__ (   self,
  period,
  enc_pos,
  z_flag,
  enc_delta,
  enc_obj,
  my_Q 
)

Constructs an encoder task.

The encoder task is implemented as a finite state machine

Parameters
periodThe period, in microseconds, between runs of the task
enc_posThe encoder position that counts total movement
z_flagA boolean flag used to reset encoder position to 0
enc_deltaThe change in time increments in timer count
enc_objThe encoder object that calls encoders 1 or 2
my_QA shares object that represents the queue for holding list items

Member Data Documentation

◆ enc_delta

Lab2_task_encoder.Task_Encoder.enc_delta

The change in position.

The difference between two recorded positions of the encoder

◆ enc_obj

Lab2_task_encoder.Task_Encoder.enc_obj

The encoder object that calls encoders 1 or 2.

Encoders 1 or 2 was defined in the main.py file

◆ enc_pos

Lab2_task_encoder.Task_Encoder.enc_pos

The encoder position that counts total movement.

The total position moved is characterized by the total number of timer counts

◆ my_Q

Lab2_task_encoder.Task_Encoder.my_Q

A shares object that represents the queue for holding list items.

The queue holds the time and position list items.

◆ next_time

Lab2_task_encoder.Task_Encoder.next_time

The utime.ticks_us() value associated with the next run of the FSM.

Defines a variable that adds the period to the ongoing timer

◆ period

Lab2_task_encoder.Task_Encoder.period

The frequency of the task.

Defines variable that specifies timer frequency

◆ runs

Lab2_task_encoder.Task_Encoder.runs

Sets the number of runs to 0.

Defines a variable to keep track of runs

◆ state

Lab2_task_encoder.Task_Encoder.state

Sets initial state to State 1.

FSM starts at State 1, where the update function is called for encoder object

◆ z_flag

Lab2_task_encoder.Task_Encoder.z_flag

A boolean flag used to reset encoder position to 0.

When character "z" is pressed on the keyboard, z-flag will be 'True' and reset encoder position


The documentation for this class was generated from the following file: