It looks read_cols() is good.
You need to edit unselecte_rows() to make row pins(PB0-3,7) Hi-Z state. To make a pin Hi-Z, you need to unset correstpond bits of both DDR and PORT register, in this case DDRB and PORTB.
And select_row() need to be fixed. Use correct register names.
Then, At line 64 in matrix init() you need to configure all column pins as Input with pull-up.
You can access documentation of the controller here: http://www.atmel.com/devices/atmega32u4.aspx?tab=documents
At least you must have this datasheet in hand: http://www.atmel.com/Images/doc7766.pdf
See chapter 10 of the datasheet for control of I/O port. I'll try explain how to use I/O port here, If you can't got this plz feel free to refer to datasheet or use google
AVR I/O port is comprised of 8 pins and controlled with some 8bit registers. Some ports have less than 8 pins depending pin configurations of the chip, like PortC and PortF in ATMega32U4.
Pin name convention:
First pin of PortB is named as PB0, second as PB1, ... eighth as PB7.
You can use an I/O pin as either input or output line, first you must configure state of the pin, input or output before use. In fact AVR I/O pin can take four states: Hi-Z, Input with pull-up, Output Lo and Output High. You can decide I/O state per pin, so one port can have input pins and output at same time.
Input(Hi-Z), Input with pull-up, Output Lo, Output Hi
To control pin state you can use DDR*, PORT*, PIN* registers which comprised of 8bit correspond to pin number, where * is port name such like B, D, C or F.
Say you want to make PB2 Hi-Z state, then you should configure correstponding bit of DDRB and PORTB.
DDRB &= ~0b00000100; // clear bit
PORTB &= ~0b00000100; // clear bit
To make PB0-3 output lo and PB4-7 Hi-Z state
DDRB = 0b00001111;
PORTB = 0b00000000;
To know PB5 line logic(hi/lo) you should configure it input(with pull-up) then read PINB.
DDRB &= ~0b00100000; // clear bit
PORTB |= 0b00100000; // clear bit
if (PINB & 0b00100000) ... // read corresponding bit of PINB
Pin state configure:
State DDR PORT
Input(Hi-Z) 0 0
Input pull-up 0 1
Output Lo 1 0
Output Hi 1 1