X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=bertos%2Fhw%2Fhw_dc_motor.h;h=f39388df00c019bb85c05ad79a7ea758cf193416;hb=4278d44ef7681c56f4bd16615c3c4d9338112df4;hp=5e3fea3ca90952a7381f0ddd88db9ff23182cc92;hpb=57cb450a644c0f31440ea69a81b17a298f2eb8d1;p=bertos.git diff --git a/bertos/hw/hw_dc_motor.h b/bertos/hw/hw_dc_motor.h index 5e3fea3c..f39388df 100644 --- a/bertos/hw/hw_dc_motor.h +++ b/bertos/hw/hw_dc_motor.h @@ -26,14 +26,12 @@ * 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 */ @@ -42,93 +40,32 @@ #warning TODO:This is an example implementation, 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) - -#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 */