qload: enabled autoquit
[trut64.git] / avr / motor.h
blob350a98aadb8bc9201a39a38a8acd31de59215f78
1 /*
2 * Copyright (C) 2007 Anton Blad
3 * Copyright (C) 2007 Fredrik Kuivinen
4 * Copyright (C) 2007 Jakob Rosén
6 * This file is licensed under GPL v2.
7 */
9 #ifndef MOTOR_H
10 #define MOTOR_H
12 #include <stdint.h>
14 #define MOTOR_TIMEOUT_MASK 0x07ff
15 #define MOTOR_STATUS_MASK 0x8000
16 #define MOTOR_TRANSITION_MASK 0x4000
18 extern uint16_t motor_status;
19 extern uint16_t motor_latency_ms;
21 static inline void motor_init() { }
23 static inline uint8_t motor_ison()
25 return (motor_status & MOTOR_STATUS_MASK) != 0;
28 static inline uint8_t motor_isoff()
30 return (motor_status & MOTOR_STATUS_MASK) == 0;
33 static inline uint16_t motor_latency()
35 return motor_latency_ms;
38 static inline void motor_setlatency(uint16_t t)
40 motor_latency_ms = t;
43 void motor_task();
45 #endif