27 lines
583 B
C
27 lines
583 B
C
#ifndef MAIN_H
|
|
#define MAIN_H
|
|
|
|
#include <stdint.h>
|
|
|
|
#ifndef F_CPU
|
|
#define F_CPU 1000000UL
|
|
#endif
|
|
|
|
#ifdef DEBUG
|
|
#include "debug.h"
|
|
#endif /* DEBUG */
|
|
|
|
#define SERVO_MIN 930 // (us). Go backwards
|
|
#define SERVO_MAX 1930 // (us). Go forwards
|
|
#define SERVO_MID (SERVO_MIN + SERVO_MAX) / 2 // Stop
|
|
#define PWM_PERIOD 16384 // (1000000 / F_CPU) * PRESCALER * 256) / F_CPU (us)
|
|
#define US2TIMER0(us) (255 * (uint32_t)us) / PWM_PERIOD
|
|
|
|
void init_led(void);
|
|
void init_pwm(void);
|
|
void read_temp(void);
|
|
void run_servos(void);
|
|
uint16_t read_adc(uint8_t channel);
|
|
|
|
#endif
|