Subversion Repositories FlightCtrl

Rev

Rev 440 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 440 Rev 453
Line 24... Line 24...
24
//############################################################################
24
//############################################################################
25
// Initialisierung
25
// Initialisierung
26
void init_MM3(void)
26
void init_MM3(void)
27
//############################################################################
27
//############################################################################
28
{
28
{
29
        SPCR = (1<<SPIE)|(1<<SPE)|(1<<MSTR)|(1<<SPR1);  //Interrupt an, Master, 625 kHz Oszillator
29
        SPCR = (1<<SPIE)|(1<<SPE)|(1<<MSTR)|(1<<SPR1)|(1<<SPR0);        //Interrupt an, Master, 156 kHz Oszillator
30
        SPSR = (1<<SPI2X);
30
        //SPSR = (1<<SPI2X);
Line 31... Line 31...
31
       
31
       
Line 32... Line 32...
32
    DDRB |= (1<<PB7)|(1<<PB5)|(1<<PB2); // J8, MOSI, SCK Ausgang
32
    DDRB |= (1<<PB7)|(1<<PB5)|(1<<PB2); // J8, MOSI, SCK Ausgang
Line 58... Line 58...
58
               
58
               
59
                if (MM3.AXIS == MM3_X) SPDR = 0x31;                     // Schreiben ins SPDR löst automatisch Übertragung (MOSI und MISO) aus
59
                if (MM3.AXIS == MM3_X) SPDR = 0x31;                     // Schreiben ins SPDR löst automatisch Übertragung (MOSI und MISO) aus
60
                else if (MM3.AXIS == MM3_Y) SPDR = 0x32;                // Micromag Period Select ist auf 256 (0x30)
60
                else if (MM3.AXIS == MM3_Y) SPDR = 0x32;                // Micromag Period Select ist auf 256 (0x30)
Line 61... Line 61...
61
                else if (MM3.AXIS == MM3_Z) SPDR = 0x33;                // 1: x-Achse, 2: Y-Achse, 3: Z-Achse
61
                else if (MM3.AXIS == MM3_Z) SPDR = 0x33;                // 1: x-Achse, 2: Y-Achse, 3: Z-Achse
62
               
62
               
63
                MM3.DRDY = SetDelay(5);         // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms)
63
                MM3.DRDY = SetDelay(8);         // Laut Datenblatt max. Zeit bis Messung fertig (bei PS 256 eigentlich 4 ms)
Line 64... Line 64...
64
                MM3.STATE = MM3_WAIT_DRDY;
64
                MM3.STATE = MM3_WAIT_DRDY;
65
                return;
65
                return;