fixing merge

This commit is contained in:
Lucas Pleß 2014-05-20 14:54:11 +02:00
commit a358089379
2 changed files with 16 additions and 13 deletions

View File

@ -75,7 +75,7 @@ LDFLAGS = -Wl,-Map=$(TARGET).map,--cref
# Programming support using avrdude. Settings and variables. # Programming support using avrdude. Settings and variables.
AVRDUDE_PROGRAMMER = usbasp AVRDUDE_PROGRAMMER = usbtiny
AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex
#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep #AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep

View File

@ -32,6 +32,8 @@ static void timer_init(void) {
static void ports_init(void) { static void ports_init(void) {
DDRB |= (1<<PB4)|(1<<PB3);
} }
static void process_command() { static void process_command() {
@ -87,24 +89,25 @@ static void set_servo(uint8_t power) {
uint8_t display = 0; uint8_t display = 0;
display = power * 10; // shift, since we have to divide by 2,4 (24) // display = power * 10; // shift, since we have to divide by 2,4 (24)
display = display / 24; // instead of dividing by 2,4 // display = display / 24; // instead of dividing by 2,4
display = display + 125; // display = display + 125;
display = power;
OCR1A = 2500-display; OCR1A = 2500-display;
} }
static void demo_display(void) { static void demo_display(void) {
for(uint8_t i = 0; i< 30;i = i+1) {
for(uint8_t i = 0; i< 30;i++) {
set_servo(i*10); set_servo(i*10);
wait(50); wait(100);
} }
for(uint8_t i = 30; i> 0;i--) { for(uint8_t i = 10; i>= 0;i = i-1) {
set_servo(i*10); set_servo(i*5);
wait(50); wait(100);
} }
} }
@ -118,15 +121,15 @@ int main(void) {
demo_display(); demo_display();
while(1) { // while(1) {
work_uart(); // work_uart();
if(syscounter >= 10) { if(syscounter >= 10) {
uart_putc('a'); // send a to receive values uart_putc('a'); // send a to receive values
set_servo(power_gen); set_servo(power_gen);
syscounter = 0; syscounter = 0;
} //}
} }
return(0); return(0);