I can't find the definition for the cor_canalX objects but if you had them in an array the desenhar_barras_periodo() function could be reduced to something like this
void desenhar_barras_periodo () {
int x = (setor_selecionado * 38)+5;
int y = (setor_selecionado * 38)+39
for (int i = 1; i < 5; i++) {
if (bitRead(cor_selecionada,i) == true) {
myGLCD.setColor(cor_canals[i][0], cor_canals[i][1],cor_canals[i][2]);
myGLCD.drawRect(x, 80, y, 195);
desenhar_barras(cor_canals[i][0], cor_canals[i][1], cor_canals[i][2], x, 80, y, 195);
}
}
}
Rob