robotics/include/servo2.h File Reference
#include "esos.h"
#include "esos_pic24.h"
Go to the source code of this file.
Detailed Description
- Author:
- Thomas Donaldson
This header file declares all the servo2 library functions. Configuration of the servo2 library should be done through
servoconfig2.h; see that file for more information.
Definition in file servo2.h.
Define Documentation
#define MAX_NUM_SERVOS_2 7 |
Defines the maximum number of standard servos that can be handled.
Definition at line 52 of file servo2.h.
#define TIME_PER_SERVO_2 (SERVO_PULSE_PERIOD_2 / MAX_NUM_SERVOS_2) |
Determines the maximum per-servo pulse width. The value given is in timer 1 ticks.
Definition at line 63 of file servo2.h.
Function Documentation
ESOS_USER_INTERRUPT |
( |
ESOS_IRQ_PIC24_T2 |
|
) |
|
The servo ISR.
- Precondition:
- This ISR must be initialized via InitServo2() and registered and enabled via ESOS routines in user_init(). NUM_SERVOS_USED_2 must be defined (and not exceed MAX_NUM_SERVOS_2) and each SERVO_2_PORT_x (starting from 1 and in ascending order) must be mapped in servoconfig2.h.
The ISR steps through the SERVO_2_PORT_x's and interrupts when the servo state should change. This routine will throw a run-time
ASSERT() error if the specified servo duration exceeds software/physical limitations.
Definition at line 82 of file servo2.c.
void initialize_servo_2 |
( |
void |
|
) |
|
Initializes the servos and Timer2.
- Precondition:
- The desired SERVO_2_PORT_x's (starting from 1 and in ascending order), CONFIG_SERVO_2_PORT_x(), NUM_SERVOS_USED_2, and SERVO_PRESCALAR_2 must be defined in servoconfig2.h.
The au16_servoDur2[] array is filled with 1.5 ms interrupts by default. Each SERVO_2_PORT_x is configured, and Timer2 is initialized and set to flag in 1ms. For ESOS users, the Timer2 interrupt is registered and enabled.
Definition at line 27 of file servo2.c.