QC2Control
A simple Arduino library to set the voltage of a Quick Charge 2.0 source
QC2Control.h
Go to the documentation of this file.
1 
5 #pragma once
6 
7 #include "Arduino.h"
8 
16 class QC2Control{
17  public:
27  QC2Control(byte DpPin, byte DmPin);
28 
37  void begin();
38 
50  void setVoltage(byte volt);
51 
61  byte getVoltage();
62 
63 
71  void set5V();
72 
80  void set9V();
81 
89  void set12V();
90 
91  protected:
92  const byte _DpPin;
93  const byte _DmPin;
94 
96  byte _setVoltage;
97 
98  static const unsigned int _WaitTime;
99 };
100 
101 inline void QC2Control::set5V(){
102  setVoltage(5);
103 }
104 
105 inline void QC2Control::set9V(){
106  setVoltage(9);
107 }
108 
109 inline void QC2Control::set12V(){
110  setVoltage(12);
111 }
112 
114  return _setVoltage;
115 }
const byte _DmPin
Data- pin.
Definition: QC2Control.h:93
Main class of the QC2Control-library.
Definition: QC2Control.h:16
static const unsigned int _WaitTime
Wait time in the handshake. Should be at least 1,25s.
Definition: QC2Control.h:98
void set5V()
Set voltage to 5V.
Definition: QC2Control.h:101
void begin()
Starts the handshake with the QC2.0 source.
Definition: QC2Control.cpp:14
byte _setVoltage
Current set voltage.
Definition: QC2Control.h:96
void set9V()
Set voltage to 9V.
Definition: QC2Control.h:105
QC2Control(byte DpPin, byte DmPin)
Makes an object to control a Quick Charge 2.0 source.
Definition: QC2Control.cpp:6
void setVoltage(byte volt)
Sets the desired voltage of the QC2.0 source.
Definition: QC2Control.cpp:31
byte getVoltage()
Return the current voltage set.
Definition: QC2Control.h:113
const byte _DpPin
Data+ pin.
Definition: QC2Control.h:92
void set12V()
Set voltage to 12V.
Definition: QC2Control.h:109
bool _handshakeDone
Is the handshake done?
Definition: QC2Control.h:95