mirror of
https://github.com/wpilibsuite/allwpilib
synced 2026-06-24 01:31:46 +00:00
Add format script which invokes clang-format on the C++ source code (#41)
On Windows machines, clang-format.exe must be in the PATH environment variable.
This commit is contained in:
committed by
Peter Johnson
parent
68690643d2
commit
e14e45da76
@@ -7,12 +7,12 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#include "HAL/HAL.hpp"
|
||||
#include "CounterBase.h"
|
||||
#include "SensorBase.h"
|
||||
#include "Counter.h"
|
||||
#include "PIDSource.h"
|
||||
#include "CounterBase.h"
|
||||
#include "HAL/HAL.hpp"
|
||||
#include "LiveWindow/LiveWindowSendable.h"
|
||||
#include "PIDSource.h"
|
||||
#include "SensorBase.h"
|
||||
|
||||
#include <memory>
|
||||
|
||||
@@ -22,17 +22,13 @@ class DigitalGlitchFilter;
|
||||
/**
|
||||
* Class to read quad encoders.
|
||||
* Quadrature encoders are devices that count shaft rotation and can sense
|
||||
* direction. The output of
|
||||
* the QuadEncoder class is an integer that can count either up or down, and can
|
||||
* go negative for
|
||||
* reverse direction counting. When creating QuadEncoders, a direction is
|
||||
* supplied that changes the
|
||||
* sense of the output to make code more readable if the encoder is mounted such
|
||||
* that forward movement
|
||||
* generates negative values. Quadrature encoders have two digital outputs, an A
|
||||
* Channel and a B Channel
|
||||
* that are out of phase with each other to allow the FPGA to do direction
|
||||
* sensing.
|
||||
* direction. The output of the QuadEncoder class is an integer that can count
|
||||
* either up or down, and can go negative for reverse direction counting. When
|
||||
* creating QuadEncoders, a direction is supplied that changes the sense of the
|
||||
* output to make code more readable if the encoder is mounted such that forward
|
||||
* movement generates negative values. Quadrature encoders have two digital
|
||||
* outputs, an A Channel and a B Channel that are out of phase with each other
|
||||
* to allow the FPGA to do direction sensing.
|
||||
*
|
||||
* All encoders will immediately start counting - Reset() them if you need them
|
||||
* to be zeroed before use.
|
||||
@@ -52,11 +48,11 @@ class Encoder : public SensorBase,
|
||||
Encoder(uint32_t aChannel, uint32_t bChannel, bool reverseDirection = false,
|
||||
EncodingType encodingType = k4X);
|
||||
Encoder(std::shared_ptr<DigitalSource> aSource,
|
||||
std::shared_ptr<DigitalSource> bSource,
|
||||
std::shared_ptr<DigitalSource> bSource, bool reverseDirection = false,
|
||||
EncodingType encodingType = k4X);
|
||||
Encoder(DigitalSource* aSource, DigitalSource* bSource,
|
||||
bool reverseDirection = false, EncodingType encodingType = k4X);
|
||||
Encoder(DigitalSource *aSource, DigitalSource *bSource,
|
||||
bool reverseDirection = false, EncodingType encodingType = k4X);
|
||||
Encoder(DigitalSource &aSource, DigitalSource &bSource,
|
||||
Encoder(DigitalSource& aSource, DigitalSource& bSource,
|
||||
bool reverseDirection = false, EncodingType encodingType = k4X);
|
||||
virtual ~Encoder();
|
||||
|
||||
@@ -81,9 +77,9 @@ class Encoder : public SensorBase,
|
||||
|
||||
void SetIndexSource(uint32_t channel, IndexingType type = kResetOnRisingEdge);
|
||||
DEPRECATED("Use pass-by-reference instead.")
|
||||
void SetIndexSource(DigitalSource *source,
|
||||
void SetIndexSource(DigitalSource* source,
|
||||
IndexingType type = kResetOnRisingEdge);
|
||||
void SetIndexSource(const DigitalSource &source,
|
||||
void SetIndexSource(const DigitalSource& source,
|
||||
IndexingType type = kResetOnRisingEdge);
|
||||
|
||||
void UpdateTable() override;
|
||||
@@ -99,15 +95,15 @@ class Encoder : public SensorBase,
|
||||
void InitEncoder(bool _reverseDirection, EncodingType encodingType);
|
||||
double DecodingScaleFactor() const;
|
||||
|
||||
std::shared_ptr<DigitalSource> m_aSource; // the A phase of the quad encoder
|
||||
std::shared_ptr<DigitalSource> m_bSource; // the B phase of the quad encoder
|
||||
void *m_encoder = nullptr;
|
||||
int32_t m_index = 0; // The encoder's FPGA index.
|
||||
double m_distancePerPulse = 1.0; // distance of travel for each encoder tick
|
||||
std::shared_ptr<DigitalSource> m_aSource; // the A phase of the quad encoder
|
||||
std::shared_ptr<DigitalSource> m_bSource; // the B phase of the quad encoder
|
||||
void* m_encoder = nullptr;
|
||||
int32_t m_index = 0; // The encoder's FPGA index.
|
||||
double m_distancePerPulse = 1.0; // distance of travel for each encoder tick
|
||||
std::unique_ptr<Counter> m_counter =
|
||||
nullptr; // Counter object for 1x and 2x encoding
|
||||
EncodingType m_encodingType; // Encoding type
|
||||
int32_t m_encodingScale; // 1x, 2x, or 4x, per the encodingType
|
||||
nullptr; // Counter object for 1x and 2x encoding
|
||||
EncodingType m_encodingType; // Encoding type
|
||||
int32_t m_encodingScale; // 1x, 2x, or 4x, per the encodingType
|
||||
|
||||
std::shared_ptr<ITable> m_table;
|
||||
friend class DigitalGlitchFilter;
|
||||
|
||||
Reference in New Issue
Block a user