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 haofan Zheng

Hardwares/Motor.h

Committer:
hazheng
Date:
2017-04-16
Branch:
Drift
Revision:
75:de107fac3bc9
Parent:
74:2d45b954deb1
Child:
77:1ee12f434a23

File content as of revision 75:de107fac3bc9:

#pragma once

#include <mbed.h>

#define MotorDir uint8_t
#define MDIR_Forward  0
#define MDIR_Backward 1


#define MOTOR_MAX_SPEED_LIMIT 0.6f

#define MOTOR_DIFF_MIN_SPEED  0.55f

#ifdef __cplusplus
extern "C" {
#endif

void motor_init();

void motor_set_left_speed(const float speed);

void motor_set_right_speed(const float speed);

inline void motor_set_speeds(const float speed_left, const float speed_right)
{
    motor_set_left_speed(speed_left);
    motor_set_right_speed(speed_right);
}

void motor_set_left_direction(MotorDir dir);

void motor_set_right_direction(MotorDir dir);

inline void motor_set_direction(MotorDir dirL, MotorDir dirR)
{
    motor_set_left_direction(dirL);
    motor_set_right_direction(dirR);
}

#ifdef __cplusplus
}
#endif