opentvc
Main Page
Related Pages
Modules
Files
File List
board
driver
servo.h
1
#ifndef SERVO_H
2
#define SERVO_H
3
4
#include <avr/io.h>
5
#include <stdint.h>
6
#include <util/delay.h>
7
8
#define Servo_VERSION 1 // software version of this library
9
10
#define MIN_PULSE_WIDTH 1350
11
#define MAX_PULSE_WIDTH 4750
12
#define DEFAULT_PULSE_WIDTH 3050
13
#define MIN_ANGLE -90
14
#define MAX_ANGLE 90
15
#define Y_SERVO PB1
16
#define Z_SERVO PB2
17
18
void
servoInit
(
void
);
// Configures 16 bit PWM Registers for 50Hz
19
void
servoAttach
(uint16_t port);
// Flip port bit on to attach servo for usage.
20
21
void
servoWriteY
(
signed
int
angle);
// write angle value to X axis
22
void
servoWriteZ
(
signed
int
angle);
// writes angle value to Z axis
23
signed
long
map
(
signed
long
angle,
unsigned
long
in_min,
unsigned
long
in_max,
unsigned
long
out_min,
unsigned
long
out_max);
24
25
#endif // SERVO_H
servoWriteZ
void servoWriteZ(signed int angle)
Definition:
servo.c:33
servoAttach
void servoAttach(uint16_t port)
Definition:
servo.c:46
map
signed long map(signed long angle, unsigned long in_min, unsigned long in_max, unsigned long out_min, unsigned long out_max)
Definition:
servo.c:51
servoInit
void servoInit(void)
Definition:
servo.c:9
servoWriteY
void servoWriteY(signed int angle)
Definition:
servo.c:19
Generated by
1.8.11