2017-11-24 13:29:36 +02:00
|
|
|
#ifndef MAIN_H
|
|
|
|
#define MAIN_H
|
|
|
|
|
2017-11-28 15:25:12 +02:00
|
|
|
#include <stdint.h>
|
|
|
|
|
2018-01-02 13:45:56 +02:00
|
|
|
#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
|
2017-11-24 22:58:52 +02:00
|
|
|
|
2017-11-28 15:25:12 +02:00
|
|
|
void init_led(void);
|
|
|
|
void init_pwm(void);
|
|
|
|
void read_temp(void);
|
|
|
|
void run_servos(void);
|
|
|
|
uint16_t read_adc(uint8_t channel);
|
2017-11-24 13:29:36 +02:00
|
|
|
|
|
|
|
#endif
|