-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
tests/drivers/motor_driver: rework test
Rework the test as the motor_driver module has been reworked to be compliant with RIOT device driver development guide. Mainly keep same behavior and use a simpler callback to illustrate post motor_set() callback use. Signed-off-by: Gilles DOFFE <[email protected]>
- Loading branch information
Showing
3 changed files
with
102 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* | ||
* Copyright (C) 2023 COGIP Robotics association | ||
* | ||
* This file is subject to the terms and conditions of the GNU Lesser | ||
* General Public License v2.1. See the file LICENSE in the top level | ||
* directory for more details. | ||
*/ | ||
|
||
/** | ||
* @ingroup tests | ||
* @{ | ||
* | ||
* @file | ||
* @brief Motor driver test header file. | ||
* | ||
* @author Gilles DOFFE <[email protected]> | ||
* | ||
*/ | ||
|
||
#ifndef INIT_DEV_H | ||
#define INIT_DEV_H | ||
|
||
#include <motor_driver.h> | ||
|
||
#ifndef MOTOR_DRIVER_PARAM_MOTOR_SET_POST_CALLBACK | ||
/** Default callback called at end of motor_set() */ | ||
#define MOTOR_DRIVER_PARAM_MOTOR_SET_POST_CALLBACK motor_driver_callback_example | ||
#endif | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Simple motor_set post callback example. | ||
* Just print current PWM value. | ||
* | ||
* @param[in] motor_driver motor driver to which motor is attached | ||
* @param[in] motor_id motor ID on driver | ||
* @param[in] pwm_duty_cycle Signed PWM duty_cycle to set motor speed and direction | ||
*/ | ||
void motor_driver_callback_example( | ||
const motor_driver_t *motor_driver, uint8_t motor_id, | ||
int32_t pwm_duty_cycle); | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* INIT_DEV_H */ | ||
/** @} */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters