Skip to content

Commit

Permalink
add an empty constructor
Browse files Browse the repository at this point in the history
  • Loading branch information
edWin-m committed May 4, 2023
1 parent 873fceb commit 5fb84bb
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.pio
.vscode
src/main.cpp
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
When searching for an arduino library to control X9Cxxx family digital potentiometers, found some old 2011 forum post that just does the job. Unfortunately this library was not available under arduino IDE's library manager. So I decided to put it in there.


The original foum post: [click here](https://forum.arduino.cc/t/arduino-library-for-x9c103p-digital-potentiometer/67602)
The original forum post: [click here](https://forum.arduino.cc/t/arduino-library-for-x9c103p-digital-potentiometer/67602)


The original website: [click here](https://sites.google.com/site/tfagerscode/home/digipotx9cxxx)
Expand Down
14 changes: 14 additions & 0 deletions src/DigiPotX9Cxxx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,20 @@
#include "Arduino.h"
#include "DigiPotX9Cxxx.h"

DigiPot::DigiPot() {}

void DigiPot::setup(uint8_t incPin, uint8_t udPin, uint8_t csPin) {
_incPin = incPin;
_udPin = udPin;
_csPin = csPin;
_currentValue = DIGIPOT_UNKNOWN;

pinMode(_incPin, OUTPUT);
pinMode(_udPin, OUTPUT);
pinMode(_csPin, OUTPUT);
digitalWrite(_csPin, HIGH);
}

DigiPot::DigiPot(uint8_t incPin, uint8_t udPin, uint8_t csPin) {
_incPin = incPin;
_udPin = udPin;
Expand Down
2 changes: 2 additions & 0 deletions src/DigiPotX9Cxxx.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@
class DigiPot
{
public:
DigiPot();
DigiPot(uint8_t incPin, uint8_t udPin, uint8_t csPin);
void setup(uint8_t incPin, uint8_t udPin, uint8_t csPin);
void increase(uint8_t amount);
void decrease(uint8_t amount);
void change(uint8_t direction, uint8_t amount);
Expand Down

0 comments on commit 5fb84bb

Please sign in to comment.