Vladimir N. Shilov 3 лет назад
Родитель
Сommit
061e9cd190
4 измененных файлов с 8 добавлено и 8 удалено
  1. 1 0
      Makefile
  2. 1 1
      SNC.cbp
  3. 1 1
      inc/common.h
  4. 5 6
      src/main.c

+ 1 - 0
Makefile

@@ -489,6 +489,7 @@ gccversion :
 
 
 # Program the device.
+flash: program
 program: $(BINDIR)/$(TARGET).hex $(BINDIR)/$(TARGET).eep
 	$(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM)
 

+ 1 - 1
SNC.cbp

@@ -58,7 +58,7 @@
 		<Compiler>
 			<Add option="-mmcu=atmega8" />
 			<Add option="-Wall" />
-			<Add option="-DF_CPU=16000000UL" />
+			<Add option="-DF_CPU=8000000UL" />
 			<Add directory="inc" />
 		</Compiler>
 		<Linker>

+ 1 - 1
inc/common.h

@@ -6,7 +6,7 @@
  * Global defines
  */
 #ifndef F_CPU
-  #define F_CPU               16000000
+  #define F_CPU               8000000
 #endif // F_CPU
 
 #define USE_BRIGHT_CONTROL  1

+ 5 - 6
src/main.c

@@ -25,14 +25,14 @@
 /* Timer2 settings */
 #if F_CPU == 16000000
   #define TIMER2_HZ         600
-  #define TIMER2_PRESCALER  256
+  #define TIMER2_PRESCALER  64
   #define TIMER2_CS         (1<<CS22 | 0<<CS21 | 0<<CS20)
 #elif F_CPU == 8000000
 //  #define TIMER2_PRESCALER  64
 //  #define TIMER2_CS         (0<<CS22 | 1<<CS21 | 1<<CS20)
-  #define TIMER2_HZ         300
-  #define TIMER2_PRESCALER  256
-  #define TIMER2_CS         (1<<CS22 | 0<<CS21 | 0<<CS20)
+  #define TIMER2_HZ         360
+  #define TIMER2_PRESCALER  128
+  #define TIMER2_CS         (1<<CS22 | 0<<CS21 | 1<<CS20)
 #endif // F_CPU
 #define TIMER2_CNT        (0x100 - (F_CPU / TIMER2_PRESCALER / TIMER2_HZ))
 
@@ -60,8 +60,7 @@ static const uint8_t PROGMEM brightConv[BRIGHT_IDX_MAX+1] = {
 #if F_CPU == 16000000
   155, 164, 181, 211, 255
 #elif F_CPU == 8000000
-//  54, 71, 106, 165, 255
-  155, 164, 181, 211, 255
+  117, 151, 185, 219, 255
 #endif // F_CPU
 };
 #endif // USE_BRIGHT_CONTROL