Rev 264 | Rev 292 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 264 | Rev 268 | ||
---|---|---|---|
Line 75... | Line 75... | ||
75 | #define COMPASS_NCMAG 2 |
75 | #define COMPASS_NCMAG 2 |
76 | u8 Compass_Device = COMPASS_NONE; |
76 | u8 Compass_Device = COMPASS_NONE; |
Line 77... | Line 77... | ||
77 | 77 | ||
78 | void Compass_Init(void) |
78 | void Compass_Init(void) |
79 | { |
79 | { |
80 | Compass_Device = COMPASS_NONE; |
- | |
81 | UART1_PutString("\r\n Looking for compass"); |
- | |
82 | if(Version_HW > 11) |
80 | switch(Compass_Device) |
- | 81 | { |
|
- | 82 | case COMPASS_NONE: |
|
- | 83 | UART1_PutString("\r\n Looking for compass"); |
|
- | 84 | if(Version_HW > 11) |
|
83 | { |
85 | { |
84 | if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
86 | if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
85 | else if( MK3MAG_Init()) Compass_Device = COMPASS_MK3MAG; |
87 | else if( MK3MAG_Init()) Compass_Device = COMPASS_MK3MAG; |
86 | } |
88 | } |
87 | else |
89 | else |
88 | { |
90 | { |
89 | if( MK3MAG_Init() ) Compass_Device = COMPASS_MK3MAG; |
91 | if( MK3MAG_Init() ) Compass_Device = COMPASS_MK3MAG; |
90 | else if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
92 | else if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
- | 93 | } |
|
- | 94 | break; |
|
- | 95 | ||
- | 96 | case COMPASS_NCMAG: |
|
- | 97 | if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
|
- | 98 | else Compass_Device = COMPASS_NONE; |
|
Line -... | Line 99... | ||
- | 99 | break; |
|
- | 100 | ||
- | 101 | case COMPASS_MK3MAG: |
|
- | 102 | default: |
|
- | 103 | // nothing to do |
|
- | 104 | break; |
|
91 | } |
105 | |
92 | 106 | } |
|
Line 93... | Line 107... | ||
93 | fifo_init(&CompassCalcStateFiFo, CompassCalStateQueue, sizeof(CompassCalStateQueue), NO_ITLine, NO_ITLine); |
107 | fifo_init(&CompassCalcStateFiFo, CompassCalStateQueue, sizeof(CompassCalStateQueue), NO_ITLine, NO_ITLine); |