Skip to content

Commit

Permalink
Annoying pullup struct rename from EXTERN/INTERN to USE_EXTERN/USE_IN…
Browse files Browse the repository at this point in the history
…TERN
  • Loading branch information
askuric committed May 13, 2021
1 parent 3fde38d commit a4f9999
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Therefore this is an attempt to:
> - issue #76: esp32 division by zero
> - issue #46: commander end of line character - by @maxlem
> - [community fix](https://community.simplefoc.com/t/as5600-dead-spot-around-0/208) AS5600 register value
> - renamed `Pullup::EXTERN` and `Pullup::INTERN` to `Pullup::EXTERNAL` and `Pullup::INTERNAL`
> - renamed `Pullup::EXTERN` and `Pullup::INTERN` to `Pullup::USE_EXTERN` and `Pullup::USE_INTERN`
## Arduino *SimpleFOClibrary* v2.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ void setup() {
encoder.quadrature = Quadrature::ON;

// check if you need internal pullups
encoder.pullup = Pullup::EXTERN;
encoder.pullup = Pullup::USE_EXTERN;

// initialise encoder hardware
encoder.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ void setup() {
encoder.quadrature = Quadrature::ON;

// check if you need internal pullups
encoder.pullup = Pullup::EXTERN;
encoder.pullup = Pullup::USE_EXTERN;

// initialise encoder hardware
encoder.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ void setup() {
Serial.begin(115200);

// check if you need internal pullups
sensor.pullup = Pullup::EXTERN;
sensor.pullup = Pullup::USE_EXTERN;

// initialise encoder hardware
sensor.init();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ void setup() {
Serial.begin(115200);

// check if you need internal pullups
sensor.pullup = Pullup::EXTERN;
sensor.pullup = Pullup::USE_EXTERN;

// initialise encoder hardware
sensor.init();
Expand Down
4 changes: 2 additions & 2 deletions keywords.txt
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,8 @@ pinB KEYWORD2
pinC KEYWORD2
index_pin KEYWORD2

INTERNAL KEYWORD2
EXTERNAL KEYWORD2
USE_INTERN KEYWORD2
USE_EXTERN KEYWORD2
DISABLE KEYWORD2
ENABLE KEYWORD2
SpaceVectorPWM KEYWORD2
Expand Down
4 changes: 2 additions & 2 deletions src/common/base_classes/Sensor.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ enum Direction{
* Pullup configuration structure
*/
enum Pullup{
INTERNAL, //!< Use internal pullups
EXTERNAL //!< Use external pullups
USE_INTERN, //!< Use internal pullups
USE_EXTERN //!< Use external pullups
};

/**
Expand Down
4 changes: 2 additions & 2 deletions src/sensors/Encoder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Encoder::Encoder(int _encA, int _encB , float _ppr, int _index){
prev_timestamp_us = _micros();

// extern pullup as default
pullup = Pullup::EXTERNAL;
pullup = Pullup::USE_EXTERN;
// enable quadrature encoder by default
quadrature = Quadrature::ON;
}
Expand Down Expand Up @@ -160,7 +160,7 @@ int Encoder::hasIndex(){
void Encoder::init(){

// Encoder - check if pullup needed for your encoder
if(pullup == Pullup::INTERNAL){
if(pullup == Pullup::USE_INTERN){
pinMode(pinA, INPUT_PULLUP);
pinMode(pinB, INPUT_PULLUP);
if(hasIndex()) pinMode(index_pin,INPUT_PULLUP);
Expand Down
4 changes: 2 additions & 2 deletions src/sensors/HallSensor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ HallSensor::HallSensor(int _hallA, int _hallB, int _hallC, int _pp){
cpr = _pp * 6;

// extern pullup as default
pullup = Pullup::EXTERNAL;
pullup = Pullup::USE_EXTERN;
}

// HallSensor interrupt callback functions
Expand Down Expand Up @@ -119,7 +119,7 @@ void HallSensor::init(){
electric_rotations = 0;

// HallSensor - check if pullup needed for your HallSensor
if(pullup == Pullup::INTERNAL){
if(pullup == Pullup::USE_INTERN){
pinMode(pinA, INPUT_PULLUP);
pinMode(pinB, INPUT_PULLUP);
pinMode(pinC, INPUT_PULLUP);
Expand Down
2 changes: 1 addition & 1 deletion src/sensors/MagneticSensorAnalog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ MagneticSensorAnalog::MagneticSensorAnalog(uint8_t _pinAnalog, int _min_raw_coun
min_raw_count = _min_raw_count;
max_raw_count = _max_raw_count;

if(pullup == Pullup::INTERNAL){
if(pullup == Pullup::USE_INTERN){
pinMode(pinAnalog, INPUT_PULLUP);
}else{
pinMode(pinAnalog, INPUT);
Expand Down

0 comments on commit a4f9999

Please sign in to comment.