From: Jeonghoon Park Date: Mon, 18 Dec 2017 05:05:18 +0000 (+0900) Subject: add some comments X-Git-Url: http://review.tizen.org/git/?p=apps%2Fnative%2Fgear-racing-car.git;a=commitdiff_plain;h=d6ea944b5b650349e7ac357c4fad249e070b8a10 add some comments --- diff --git a/inc/resource/resource_motor_driver_L298N.h b/inc/resource/resource_motor_driver_L298N.h index e0f9d51..1cf7bae 100644 --- a/inc/resource/resource_motor_driver_L298N.h +++ b/inc/resource/resource_motor_driver_L298N.h @@ -19,7 +19,14 @@ #ifndef __RESOURCE_MOTOR_DRIVER_L298N_H__ #define __RESOURCE_MOTOR_DRIVER_L298N_H__ -/* connected GPIO pin numbers of raspberry pi 3 with IN pins of L298N */ +/** + * This module is sample codes to handling DC motors in Tizen platform. + * HW is configured with L298N(motor driver) and PCA9685(PWM controller). + * To control motor, we use two GPIO pins of IoT board(e.g. RPi 3) connected + * with L298N and a PWM channel of PCA9685 connected with L298N + */ + +/* Default GPIO pins of raspberry pi 3 connected with IN pins of L298N */ #define DEFAULT_MOTOR1_PIN1 26 #define DEFAULT_MOTOR1_PIN2 20 @@ -32,12 +39,16 @@ #define DEFAULT_MOTOR4_PIN1 22 #define DEFAULT_MOTOR4_PIN2 23 -/* connected channel numbers of PCA9685 with enable pins of L298N */ +/* Default channel numbers of PCA9685 with enable pins of L298N */ #define DEFAULT_MOTOR1_EN_CH 1 #define DEFAULT_MOTOR2_EN_CH 2 #define DEFAULT_MOTOR3_EN_CH 3 #define DEFAULT_MOTOR4_EN_CH 4 + +/** + * @brief Enumeration for motor id. + */ typedef enum { MOTOR_ID_1, MOTOR_ID_2, @@ -46,9 +57,26 @@ typedef enum { MOTOR_ID_MAX } motor_id_e; +/** + * @param[in] id The motor id + * @param[in] pin1 The first pin number to control motor + * @param[in] pin2 The second pin number to control motor + * @param[in] en_ch The enable channnel number to control PWM signal + * + * @return 0 on success, otherwise a negative error value + * @before resource_set_motor_driver_L298N_speed() : Optional + */ int resource_set_motor_driver_L298N_configuration(motor_id_e id, unsigned int pin1, unsigned int pin2, unsigned en_ch); +/** + * @param[in] id The motor id + * @param[in] speed The speed to control motor, 0 to stop motor, + * positive value to rotate clockwise and higher value to rotate more fast + * negative value to rotate couterclockwise and lower value to rotate more fast + * @return 0 on success, otherwise a negative error value + * @before resource_set_motor_driver_L298N_speed() : Optional + */ int resource_set_motor_driver_L298N_speed(motor_id_e id, int speed); #endif /* __RESOURCE_MOTOR_DRIVER_L298N_H__ */ diff --git a/inc/resource/resource_servo_motor.h b/inc/resource/resource_servo_motor.h index 2cda1da..924d6cc 100644 --- a/inc/resource/resource_servo_motor.h +++ b/inc/resource/resource_servo_motor.h @@ -19,6 +19,18 @@ #ifndef __RESOURCE_SERVO_MOTOR_H__ #define __RESOURCE_SERVO_MOTOR_H__ +/** + * This module is sample codes to handling Servo motors in Tizen platform. + * HW is configured with PCA9685(PWM controller). + */ + +/** + * @param[in] id The motor id + * @param[in] value The value to control servo motor + * + * @return 0 on success, otherwise a negative error value + * @remarks Must adjust servo motor with some value before use to fit your system. + */ int resource_set_servo_motor_value(unsigned int motor_id, int value); #endif /* __RESOURCE_SERVO_MOTOR_H__ */