adding some docs, adding current software release of display servo

This commit is contained in:
Lucas Pleß 2014-05-27 22:15:00 +02:00
parent 09535d3dfd
commit 720ba155ad
4 changed files with 16 additions and 19 deletions

View File

@ -31,9 +31,7 @@ static void timer_init(void) {
} }
static void ports_init(void) { static void ports_init(void) {
DDRB |= _BV(PB3);
DDRB |= (1<<PB4)|(1<<PB3);
} }
static void process_command() { static void process_command() {
@ -85,29 +83,28 @@ static void work_uart() {
} }
} }
static void set_servo(uint8_t power) { static void set_servo(uint16_t display) {
uint8_t display = 0; display = display * 10; // shift, since we have to divide by 3,2 (32)
display = display / 32; // instead of dividing by 3,2
// display = power * 10; // shift, since we have to divide by 2,4 (24) display = display + 125;
// display = display / 24; // instead of dividing by 2,4
// display = display + 125;
display = power;
cli(); // read and write atomic
OCR1A = 2500-display; OCR1A = 2500-display;
sei();
} }
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< 40;i++) {
set_servo(i*10); set_servo(i*10);
wait(100); wait(5);
} }
for(uint8_t i = 10; i>= 0;i = i-1) { for(uint8_t i = 40; i> 0;i--) {
set_servo(i*5); set_servo(i*10);
wait(100); wait(5);
} }
} }
@ -121,15 +118,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);

Binary file not shown.

Binary file not shown.

Binary file not shown.