by cornz » Sat Aug 28, 2010 8:46 pm
Ok, doubt im even near but, ive looked in the .c file for the dimming firmware and ive found this bit
/**************************** DIMMER ****************************/
void dimmer_init(void) {
dimmer_on = eeprom_read_byte((uint8_t *)EE_DIMMER);
// Power for the photoresistor
DIMMER_POWER_DDR |= _BV(DIMMER_POWER_PIN);
DIMMER_POWER_PORT |= _BV(DIMMER_POWER_PIN);
ADCSRA |= _BV(ADPS2)| _BV(ADPS1); // Set ADC prescalar to 64 - 125KHz sample rate @ 8MHz F_CPU
ADMUX |= _BV(REFS0); // Set ADC reference to AVCC
ADMUX |= _BV(ADLAR); // Left adjust ADC result to allow easy 8 bit reading
ADMUX |= _BV(DIMMER_SENSE_PIN); // Set ADC input as ADC4 (PC4)
DIDR0 |= _BV(DIMMER_SENSE_PIND); // Disable the digital imput buffer on the sense pin to save power.
ADCSRA |= _BV(ADEN); // Enable ADC
ADCSRA |= _BV(ADIE); // Enable ADC interrupt
}
// Start ADC conversion for dimmer
void dimmer_update(void) {
if (dimmer_on)
ADCSRA |= _BV(ADSC);
}
// Update brightness once ADC measurement completes
SIGNAL(SIG_ADC) {
if (!dimmer_on || displaymode == SET_BRIGHTNESS)
return;
if (ADCH > DIMMER_THRESHOLD) { // bigger number means darker room
set_vfd_brightness(BRIGHTNESS_MIN);
} else {
set_vfd_brightness(brightness_level);
}
}
**********************************************************************
Now, i assume that this is the brightness control. I also suspect that this simply turns it on as there is no mention of a menu item.
So, can i just paste this into the gps code somewhere and then somehow convert it back into something i can program back into the chip???
Or, as i suspect, am i just miles of the mark??