SmartWheels self-driving race car. Designed for NXP Cup. Uses FRDM-KL25Z, area-scan camera, and simple image processing to detect and navigate any NXP spec track.
Dependencies: TSI USBDevice mbed-dev
Fork of SmartWheels by
Hardwares/Servo.h@45:501b7909139a, 2017-03-30 (annotated)
- Committer:
- hazheng
- Date:
- Thu Mar 30 03:50:23 2017 +0000
- Revision:
- 45:501b7909139a
- Parent:
- 14:88302da8bff0
- Child:
- 46:a5eb9bd3bb55
Turn servo class into pure C code. More classes need to be changed on tomorrow...
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
Bobymicjohn | 11:676ea42afd56 | 1 | #pragma once |
Bobymicjohn | 11:676ea42afd56 | 2 | |
Bobymicjohn | 11:676ea42afd56 | 3 | #include <mbed.h> |
Bobymicjohn | 11:676ea42afd56 | 4 | |
Bobymicjohn | 11:676ea42afd56 | 5 | namespace SW |
Bobymicjohn | 11:676ea42afd56 | 6 | { |
Bobymicjohn | 11:676ea42afd56 | 7 | class Core; |
Bobymicjohn | 11:676ea42afd56 | 8 | } |
Bobymicjohn | 11:676ea42afd56 | 9 | |
Bobymicjohn | 11:676ea42afd56 | 10 | #define SERVO_RT 1 |
Bobymicjohn | 11:676ea42afd56 | 11 | #define SERVO_LF -1 |
Bobymicjohn | 11:676ea42afd56 | 12 | |
Bobymicjohn | 14:88302da8bff0 | 13 | #define SERVO_MAX_ANGLE 21.0f |
Bobymicjohn | 11:676ea42afd56 | 14 | |
hazheng | 45:501b7909139a | 15 | #ifdef __cplusplus |
hazheng | 45:501b7909139a | 16 | extern "C" { |
hazheng | 45:501b7909139a | 17 | #endif |
hazheng | 45:501b7909139a | 18 | |
hazheng | 45:501b7909139a | 19 | void servo_init(); |
hazheng | 45:501b7909139a | 20 | |
hazheng | 45:501b7909139a | 21 | void servo_set_angle(float angle); |
hazheng | 45:501b7909139a | 22 | |
hazheng | 45:501b7909139a | 23 | #ifdef __cplusplus |
hazheng | 45:501b7909139a | 24 | } |
hazheng | 45:501b7909139a | 25 | #endif |
hazheng | 45:501b7909139a | 26 | |
hazheng | 45:501b7909139a | 27 | /* |
Bobymicjohn | 11:676ea42afd56 | 28 | Servo(SW::Core& core); |
Bobymicjohn | 11:676ea42afd56 | 29 | |
Bobymicjohn | 11:676ea42afd56 | 30 | ~Servo(); |
Bobymicjohn | 11:676ea42afd56 | 31 | |
Bobymicjohn | 11:676ea42afd56 | 32 | void Update(float deltaTime); |
Bobymicjohn | 11:676ea42afd56 | 33 | |
Bobymicjohn | 11:676ea42afd56 | 34 | void setAngle(float angle); |
Bobymicjohn | 11:676ea42afd56 | 35 | |
Bobymicjohn | 11:676ea42afd56 | 36 | private: |
Bobymicjohn | 11:676ea42afd56 | 37 | |
Bobymicjohn | 11:676ea42afd56 | 38 | SW::Core& m_core; |
Bobymicjohn | 11:676ea42afd56 | 39 | |
Bobymicjohn | 11:676ea42afd56 | 40 | float m_pulseWidth; |
Bobymicjohn | 11:676ea42afd56 | 41 | |
Bobymicjohn | 11:676ea42afd56 | 42 | PwmOut m_pwm; |
Bobymicjohn | 11:676ea42afd56 | 43 | |
Bobymicjohn | 11:676ea42afd56 | 44 | Servo(); |
Bobymicjohn | 11:676ea42afd56 | 45 | |
hazheng | 45:501b7909139a | 46 | }; |
hazheng | 45:501b7909139a | 47 | */ |