mod c64key

General discussions about V-USB, our firmware-only implementation of a low speed USB device on Atmel's AVR microcontrollers
Post Reply
newbie7
Posts: 1
Joined: Mon Feb 18, 2013 7:38 pm

mod c64key

Post by newbie7 » Mon Feb 18, 2013 8:04 pm

hello everyone!

i'm making keyboard using v-usb. (row 16, col8)

generally source base c64key written row->col.
but my pcb design is col->row. that has few problem.


<main.c - c64key> : can't load data

Code: Select all

for (row = 0; row < NUMROWS; ++row) {
data = modmask[row & 7];
switch (row) {
   case 0x0 ... 0x7:
      DDRC  = 0x00;
      PORTC = 0xFF;
      // Scan on A
      DDRA = data;
      PORTA = ~data;

      break;
   case 0x8 ... 0xF:
      DDRA  = 0x00;
      PORTA = 0xFF;
      // Scan on C
      DDRC = data;
      PORTC = ~data;
      break;
}
_delay_us(30);
data = ~PINB;
}

...........................
   /* Process all rows for key-codes */
   for (row = 0; row < NUMROWS; ++row) {
      /* Anything on this row? - if not, skip it */
      if (0xFF == bitbuf[row]) { continue; }

      /* Restore buffer */
      data = bitbuf[row];

      for (col = 0, mask = 1; col < 8; ++col, mask <<= 1) {
         /* If no key detected, jump to the next column */
         if (data & mask) { continue; }

         /* Read keyboard map */
         key = pgm_read_byte(&keymap[row][col]);
         activeRows |= modmask[row];
         activeCols |= modmask[col];

}



take a look my source
<main.c - my mod> : can load data

Code: Select all

for (row = 0; row < NUMROWS; ++row) {
data = modmask[row & 7];
switch (row) {
   case 0x0 ... 0x7:
      DDRC  = 0x00;
      PORTC = 0xFF;

      // Scan on A
      DDRB = data;
      PORTB = ~data;
                _delay_us(30);
                data = ~PINA;
      break;
   case 0x8 ... 0xF:
      DDRA  = 0x00;
      PORTA = 0xFF;

      // Scan on C
      DDRB = data;
      PORTB = ~data;
                _delay_us(30);
                data = ~PINC;
      break;
       }
}
...................................
   /* Process all rows for key-codes */
   for (row = 0; row < NUMROWS; ++row) {
      /* Anything on this row? - if not, skip it */
      if (0xFF == bitbuf[row]) { continue; }

      /* Restore buffer */
      data = bitbuf[row];

      for (col = 0, mask = 1; col < 8; ++col, mask <<= 1) {
         /* If no key detected, jump to the next column */
         if (data & mask) { continue; }

         /* Read keyboard map */
         key = pgm_read_byte(&keymap[row][col]);
         activeRows |= modmask[row];
         activeCols |= modmask[col];

}




c64key source : can't load data.
my mod source : can load data but crazy matrix.

cuz c64key matrix design is row->col.


what should i do to solve?

Post Reply