rusEFI
The most advanced open source ECU
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes
SwitchedState Class Reference

#include <efi_output.h>

Collaboration diagram for SwitchedState:
Collaboration graph
[legend]

Public Member Functions

 SwitchedState ()=default
 
 SwitchedState (int8_t *const p_state)
 
bool update (bool newState)
 
uint16_t getCounter () const
 
 operator bool () const
 

Private Attributes

int8_t * state {}
 
uint16_t counter {}
 

Detailed Description

Definition at line 15 of file efi_output.h.

Constructor & Destructor Documentation

◆ SwitchedState() [1/2]

SwitchedState::SwitchedState ( )
default

◆ SwitchedState() [2/2]

SwitchedState::SwitchedState ( int8_t *const  p_state)
inlineexplicit

Definition at line 19 of file efi_output.h.

19: state{ p_state } { }
int8_t * state
Definition efi_output.h:30

Member Function Documentation

◆ getCounter()

uint16_t SwitchedState::getCounter ( ) const

Definition at line 23 of file efi_output.cpp.

23 {
24 return counter;
25}
uint16_t counter
Definition efi_output.h:31

Referenced by sendQcBenchAuxDigitalCounters(), and sendQcBenchButtonCounters().

Here is the caller graph for this function:

◆ operator bool()

SwitchedState::operator bool ( ) const
inlineexplicit

Definition at line 25 of file efi_output.h.

25 {
26 return state != nullptr;
27 }

◆ update()

bool SwitchedState::update ( bool  newState)

Definition at line 9 of file efi_output.cpp.

9 {
10 if (state == nullptr) {
11 return false;
12 }
13
14 if (newState != *state) {
15 *state = newState ? 1 : 0;
16 counter++;
17 return true;
18 }
19
20 return false;
21}

Referenced by pokeAuxDigital(), and Engine::updateSwitchInputs().

Here is the caller graph for this function:

Field Documentation

◆ counter

uint16_t SwitchedState::counter {}
private

Definition at line 31 of file efi_output.h.

31{};

Referenced by getCounter(), and update().

◆ state

int8_t* SwitchedState::state {}
private

Definition at line 30 of file efi_output.h.

30{};

Referenced by operator bool(), and update().


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