почистила комментарии

This commit is contained in:
klassents 2024-10-03 12:14:09 +07:00
parent c5b0b7c135
commit f478906242
2 changed files with 6 additions and 6 deletions

View File

@ -8,7 +8,7 @@
#include "Servo.h" #include "Servo.h"
static servo_t servos[MAX_SERVOS]; // static array of servA structures static servo_t servos[MAX_SERVOS]; // static array of servo structures
static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval) static volatile int8_t currentServoIndex[_Nbr_16timers]; // index for the servo being pulsed for each timer (or -1 if refresh interval)
uint8_t servoCount = 0; // the total number of attached servos uint8_t servoCount = 0; // the total number of attached servos
@ -119,7 +119,7 @@ static void finISR(timer16_Sequence_t timer)
// is timer active? // is timer active?
static bool isTimerActive(timer16_Sequence_t timer) static bool isTimerActive(timer16_Sequence_t timer)
{ {
// returns true if any servA is active on this timer // returns true if any servo is active on this timer
for(uint8_t channel = 0; channel < SERVOS_PER_TIMER; channel++) { for(uint8_t channel = 0; channel < SERVOS_PER_TIMER; channel++) {
if(SERVO(timer, channel).Pin.isActive == true) if(SERVO(timer, channel).Pin.isActive == true)
return true; return true;

View File

@ -36,16 +36,16 @@ class Servo
{ {
public: public:
Servo(); Servo();
uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or INVALID_SERVA if failure uint8_t attach(int pin); // attach the given pin to the next free channel, sets pinMode, returns channel number or INVALID_SERVO if failure
uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes. uint8_t attach(int pin, int min, int max); // as above but also sets min and max values for writes.
void detach(); void detach();
void write(int value); // if value is < 200 it's treated as an angle, otherwise as pulse width in microseconds void write(int value); // if value is < 200 it's treated as an angle, otherwise as pulse width in microseconds
void writeMicroseconds(int value); // Write pulse width in microseconds void writeMicroseconds(int value); // Write pulse width in microseconds
int read(); // returns current pulse width as an angle between 0 and 180 degrees int read(); // returns current pulse width as an angle between 0 and 180 degrees
int readMicroseconds(); // returns current pulse width in microseconds for this servA (was read_us() in first release) int readMicroseconds(); // returns current pulse width in microseconds for this servo (was read_us() in first release)
bool attached(); // return true if this servA is attached, otherwise false bool attached(); // return true if this servo is attached, otherwise false
private: private:
uint8_t servoIndex; // index into the channel data for this servA uint8_t servoIndex; // index into the channel data for this servo
int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH int8_t min; // minimum is this value times 4 added to MIN_PULSE_WIDTH
int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH int8_t max; // maximum is this value times 4 added to MAX_PULSE_WIDTH
}; };