clangtidy corrections part 1
This commit is contained in:
+21
-14
@@ -1,14 +1,14 @@
|
||||
#include "counter.h"
|
||||
#include <inttypes.h>
|
||||
|
||||
uint8_t Counter::amountOfCounter = 0;
|
||||
|
||||
Counter::Counter(uint8_t pin) {
|
||||
this->pulsePin = pin;
|
||||
|
||||
this->unit = static_cast<pcnt_unit_t>(Counter::amountOfCounter);
|
||||
if (Counter::amountOfCounter < 7)
|
||||
Counter::Counter(uint8_t pin)
|
||||
: pulsePin{pin}, unit{static_cast<pcnt_unit_t>(Counter::amountOfCounter)}
|
||||
{
|
||||
if (Counter::amountOfCounter <= Counter::maxCounter)
|
||||
{
|
||||
Counter::amountOfCounter++;
|
||||
}
|
||||
|
||||
pcnt_config_t config;
|
||||
config.unit = this->unit;
|
||||
@@ -24,33 +24,40 @@ Counter::Counter(uint8_t pin) {
|
||||
pcnt_unit_config(&config);
|
||||
}
|
||||
|
||||
void Counter::pause() {
|
||||
void Counter::pause()
|
||||
{
|
||||
pcnt_counter_pause(this->unit);
|
||||
}
|
||||
|
||||
void Counter::resume() {
|
||||
void Counter::resume()
|
||||
{
|
||||
pcnt_counter_resume(this->unit);
|
||||
}
|
||||
|
||||
void Counter::clear() {
|
||||
void Counter::clear()
|
||||
{
|
||||
pcnt_counter_clear(this->unit);
|
||||
}
|
||||
|
||||
int16_t Counter::getValue() const {
|
||||
int16_t res;
|
||||
int16_t Counter::getValue() const
|
||||
{
|
||||
int16_t res = 0;
|
||||
pcnt_get_counter_value(this->unit, &res);
|
||||
return res;
|
||||
}
|
||||
|
||||
void Counter::setFilterValue(uint16_t value) {
|
||||
void Counter::setFilterValue(uint16_t value)
|
||||
{
|
||||
pcnt_set_filter_value(this->unit, value);
|
||||
this->filterEnable();
|
||||
}
|
||||
|
||||
void Counter::filterEnable() {
|
||||
void Counter::filterEnable()
|
||||
{
|
||||
pcnt_filter_enable(this->unit);
|
||||
}
|
||||
|
||||
void Counter::filterDisable() {
|
||||
void Counter::filterDisable()
|
||||
{
|
||||
pcnt_filter_disable(this->unit);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user