работает с перемычкой на 1МГц 2%
This commit is contained in:
@@ -6,7 +6,7 @@
|
||||
enum class Role : uint8_t { SOLO, MASTER, SLAVE };
|
||||
enum class FailReason : uint8_t {
|
||||
NONE, NO_SIGNAL, PERIOD_OUT, DUTY_OUT, EXTRA_EDGE, GLITCH, LOST_EDGE,
|
||||
TOO_FEW_PERIODS, LINK_LOST, UNSUPPORTED, RESOLUTION, ABORTED, DATA_LOST
|
||||
TOO_FEW_PERIODS, LINK_LOST, UNSUPPORTED, RESOLUTION, ABORTED
|
||||
};
|
||||
|
||||
const char *roleName(Role role);
|
||||
@@ -53,7 +53,7 @@ struct StageStats {
|
||||
uint8_t firstBadRepeat;
|
||||
float badFrequency;
|
||||
float badDuty;
|
||||
uint32_t lostItems;
|
||||
uint32_t droppedItems;
|
||||
FailReason reason;
|
||||
void reset();
|
||||
};
|
||||
@@ -65,6 +65,12 @@ struct PeriodLimits {
|
||||
uint32_t maxDutyX100;
|
||||
};
|
||||
|
||||
struct IntegerPwmConfig {
|
||||
uint32_t actualHz;
|
||||
uint16_t divider;
|
||||
uint8_t bits;
|
||||
};
|
||||
|
||||
uint32_t settingsChecksum(const Settings &s);
|
||||
uint32_t frequencyPointCount(uint32_t startHz, uint32_t endHz, uint32_t stepHz);
|
||||
uint32_t frequencyAt(uint32_t startHz, uint32_t endHz, uint32_t stepHz, uint32_t index);
|
||||
@@ -73,6 +79,11 @@ bool periodWithin(float measuredHz, float expectedHz, float tolerancePct);
|
||||
bool dutyWithin(float measuredPct, float expectedPct, float tolerancePct);
|
||||
uint8_t choosePwmResolution(uint32_t frequencyHz, uint32_t sourceClockHz,
|
||||
uint8_t maxBits);
|
||||
uint8_t chooseStablePwmResolution(uint32_t frequencyHz, uint32_t sourceClockHz,
|
||||
uint8_t maxBits, uint8_t dutyPct);
|
||||
bool chooseIntegerPwmConfig(uint32_t requestedHz, uint32_t sourceClockHz,
|
||||
uint8_t maxBits, uint8_t dutyPct,
|
||||
IntegerPwmConfig &config);
|
||||
FailReason validateResolution(uint32_t frequencyHz, float dutyPct, float accuracyPct,
|
||||
uint32_t captureResolutionHz, uint8_t pwmBits);
|
||||
FailReason evaluatePeriod(const PulsePeriod &period, uint32_t tickHz, float expectedHz,
|
||||
|
||||
Reference in New Issue
Block a user