Skip to content

Commit

Permalink
Fixing inconsistent indentation
Browse files Browse the repository at this point in the history
Adding a .editorconfig file, too
  • Loading branch information
MaffooClock committed Oct 31, 2023
1 parent 3ab061f commit ff4bfdb
Show file tree
Hide file tree
Showing 7 changed files with 596 additions and 575 deletions.
20 changes: 20 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
root = true

[*]
charset = utf-8
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true


[*.{h,cpp,json,yml,yaml}]
indent_style = space
indent_size = 2

[*.ino]
indent_style = tab
indent_size = 4

[*.{md,txt}]
indent_style = space
indent_size = 4
38 changes: 19 additions & 19 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,42 +73,42 @@ RotaryEncoder rotaryEncoder( DI_ENCODER_A, DI_ENCODER_B, DI_ENCODER_SW, DO_ENCOD

void knobCallback( int value )
{
Serial.printf( PSTR("Value: %i\n"), value );
Serial.printf( PSTR("Value: %i\n"), value );
}

void buttonCallback()
{
Serial.println( PSTR("boop!") );
Serial.println( PSTR("boop!") );
}

void setup()
{
Serial.begin( 115200 );
Serial.begin( 115200 );

// This tells the library that the encoder has its own pull-up resistors
rotaryEncoder.setEncoderType( EncoderType::HAS_PULLUP );
// This tells the library that the encoder has its own pull-up resistors
rotaryEncoder.setEncoderType( EncoderType::HAS_PULLUP );

// Range of values to be returned by the encoder: minimum is 1, maximum is 10
// The third argument specifies whether turning past the minimum/maximum will
// wrap around to the other side:
// - true = turn past 10, wrap to 1; turn past 1, wrap to 10
// - false = turn past 10, stay on 10; turn past 1, stay on 1
rotaryEncoder.setBoundaries( 1, 10, true );
// Range of values to be returned by the encoder: minimum is 1, maximum is 10
// The third argument specifies whether turning past the minimum/maximum will
// wrap around to the other side:
// - true = turn past 10, wrap to 1; turn past 1, wrap to 10
// - false = turn past 10, stay on 10; turn past 1, stay on 1
rotaryEncoder.setBoundaries( 1, 10, true );

// The function specified here will be called every time the knob is turned
// and the current value will be passed to it
rotaryEncoder.onTurned( &knobCallback );
// The function specified here will be called every time the knob is turned
// and the current value will be passed to it
rotaryEncoder.onTurned( &knobCallback );

// The function specified here will be called every time the button is pushed
rotaryEncoder.onPressed( &buttonCallback );
// The function specified here will be called every time the button is pushed
rotaryEncoder.onPressed( &buttonCallback );

// This is where the inputs are configured and the interrupts get attached
rotaryEncoder.begin();
// This is where the inputs are configured and the interrupts get attached
rotaryEncoder.begin();
}

void loop()
{
// Your stuff here
// Your stuff here
}
```
Expand Down
2 changes: 1 addition & 1 deletion examples/BasicRotaryEncoder/BasicRotaryEncoder.ino
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,4 @@ void setup()
void loop()
{
// Your stuff here
}
}
4 changes: 2 additions & 2 deletions examples/TwoRotaryEncoders/TwoRotaryEncoders.ino
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ void setup_RE2()
// Range of values to be returned by the encoder: minimum is -100, maximum is 100
// The third argument specifies whether turning past the minimum/maximum will wrap
// around to the other side.
// In this example, turn past 100, stay on 100; turn past -100, stay on -100
// In this example, turn past 100, stay on 100; turn past -100, stay on -100
rotaryEncoder2.setBoundaries( -100, 100, false );

// The function specified here will be called every time the knob is turned
Expand All @@ -133,4 +133,4 @@ void setup()
void loop()
{
// Your stuff here
}
}
62 changes: 31 additions & 31 deletions library.json
Original file line number Diff line number Diff line change
@@ -1,33 +1,33 @@
{
"name": "ESP32RotaryEncoder",
"keywords": "arduino, rotary encoder, button, gpio, interrupts",
"description": "ESP32RotaryEncoder is a small library that makes implementing a rotary encoder on ESP32 easy. It uses interrupts for instant detection of knob turns or button presses without blocking or other delays.",
"version": "1.0.4",
"authors": [
{
"name": "Matthew Clark",
"url": "https://github.com/MaffooClock",
"maintainer": true
}
],
"repository": {
"type": "git",
"url": "https://github.com/MaffooClock/ESP32RotaryEncoder"
"name": "ESP32RotaryEncoder",
"keywords": "arduino, rotary encoder, button, gpio, interrupts",
"description": "ESP32RotaryEncoder is a small library that makes implementing a rotary encoder on ESP32 easy. It uses interrupts for instant detection of knob turns or button presses without blocking or other delays.",
"version": "1.0.4",
"authors": [
{
"name": "Matthew Clark",
"url": "https://github.com/MaffooClock",
"maintainer": true
}
],
"repository": {
"type": "git",
"url": "https://github.com/MaffooClock/ESP32RotaryEncoder"
},
"headers": "ESP32RotaryEncoder.h",
"examples": [
{
"name": "Basic Example",
"base": "examples/BasicRotaryEncoder",
"files": [ "BasicRotaryEncoder.ino" ]
},
"headers": "ESP32RotaryEncoder.h",
"examples": [
{
"name": "Basic Example",
"base": "examples/BasicRotaryEncoder",
"files": [ "BasicRotaryEncoder.ino" ]
},
{
"name": "Two Rotary Encoders",
"base": "examples/TwoRotaryEncoders",
"files": [ "TwoRotaryEncoders.ino" ]
}
],
"frameworks": "arduino",
"platforms": "espressif32",
"license": "MIT"
}
{
"name": "Two Rotary Encoders",
"base": "examples/TwoRotaryEncoders",
"files": [ "TwoRotaryEncoders.ino" ]
}
],
"frameworks": "arduino",
"platforms": "espressif32",
"license": "MIT"
}
Loading

0 comments on commit ff4bfdb

Please sign in to comment.