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

#include <buttonshift.h>

Inheritance diagram for ButtonShiftController:
Inheritance graph
[legend]
Collaboration diagram for ButtonShiftController:
Collaboration graph
[legend]

Public Member Functions

 ButtonShiftController ()
 
void update ()
 
void init ()
 
GearControllerMode getMode () const
 
- Public Member Functions inherited from GearControllerBase
virtual gear_e getDesiredGear () const
 

Private Attributes

ButtonDebounce debounceUp
 
ButtonDebounce debounceDown
 

Additional Inherited Members

- Data Fields inherited from GearControllerBase
TransmissionControllerBasetransmissionController
 
- Protected Member Functions inherited from GearControllerBase
virtual gear_e setDesiredGear (gear_e)
 
void initTransmissionController ()
 
floatgetRangeStateArray (int)
 

Detailed Description

Definition at line 14 of file buttonshift.h.

Constructor & Destructor Documentation

◆ ButtonShiftController()

ButtonShiftController::ButtonShiftController ( )

Definition at line 16 of file buttonshift.cpp.

16 :
17 debounceUp("gear_up"),
18 debounceDown("gear_down")
19 {
20
21}
ButtonDebounce debounceDown
Definition buttonshift.h:25
ButtonDebounce debounceUp
Definition buttonshift.h:24

Member Function Documentation

◆ getMode()

GearControllerMode ButtonShiftController::getMode ( ) const
inlinevirtual

Reimplemented from GearControllerBase.

Definition at line 20 of file buttonshift.h.

◆ init()

void ButtonShiftController::init ( )
virtual

Reimplemented from GearControllerBase.

Definition at line 23 of file buttonshift.cpp.

23 {
24 // 500 millisecond is maybe a little long?
27
29}
void init(efitimems_t threshold, brain_pin_e &pin, pin_input_mode_e &mode, bool inverted=false)
Definition debounce.cpp:23
virtual void init()
static constexpr engine_configuration_s * engineConfiguration
Here is the call graph for this function:

◆ update()

void ButtonShiftController::update ( )
virtual

Reimplemented from GearControllerBase.

Definition at line 31 of file buttonshift.cpp.

31 {
32 bool upPinState = false;
33 bool downPinState = false;
34 // Read pins
35 upPinState = debounceUp.readPinEvent();
36 downPinState = debounceDown.readPinEvent();
37 gear_e gear = getDesiredGear();
38 // Select new gear based on current desired gear.
39 if (upPinState) {
40 switch (gear) {
41 case REVERSE:
43 break;
44 case NEUTRAL:
46 break;
47 case GEAR_1:
49 break;
50 case GEAR_2:
52 break;
53 case GEAR_3:
55 break;
56 default:
57 break;
58 }
59 } else if (downPinState) {
60 switch (gear) {
61 case NEUTRAL:
63 break;
64 case GEAR_1:
66 break;
67 case GEAR_2:
69 break;
70 case GEAR_3:
72 break;
73 case GEAR_4:
75 break;
76 default:
77 break;
78 }
79 }
80
82}
bool readPinEvent()
virtual void update()
virtual gear_e getDesiredGear() const
virtual gear_e setDesiredGear(gear_e)
gear_e
@ GEAR_2
@ REVERSE
@ GEAR_1
@ GEAR_4
@ NEUTRAL
@ GEAR_3
Here is the call graph for this function:

Field Documentation

◆ debounceDown

ButtonDebounce ButtonShiftController::debounceDown
private

Definition at line 25 of file buttonshift.h.

Referenced by init(), and update().

◆ debounceUp

ButtonDebounce ButtonShiftController::debounceUp
private

Definition at line 24 of file buttonshift.h.

Referenced by init(), and update().


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