Update preset.
[bertos.git] / bertos / hw / hw_dc_motor.h
index 0244cdefff8f305eff509bd98b530d3880bff5a3..f39388df00c019bb85c05ad79a7ea758cf193416 100644 (file)
  * 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 <asterix@develer.com>
  */
 
 #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 */