X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fhw%2Fhw_dc_motor.h;h=f39388df00c019bb85c05ad79a7ea758cf193416;hb=8ad8e5d325736480a881a7f30bd757f96b87376e;hp=0244cdefff8f305eff509bd98b530d3880bff5a3;hpb=3a7a43b5c7be260710499540538eaf7109c60982;p=bertos.git diff --git a/bertos/hw/hw_dc_motor.h b/bertos/hw/hw_dc_motor.h index 0244cdef..f39388df 100644 --- a/bertos/hw/hw_dc_motor.h +++ b/bertos/hw/hw_dc_motor.h @@ -26,109 +26,46 @@ * invalidate any other reasons why the executable file might be covered by * the GNU General Public License. * - * Copyright 2008 Develer S.r.l. (http://www.develer.com/) + * Copyright 2006 Develer S.r.l. (http://www.develer.com/) * All Rights Reserved. * --> * * \brief DC motor hardware-specific definitions * - * \version $Id$ - * * \author Daniele Basile */ #ifndef HW_DC_MOTOR_H #define HW_DC_MOTOR_H -#warning TODO:This is example implemetantion, you must implement it! - -//DC motor 0 -#define DC_MOTOR0_EN_PIN /* Implement me! */ -#define DC_MOTOR0_DIR_PIN /* Implement me! */ -#define DC_MOTOR0_CLEAR /* Implement me! */ -#define DC_MOTOR0_SET /* Implement me! */ - -/* Add other motor here */ - - -#define DC_MOTOR_PIN_INIT_MACRO(port, index) \ - do { \ - /* put here code to init pins */ \ - } while (0) - - -#define DC_MOTOR_SET_ENABLE(index) do { /* Implement me! */ } while (0) -#define DC_MOTOR_SET_DISABLE(index) do { /* Implement me! */ } while (0) -#define DC_MOTOR_DIR_CW_MACRO(index) do { /* Implement me! */ } while (0) -#define DC_MOTOR_DIR_CCW_MACRO(index) do { /* Implement me! */ } while (0) - - -#define DC_MOTOR_ENABLE(index) \ - do { \ - switch (index) \ - { \ - case 0:\ - DC_MOTOR_SET_ENABLE(0); \ - break; \ - /* Add other motor here */ \ - } \ - } while(0) +#warning TODO:This is an example implementation, you must implement it! -#define DC_MOTOR_DISABLE(index) \ - do { \ - switch (index) \ - { \ - case 0:\ - DC_MOTOR_SET_DISABLE(0); \ - break; \ - /* Add other motor here */ \ - } \ - } while(0) - - -#define DC_MOTOR_DIR_CW(index) \ - do { \ - switch (index) \ - { \ - case 0:\ - DC_MOTOR_DIR_CW_MACRO(0); \ - break; \ - /* Add other motor here */ \ - } \ - } while(0) - - #define DC_MOTOR_DIR_CCW(index) \ - do { \ - switch (index) \ - { \ - case 0:\ - DC_MOTOR_DIR_CCW_MACRO(0); \ - break; \ - /* Add other motor here */ \ - } \ - } while(0) - - - -#define DC_MOTOR_SET_DIR(index, dir) \ - do { \ - if (dir) \ - DC_MOTOR_DIR_CW(index); \ - else \ - DC_MOTOR_DIR_CCW(index); \ - } while (0) +/** + * Define fuctions which read adc value from specific device + */ + #define HW_DC_MOTOR_READ_VALUE(dev, min, max) \ + ({ \ + /* Put here the fuction that read from ADC */ \ + (void)(dev); \ + (void)(min); \ + (void)(max); \ + (0); \ + }) + +// Macro that enable the select DC motor +#define DC_MOTOR_ENABLE(dev) /* Implement me! */ +// Macro that disable the select DC motor +#define DC_MOTOR_DISABLE(dev) /* Implement me! */ + +// Macro that left the DC motor rotor float +#define DC_MOTOR_STOP_FLOAT(dev) DC_MOTOR_DISABLE(dev) +// Macro that put in short circuit DC motor supply pins +#define DC_MOTOR_STOP_BRAKED(dev) do { /* Implement me! */ } while (0) + +// Macro that set motor direction +#define DC_MOTOR_SET_DIR(dev, dir) do { /* Implement me! */ } while (0) + +#define MOTOR_DC_INIT() do { /* Implement me! */ } while (0) -#define DC_MOTOR_INIT(index) \ - do { \ - switch (index) \ - { \ - case 0: \ - DC_MOTOR_PIN_INIT_MACRO(A, 0); \ - break; \ - case 1: \ - DC_MOTOR_PIN_INIT_MACRO(A, 1); \ - break; \ - } \ - } while (0) #endif /* HW_DC_MOTOR_H */