Speeduino
Loading...
Searching...
No Matches
Public Types | Public Member Functions | Public Attributes | List of all members
Schedule Struct Reference

A schedule for a single output channel. More...

#include <scheduler.h>

Inheritance diagram for Schedule:
Inheritance graph
[legend]

Public Types

using counter_t = decltype(FUEL1_COUNTER)
 The type of a timer counter register (this varies between platforms)
 
using compare_t = decltype(FUEL1_COMPARE)
 The type of a timer compare register (this varies between platforms)
 

Public Member Functions

constexpr Schedule (counter_t &counter, compare_t &compare)
 Construct a new Schedule object.
 

Public Attributes

volatile COMPARE_TYPE duration = 0U
 Scheduled duration (timer ticks)
 
volatile ScheduleStatus Status = OFF
 Schedule status: OFF, PENDING, STAGED, RUNNING.
 
voidVoidCallback pStartCallback = &nullCallback
 Start Callback function for schedule.
 
voidVoidCallback pEndCallback = &nullCallback
 End Callback function for schedule.
 
COMPARE_TYPE nextStartCompare = 0U
 Planned start of next schedule (when current schedule is RUNNING)
 
counter_t_counter
 Reference to the counter register. E.g. TCNT3
 
compare_t_compare
 **Reference**to the compare register. E.g. OCR3A
 

Detailed Description

A schedule for a single output channel.

A schedule consists of 3 independent parts:
  • an action that can be started and stopped. E.g. charge ignition coil or injection pulse
  • a delay until the action is started
  • a duration until the action is stopped

I.e.

<--------------- Delay ---------------><---- Duration ---->
^ ^
static TIntegral readSerialIntegralTimeout(void)
Reads an integral type, timing out if necessary.
Definition comms.cpp:173
Timers are modelled as registers
Once set, Schedule instances are usually driven externally by a timer ISR

Member Typedef Documentation

◆ compare_t

The type of a timer compare register (this varies between platforms)

◆ counter_t

The type of a timer counter register (this varies between platforms)

Constructor & Destructor Documentation

◆ Schedule()

constexpr Schedule::Schedule ( counter_t counter,
compare_t compare 
)
inlineconstexpr

Construct a new Schedule object.

Parameters
counterA reference to the timer counter
compareA reference to the timer comparator

Member Data Documentation

◆ _compare

compare_t& Schedule::_compare

**Reference**to the compare register. E.g. OCR3A

◆ _counter

counter_t& Schedule::_counter

Reference to the counter register. E.g. TCNT3

◆ duration

volatile COMPARE_TYPE Schedule::duration = 0U

Scheduled duration (timer ticks)

This captures the duration of the next interval to be scheduled. I.e.

  • Status==PENDING: this is the duration that will be used when the schedule moves to the RUNNING state
  • Status==RUNNING_WITHNEXT: this is the duration that will be used after the current schedule finishes and the queued up scheduled starts

◆ nextStartCompare

COMPARE_TYPE Schedule::nextStartCompare = 0U

Planned start of next schedule (when current schedule is RUNNING)

◆ pEndCallback

voidVoidCallback Schedule::pEndCallback = &nullCallback

End Callback function for schedule.

◆ pStartCallback

voidVoidCallback Schedule::pStartCallback = &nullCallback

Start Callback function for schedule.

◆ Status

volatile ScheduleStatus Schedule::Status = OFF

Schedule status: OFF, PENDING, STAGED, RUNNING.


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