00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014 #ifndef _CONFIG_H_
00015 #define _CONFIG_H_
00016
00019 #include "compiler.h"
00020 #ifdef __GNUC__
00021 #include <avr/io.h>
00022 #elif __ICCAVR__
00023 #include <ioavr.h>
00024 #else
00025 #error Current COMPILER not supported
00026 #endif
00027
00028
00029 #ifdef __GNUC__
00030 #include <avr/power.h>
00031 #endif
00032
00033
00034
00035 #include "compiler.h"
00036 #include "config_motor.h"
00037
00038
00039
00041 #define FOSC 8000
00042
00043
00044 #define TWI_CMD_MASTER_WRITE 0x10
00045 #define TWI_CMD_MASTER_READ 0x20
00046 #define TWI_CMD_MASTER_WRITE_ALOT 0x30
00047
00048 #define TWI_SLAVE
00049 #define TWI_BAUDRATE 80 // in kbit
00050 #define TWI_SLAVE_ADDRESS 0x10 // TWI Slave Address = 0x10
00051
00052 #define BOARD_ID 3
00053 #define SOFT_ID 1
00054 #define REV_ID 1
00055
00056 #define NO_ANSWER 0x99
00057
00058
00059 #define DIRECTION_FORWARD 0
00060
00061
00062 #define DIRECTION_REVERSE 1
00063
00064
00065 #define STATE_STOP 0
00066
00067
00068 #define STATE_RUN 1
00069
00070 #define MOTOR_CONTROL_CENTER 0
00071 #define POTENTIOMETER 1
00072
00073
00074
00075 typedef struct {
00076 U8 current : 8;
00077 U16 speed : 16;
00078 U8 state : 1;
00079 U8 direction : 1;
00080 } motorControlFlags_t;
00081
00082
00083
00085
00086
00096 #ifdef __GNUC__
00097 #define Clear_prescaler() (clock_prescale_set(0))
00098 #else
00099 #define Clear_prescaler() (Set_cpu_prescaler(0))
00100 #endif
00101
00111 #ifdef __GNUC__
00112 #define Set_cpu_prescaler(x) (clock_prescale_set(x))
00113 #else
00114 extern void Set_cpu_prescaler(U8 x);
00115 #endif
00116
00117 #endif // _CONFIG_H_
00118