Skip to content

Commit

Permalink
fixed write offset issues for TAP writing (length is now correct)
Browse files Browse the repository at this point in the history
fixed port config for write pin
  • Loading branch information
sweetlilmre committed Jul 27, 2014
1 parent 90021f3 commit 3ef83f6
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
8 changes: 4 additions & 4 deletions config.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@
#define TAPE_READ_HIGH() TAPE_READ_PORT |= _BV(TAPE_READ_PIN)
#define TAPE_READ_TOGGLE() TAPE_READ_PINS |= _BV(TAPE_READ_PIN)

#define TAPE_WRITE_PORT PORTD
#define TAPE_WRITE_DDR DDRD
#define TAPE_WRITE_PINS PIND
#define TAPE_WRITE_PIN 2
#define TAPE_WRITE_PORT PORTB
#define TAPE_WRITE_DDR DDRB
#define TAPE_WRITE_PINS PINB
#define TAPE_WRITE_PIN 0

#define MOTOR_PORT PORTD
#define MOTOR_DDR DDRD
Expand Down
14 changes: 8 additions & 6 deletions tapuino.c
Original file line number Diff line number Diff line change
Expand Up @@ -353,14 +353,16 @@ void record_file() {
}

// write header
memset (g_fat_buffer, 0, sizeof(g_fat_buffer));
strcpy_P((char*)g_fat_buffer, S_TAP_MAGIC_C64);
tmp = strlen((char*)g_fat_buffer);
g_fat_buffer[tmp] = 0x01;
memset (g_fat_buffer, 0, sizeof(g_fat_buffer)); // clear it all out
strcpy_P((char*)g_fat_buffer, S_TAP_MAGIC_C64); // copy the magic to the buffer
tmp = strlen((char*)g_fat_buffer); // get to the end of the magic
g_fat_buffer[tmp] = 0x01; // set TAP format to 1
f_write(&g_fil, (void*)g_fat_buffer, 20, &br); // write out the header with zero length field
memset (g_fat_buffer, 0, sizeof(g_fat_buffer)); // clear it all out again for the read / write operation

g_write_index = 0;
g_read_index = 20; // Skip header
g_tap_file_pos = 20;
g_read_index = 0;
g_tap_file_pos = 0; // already written 20 bytes of header
g_signal_2nd_half = 0;
// set flag to indicate the start of recording
// let the recording routine know that this the first measurement is about to start
Expand Down

0 comments on commit 3ef83f6

Please sign in to comment.