From b3d30ca742cf82c604d58f10c53fcd5a45d65e54 Mon Sep 17 00:00:00 2001 From: Paul Goeser Date: Sat, 14 Jan 2012 12:44:48 +0100 Subject: [PATCH] debugging, disabled a few things, ringbuffer and pwm working, sdcard timeouts in init --- gg.c | 33 ++++++++++++++++++++++++++++----- mmc.c | 14 +++++++++++++- mmc.h | 11 ++++------- 3 files changed, 45 insertions(+), 13 deletions(-) diff --git a/gg.c b/gg.c index 0908fe5..ca9a222 100644 --- a/gg.c +++ b/gg.c @@ -54,40 +54,63 @@ ISR(TIMER1_OVF1_vect){ // next try: simplistic, not too much looking at speed uint16_t next = 0; +// OCR1B += 1; // test pwm if(!--cnt_to_next){ ringbuf_get(&rb, &next); OCR1B = next>>8; cnt_to_ocr_incr = 8 - (next & 0x7); cnt_to_next = 8; - if(!--length) +/* if(!--length) { - /* shut down */ + // shut down PORTA &= ~(1 << PA7); - } + }*/ } else { if(!--cnt_to_ocr_incr){ OCR1B += 1; } } + } int main(void) __attribute__((noreturn)); int main(void) { + _delay_ms(30); // wait for card to get power + uint8_t debug=0; DDRA |= (1 << PA7); PORTA |= (1 << PA7); ringbuf_init(&rb, buffer, BUFFER_SIZE); - if(mmc_init() != 0) {/* mmc fail */;} + debug = 1; +// while(debug){ + debug=mmc_init(); +// } +// debug = 2; mmc_read_part(0, (unsigned char *) &length, 4); timer_init_tiny26(); sei(); +/* unsigned long block = 0; for(;; block++) { mmc_read_to_ringbuffer(block, &rb); - } + } // */ +// debug = 0; + + uint8_t i,r; + uint16_t a; + for(;;){ + i += debug*8; + a = i<<8; + r=1; + while(r){ + r=ringbuf_put(&rb, a); + } + }// */ + + } diff --git a/mmc.c b/mmc.c index 11e6808..6ebe22d 100644 --- a/mmc.c +++ b/mmc.c @@ -92,6 +92,17 @@ unsigned char mmc_init () return(0); } +//set MMC_Chip_Select to high (MMC/SD-Karte Inaktiv) +void MMC_Disable(){ + WAIT_HALF_CLOCK; MMC_Write|= (1<>= 1) //das Byte wird Bitweise nacheinander Gesendet MSB First { + MMC_Write &= ~(1<