Prusa MINI Firmware overview
|
Go to the documentation of this file.
47 #include "../HAL_AVR/ServoTimers.h"
48 #elif defined(ARDUINO_ARCH_SAM)
49 #include "../HAL_DUE/ServoTimers.h"
50 #elif defined(__SAMD51__)
51 #include "../HAL_SAMD51/ServoTimers.h"
53 #error "This library only supports boards with an AVR, SAM3X or SAMD51 processor."
58 #define MIN_PULSE_WIDTH 544 // the shortest pulse sent to a servo
59 #define MAX_PULSE_WIDTH 2400 // the longest pulse sent to a servo
60 #define DEFAULT_PULSE_WIDTH 1500 // default pulse width when servo is attached
61 #define REFRESH_INTERVAL 20000 // minimum time to refresh servos in microseconds
63 #define SERVOS_PER_TIMER 12 // the maximum number of servos controlled by one timer
64 #define MAX_SERVOS (_Nbr_16timers * SERVOS_PER_TIMER)
66 #define INVALID_SERVO 255 // flag indicating an invalid servo index
69 #define usToTicks(_us) (clockCyclesPerMicrosecond() * (_us) / (SERVO_TIMER_PRESCALER))
70 #define ticksToUs(_ticks) (unsigned(_ticks) * (SERVO_TIMER_PRESCALER) / clockCyclesPerMicrosecond())
73 #define SERVO_INDEX_TO_TIMER(_servo_nbr) ((timer16_Sequence_t)(_servo_nbr / (SERVOS_PER_TIMER))) // returns the timer controlling this servo
74 #define SERVO_INDEX_TO_CHANNEL(_servo_nbr) (_servo_nbr % (SERVOS_PER_TIMER)) // returns the index of the servo on this timer
75 #define SERVO_INDEX(_timer,_channel) ((_timer*(SERVOS_PER_TIMER)) + _channel) // macro to access servo index by timer and channel
76 #define SERVO(_timer,_channel) (servo_info[SERVO_INDEX(_timer,_channel)]) // macro to access servo class by timer and channel
Definition: servo_private.h:72
Definition: servo_private.h:67
timer16_Sequence_t
Definition: ServoTimers.h:77
ServoInfo_t servo_info[MAX_SERVOS]
const uint8_t[]
Definition: 404_html.c:3
#define MAX_SERVOS
Definition: servo_private.h:64
unsigned int ticks
Definition: servo_private.h:87
void initISR(timer16_Sequence_t timer)
void finISR(timer16_Sequence_t timer)