I havn't read your full code but what I see about bitGet function
1. you can simplify it using << operator



unsigned char bitGet(unsigned char x, int bit)
{
unsigned char mask = 1 <<...