 // =================================================================================
 void setup()
 {
-  // Attach interruption to encoders channels
-  attachInterrupt(0, ISR_HANDLER_X, CHANGE);
-  attachInterrupt(1, ISR_HANDLER_X, CHANGE);
-  attachInterrupt(2, ISR_HANDLER_Y, CHANGE);
-  attachInterrupt(3, ISR_HANDLER_Y, CHANGE);
-  
-  // Start the mouse function
-  Mouse.begin();
+    // Attach interruption to encoders channels
+    attachInterrupt(0, ISR_HANDLER_X, CHANGE);
+    attachInterrupt(1, ISR_HANDLER_X, CHANGE);
+    attachInterrupt(2, ISR_HANDLER_Y, CHANGE);
+    attachInterrupt(3, ISR_HANDLER_Y, CHANGE);
+
+    // Start the mouse function
+    Mouse.begin();
 }
 
 // =================================================================================

// =================================================================================
void loop()
{
  // Update mouse coordinates
  if (xAxis.coordinate != 0 || yAxis.coordinate != 0)
  {
    Mouse.move(xAxis.coordinate, yAxis.coordinate);
    xAxis.coordinate = 0;
    yAxis.coordinate = 0;
  }

  // ---------------------------------
  // Left mouse button state update
  // ---------------------------------
  ReadButton(leftButton);
  UpdateButton(leftButton);

  // ---------------------------------
  // Right mouse button state update
  // ---------------------------------  
  ReadButton(rightButton);
  UpdateButton(rightButton);
  
  // ---------------------------------
  // Middle mouse button state update
  // ---------------------------------
  ReadButton(middleButton);
  UpdateButton(middleButton);

  // Wait a little before next update
  delay(10);
}

// =================================================================================

// =================================================================================
typedef struct ENCODER_
{
    int8_t  coordinate;
    uint8_t index;
} ENCODER_;

typedef struct BUTTON_
{
    boolean state;
    boolean needUpdate;
    char    button;
    byte    bitmask;
    long    lastDebounceTime;
} BUTTON_;

// =================================================================================
