Luisa Chiu Portfolio
Lab4_task_encoder.Task_Encoder Class Reference

Encoder task that creates variables for encoder driver functions and parameters. More...

Public Member Functions

def __init__ (self, period, enc_pos, z_flag, enc_delta, encoder_obj)
 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...
 
 encoder_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 that creates variables for encoder driver functions and parameters.

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

Constructor & Destructor Documentation

◆ __init__()

def Lab4_task_encoder.Task_Encoder.__init__ (   self,
  period,
  enc_pos,
  z_flag,
  enc_delta,
  encoder_obj 
)

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
encoder_objThe encoder object that calls encoders 1 or 2

Member Data Documentation

◆ enc_delta

Lab4_task_encoder.Task_Encoder.enc_delta

The change in position.

The difference between two recorded positions of the encoder

◆ enc_pos

Lab4_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

◆ encoder_obj

Lab4_task_encoder.Task_Encoder.encoder_obj

The encoder object that calls encoders 1 or 2.

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

◆ next_time

Lab4_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

Lab4_task_encoder.Task_Encoder.period

The frequency of the task.

Defines variable that specifies timer frequency

◆ runs

Lab4_task_encoder.Task_Encoder.runs

Sets the number of runs to 0.

Defines a variable to keep track of runs

◆ state

Lab4_task_encoder.Task_Encoder.state

Sets initial state to State 1.

Starts timer.

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

An increasing microsecond counter with an arbitrary reference point

◆ z_flag

Lab4_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: