Smart Knob Controller

Finite State Machine managing SmartKnob behavior and modes. More...

#include <FSM.h>

Public Types

enum class  Mode { Elastic , FreeSpin }
enum class  Function { Translate , Rotate }

Public Member Functions

 FSM (Motor &motor, Encoder &encoder, PID &pid, Hall &hall, UART_HandleTypeDef *huart)
 Constructs the FSM controller.
void run (uint32_t freq)
 Runs the active FSM state at the specified frequency.
void advanceState (bool longPress)
 Advances to the next state depending on button press type.

Detailed Description

Finite State Machine managing SmartKnob behavior and modes.

Constructor & Destructor Documentation

◆ FSM()

FSM::FSM ( Motor & motor,
Encoder & encoder,
PID & pid,
Hall & hall,
UART_HandleTypeDef * huart )

Constructs the FSM controller.

Parameters
motorReference to Motor instance.
encoderReference to Encoder instance.
pidReference to PID controller.
hallReference to Hall effect sensor.
huartUART handle for serial communication.

Member Function Documentation

◆ advanceState()

void FSM::advanceState ( bool longPress)

Advances to the next state depending on button press type.

Parameters
longPressIf true, jumps directly to FreeSpin-Rotate mode.

◆ run()

void FSM::run ( uint32_t freq)

Runs the active FSM state at the specified frequency.

Parameters
freqFrequency to limit execution rate (Hz).

The documentation for this class was generated from the following files:
  • C:/Users/nickl/OneDrive - Cal Poly/POLY4TH/SPRING'25/507/LAB WORKSPACE/SmartKnobController_REV2/Core/DoxCommd/FSM.h
  • C:/Users/nickl/OneDrive - Cal Poly/POLY4TH/SPRING'25/507/LAB WORKSPACE/SmartKnobController_REV2/Core/DoxCommd/FSM.cpp