Changeset 89e680d in avrstuff


Ignore:
Timestamp:
Jan 16, 2012, 9:55:19 PM (12 years ago)
Author:
Adrien Destugues <pulkomandy@…>
Branches:
main
Children:
ce05fdc
Parents:
3c17057
Message:

Add motor ON pin scanning

git-svn-id: svn://pulkomandy.tk/avrstuff@55 c6672c3c-f6b6-47f9-9001-1fd6b12fecbe

File:
1 edited

Legend:

Unmodified
Added
Removed
  • V-USB_Dev/firmwares/CrO2/main.c

    r3c17057 r89e680d  
    3434        bit = 1;
    3535        bitpos = 7;
    36         readPos = 0;
     36        readPos = 13;
    3737
    3838        // Generate sync header (this never changes)
     
    5050        // CTC mode with OCR1A as MAXregister
    5151        TCCR1B = (1<<WGM12);
    52         OCR1A = 13063; // 800us bit clock
    53         OCR1B = 6532; // Half-clock for 1 bits
     52        // "Official" values : 13063/6532 (closest to MO5 specified rate)
     53        // 9580 NOK
     54        // 9582 OK
     55        OCR1A = 9582; // 800us bit clock
     56        OCR1B = 4750; // Half-clock for 1 bits
    5457        TIMSK = (1 << OCIE1B) | (1 << OCIE1A); // interrupts on both timer matches.
    5558        TCCR1A |= (bit << FOC1A); // Force toggle of A (make sure output is a logic 1 to allow MO5 to detect tapedrive)
     
    7679        usbRequest_t *rq = (void *)data;
    7780
    78         usbMsgPtr = ioblock;
    7981        switch(rq->bRequest)
    8082        {
     
    8688                case 1:
    8789                        {  /* RECEIVE/POLL DATA (TAPE > USB) */
     90                                usbMsgPtr = ioblock;
    8891                                return 254;
    8992                        }
     
    107110                                        return USB_NO_MSG; // Call usbFunctionWrite to send the data
    108111                                }
     112                        }
     113                case 3:
     114                        {
     115                                // Read status
     116                                status = PINC;
     117                                usbMsgPtr = &status;
     118                                return 1;
    109119                        }
    110120        }
     
    153163                        // Stop generating (and interrupts)
    154164                        TCCR1B &= ~(1<<CS10);
    155                         readPos = 0;
     165                        readPos = 14;
    156166
    157167                        // make sure output is high step 2 : force a match.
Note: See TracChangeset for help on using the changeset viewer.