![](/media/cache/img/default_profile.jpg.50x50_q85.jpg)
Moteurs
Dependencies: Encoder_Nucleo_16_bits PwmIn mbed
Fork of Automate by
include_define_typedeflibrary.h@8:ad8b64ca548d, 2017-06-09 (annotated)
- Committer:
- DOREL
- Date:
- Fri Jun 09 17:06:05 2017 +0000
- Revision:
- 8:ad8b64ca548d
Automate;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
DOREL | 8:ad8b64ca548d | 1 | //Include |
DOREL | 8:ad8b64ca548d | 2 | |
DOREL | 8:ad8b64ca548d | 3 | #include "mbed.h" |
DOREL | 8:ad8b64ca548d | 4 | #include "PwmIn.h" |
DOREL | 8:ad8b64ca548d | 5 | #include "Nucleo_Encoder_16_bits.h" |
DOREL | 8:ad8b64ca548d | 6 | |
DOREL | 8:ad8b64ca548d | 7 | //Defines |
DOREL | 8:ad8b64ca548d | 8 | |
DOREL | 8:ad8b64ca548d | 9 | #define BOUSSOLE_adress 0xC0 |
DOREL | 8:ad8b64ca548d | 10 | #define PIXY_adress 0x54 |
DOREL | 8:ad8b64ca548d | 11 | |
DOREL | 8:ad8b64ca548d | 12 | #define CC_BLOCSIZE 14 |
DOREL | 8:ad8b64ca548d | 13 | #define N_BLOCSIZE 12 |
DOREL | 8:ad8b64ca548d | 14 | |
DOREL | 8:ad8b64ca548d | 15 | #define N_BLOCCODE 0xAA55 |
DOREL | 8:ad8b64ca548d | 16 | #define CC_BLOCCODE 0xAA56 |
DOREL | 8:ad8b64ca548d | 17 | |
DOREL | 8:ad8b64ca548d | 18 | #define SPI_READ_NOP 0x0003 |
DOREL | 8:ad8b64ca548d | 19 | #define SPI_READ_ANGLE 0xFFFF |
DOREL | 8:ad8b64ca548d | 20 | #define SPI_READ_ERROR 0x8002 |
DOREL | 8:ad8b64ca548d | 21 | #define SPI_READ_SETTINGS1 0x1803 |
DOREL | 8:ad8b64ca548d | 22 | #define SPI_READ_SETTINGS2 0x8902 |
DOREL | 8:ad8b64ca548d | 23 | #define SPI_WRTIE_SETTINGS1 0x1800 |
DOREL | 8:ad8b64ca548d | 24 | #define SPI_WRITE_SETTINGS2 0x9801 |
DOREL | 8:ad8b64ca548d | 25 | |
DOREL | 8:ad8b64ca548d | 26 | //Defines automate |
DOREL | 8:ad8b64ca548d | 27 | |
DOREL | 8:ad8b64ca548d | 28 | #define START 0 |
DOREL | 8:ad8b64ca548d | 29 | #define SEEK_BALL 1 |
DOREL | 8:ad8b64ca548d | 30 | #define TURN_TO_BALL 2 |
DOREL | 8:ad8b64ca548d | 31 | #define GO_TO_BALL 3 |
DOREL | 8:ad8b64ca548d | 32 | #define CAPTURE_AND_TURN 4 |
DOREL | 8:ad8b64ca548d | 33 | #define WALL_CAPTURE_AND_TURN 5 |
DOREL | 8:ad8b64ca548d | 34 | #define RELEASE_CAPTURE 6 |
DOREL | 8:ad8b64ca548d | 35 | #define BALL_LAUNCHING 7 |
DOREL | 8:ad8b64ca548d | 36 | #define STOP_BALL_LAUNCHING 8 |
DOREL | 8:ad8b64ca548d | 37 | #define TURN_TO_BASE 9 |
DOREL | 8:ad8b64ca548d | 38 | #define RETURN 10 |
DOREL | 8:ad8b64ca548d | 39 | #define WALL_RETURN 11 |
DOREL | 8:ad8b64ca548d | 40 | #define STOP_RETURN 12 |
DOREL | 8:ad8b64ca548d | 41 | #define SEEK_ROTATION 13 |
DOREL | 8:ad8b64ca548d | 42 | |
DOREL | 8:ad8b64ca548d | 43 | //Typedef |
DOREL | 8:ad8b64ca548d | 44 | |
DOREL | 8:ad8b64ca548d | 45 | typedef unsigned char Byte; |
DOREL | 8:ad8b64ca548d | 46 | typedef unsigned short Word; |
DOREL | 8:ad8b64ca548d | 47 | typedef unsigned long lWord; |
DOREL | 8:ad8b64ca548d | 48 | |
DOREL | 8:ad8b64ca548d | 49 | typedef enum {S_monte = 1, S_descente = 0} T_SERVODIR; |
DOREL | 8:ad8b64ca548d | 50 | |
DOREL | 8:ad8b64ca548d | 51 | typedef enum {none, begin, normal, colorCode, doubleZero} T_pixyState; |
DOREL | 8:ad8b64ca548d | 52 | |
DOREL | 8:ad8b64ca548d | 53 | typedef union { |
DOREL | 8:ad8b64ca548d | 54 | lWord mot; |
DOREL | 8:ad8b64ca548d | 55 | Byte tab[4]; |
DOREL | 8:ad8b64ca548d | 56 | } T_tmpBuffer; |
DOREL | 8:ad8b64ca548d | 57 | |
DOREL | 8:ad8b64ca548d | 58 | typedef union { |
DOREL | 8:ad8b64ca548d | 59 | Word mot; |
DOREL | 8:ad8b64ca548d | 60 | Byte tab[2]; |
DOREL | 8:ad8b64ca548d | 61 | } T_structBuffer; |
DOREL | 8:ad8b64ca548d | 62 | |
DOREL | 8:ad8b64ca548d | 63 | typedef struct { |
DOREL | 8:ad8b64ca548d | 64 | Word checksum; |
DOREL | 8:ad8b64ca548d | 65 | Word signature; |
DOREL | 8:ad8b64ca548d | 66 | Word x; |
DOREL | 8:ad8b64ca548d | 67 | Word y; |
DOREL | 8:ad8b64ca548d | 68 | Word width; |
DOREL | 8:ad8b64ca548d | 69 | Word height; |
DOREL | 8:ad8b64ca548d | 70 | Word angle; |
DOREL | 8:ad8b64ca548d | 71 | } T_pixyCCBloc; |
DOREL | 8:ad8b64ca548d | 72 | |
DOREL | 8:ad8b64ca548d | 73 | typedef struct { |
DOREL | 8:ad8b64ca548d | 74 | Word checksum; |
DOREL | 8:ad8b64ca548d | 75 | Word signature; |
DOREL | 8:ad8b64ca548d | 76 | Word x; |
DOREL | 8:ad8b64ca548d | 77 | Word y; |
DOREL | 8:ad8b64ca548d | 78 | Word width; |
DOREL | 8:ad8b64ca548d | 79 | Word height; |
DOREL | 8:ad8b64ca548d | 80 | } T_pixyNMBloc; |
DOREL | 8:ad8b64ca548d | 81 | |
DOREL | 8:ad8b64ca548d | 82 | typedef union { |
DOREL | 8:ad8b64ca548d | 83 | Byte tab[14]; |
DOREL | 8:ad8b64ca548d | 84 | T_pixyCCBloc CCbloc; |
DOREL | 8:ad8b64ca548d | 85 | } T_pixyCCData; |
DOREL | 8:ad8b64ca548d | 86 | |
DOREL | 8:ad8b64ca548d | 87 | typedef union { |
DOREL | 8:ad8b64ca548d | 88 | Byte tab[12]; |
DOREL | 8:ad8b64ca548d | 89 | T_pixyNMBloc NMbloc; |
DOREL | 8:ad8b64ca548d | 90 | } T_pixyNMData; |