Rev 264 | Rev 292 | Go to most recent revision | Show entire file | Regard 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 | { |
|
- | 80 | switch(Compass_Device) |
|
79 | { |
81 | { |
80 | Compass_Device = COMPASS_NONE; |
82 | case COMPASS_NONE: |
81 | UART1_PutString("\r\n Looking for compass"); |
83 | UART1_PutString("\r\n Looking for compass"); |
82 | if(Version_HW > 11) |
84 | if(Version_HW > 11) |
83 | { |
85 | { |
84 | if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
86 | if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
Line 87... | Line 89... | ||
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; |
91 | } |
93 | } |
- | 94 | break; |
|
- | 95 | ||
- | 96 | case COMPASS_NCMAG: |
|
- | 97 | if( NCMAG_Init() ) Compass_Device = COMPASS_NCMAG; |
|
- | 98 | else Compass_Device = COMPASS_NONE; |
|
- | 99 | break; |
|
Line -... | Line 100... | ||
- | 100 | ||
- | 101 | case COMPASS_MK3MAG: |
|
- | 102 | default: |
|
- | 103 | // nothing to do |
|
- | 104 | break; |
|
- | 105 | ||
92 | 106 | } |
|
93 | fifo_init(&CompassCalcStateFiFo, CompassCalStateQueue, sizeof(CompassCalStateQueue), NO_ITLine, NO_ITLine); |
107 | fifo_init(&CompassCalcStateFiFo, CompassCalStateQueue, sizeof(CompassCalStateQueue), NO_ITLine, NO_ITLine); |
Line 94... | Line 108... | ||
94 | } |
108 | } |