git.droids-corp.org
/
aversive.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
cobboard
[aversive.git]
/
projects
/
microb2010
/
cobboard
/
main.c
diff --git
a/projects/microb2010/cobboard/main.c
b/projects/microb2010/cobboard/main.c
index
418f5e1
..
62103c8
100755
(executable)
--- a/
projects/microb2010/cobboard/main.c
+++ b/
projects/microb2010/cobboard/main.c
@@
-1,7
+1,7
@@
-/*
+/*
* Copyright Droids Corporation
* Olivier Matz <zer0@droids-corp.org>
* Copyright Droids Corporation
* Olivier Matz <zer0@droids-corp.org>
- *
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
@@
-57,14
+57,15
@@
#include "sensor.h"
#include "state.h"
#include "actuator.h"
#include "sensor.h"
#include "state.h"
#include "actuator.h"
-#include "arm_xy.h"
+#include "spickle.h"
+#include "shovel.h"
#include "cs.h"
#include "i2c_protocol.h"
/* 0 means "programmed"
* ---- with 16 Mhz quartz
* CKSEL 3-0 : 0111
#include "cs.h"
#include "i2c_protocol.h"
/* 0 means "programmed"
* ---- with 16 Mhz quartz
* CKSEL 3-0 : 0111
- * SUT 1-0 : 10
+ * SUT 1-0 : 10
* CKDIV8 : 1
* ---- bootloader
* BOOTZ 1-0 : 01 (4K bootloader)
* CKDIV8 : 1
* ---- bootloader
* BOOTZ 1-0 : 01 (4K bootloader)
@@
-108,7
+109,7
@@
void bootloader(void)
__asm__ __volatile__ ("ldi r31,0xf8\n");
__asm__ __volatile__ ("ldi r30,0x00\n");
__asm__ __volatile__ ("eijmp\n");
__asm__ __volatile__ ("ldi r31,0xf8\n");
__asm__ __volatile__ ("ldi r30,0x00\n");
__asm__ __volatile__ ("eijmp\n");
-
+
/* never returns */
}
/* never returns */
}
@@
-121,7
+122,7
@@
void do_led_blink(__attribute__((unused)) void *dummy)
LED1_ON();
else
LED1_OFF();
LED1_ON();
else
LED1_OFF();
-
+
a = !a;
#endif
}
a = !a;
#endif
}
@@
-182,6
+183,8
@@
int main(void)
error_register_notice(mylog);
error_register_debug(mylog);
error_register_notice(mylog);
error_register_debug(mylog);
+ wait_ms(3000);
+
/* SPI + ENCODERS */
encoders_spi_init(); /* this will also init spi hardware */
/* SPI + ENCODERS */
encoders_spi_init(); /* this will also init spi hardware */
@@
-195,17
+198,16
@@
int main(void)
timer0_register_OV_intr(main_timer_interrupt);
/* PWM */
timer0_register_OV_intr(main_timer_interrupt);
/* PWM */
- PWM_NG_TIMER_16BITS_INIT(1, TIMER_16_MODE_PWM_10,
+ PWM_NG_TIMER_16BITS_INIT(1, TIMER_16_MODE_PWM_10,
TIMER1_PRESCALER_DIV_1);
TIMER1_PRESCALER_DIV_1);
- PWM_NG_TIMER_16BITS_INIT(4, TIMER_16_MODE_PWM_10,
+ PWM_NG_TIMER_16BITS_INIT(4, TIMER_16_MODE_PWM_10,
TIMER4_PRESCALER_DIV_1);
TIMER4_PRESCALER_DIV_1);
-
- PWM_NG_INIT16(&gen.pwm1_4A, 4, A, 10, PWM_NG_MODE_SIGNED
,
- &PORTD, 4);
+
+ PWM_NG_INIT16(&gen.pwm1_4A, 4, A, 10, PWM_NG_MODE_SIGNED
|
+
PWM_NG_MODE_SIGN_INVERTED,
&PORTD, 4);
PWM_NG_INIT16(&gen.pwm2_4B, 4, B, 10, PWM_NG_MODE_SIGNED,
&PORTD, 5);
PWM_NG_INIT16(&gen.pwm2_4B, 4, B, 10, PWM_NG_MODE_SIGNED,
&PORTD, 5);
- PWM_NG_INIT16(&gen.pwm3_1A, 1, A, 10, PWM_NG_MODE_SIGNED |
- PWM_NG_MODE_SIGN_INVERTED,
+ PWM_NG_INIT16(&gen.pwm3_1A, 1, A, 10, PWM_NG_MODE_SIGNED,
&PORTD, 6);
PWM_NG_INIT16(&gen.pwm4_1B, 1, B, 10, PWM_NG_MODE_SIGNED |
PWM_NG_MODE_SIGN_INVERTED,
&PORTD, 6);
PWM_NG_INIT16(&gen.pwm4_1B, 1, B, 10, PWM_NG_MODE_SIGNED |
PWM_NG_MODE_SIGN_INVERTED,
@@
-213,11
+215,11
@@
int main(void)
/* servos */
/* servos */
- PWM_NG_TIMER_16BITS_INIT(3, TIMER_16_MODE_PWM_10,
+ PWM_NG_TIMER_16BITS_INIT(3, TIMER_16_MODE_PWM_10,
TIMER1_PRESCALER_DIV_256);
PWM_NG_INIT16(&gen.servo1, 3, C, 10, PWM_NG_MODE_NORMAL,
NULL, 0);
TIMER1_PRESCALER_DIV_256);
PWM_NG_INIT16(&gen.servo1, 3, C, 10, PWM_NG_MODE_NORMAL,
NULL, 0);
- PWM_NG_TIMER_16BITS_INIT(5, TIMER_16_MODE_PWM_10,
+ PWM_NG_TIMER_16BITS_INIT(5, TIMER_16_MODE_PWM_10,
TIMER1_PRESCALER_DIV_256);
PWM_NG_INIT16(&gen.servo2, 5, A, 10, PWM_NG_MODE_NORMAL,
NULL, 0);
TIMER1_PRESCALER_DIV_256);
PWM_NG_INIT16(&gen.servo2, 5, A, 10, PWM_NG_MODE_NORMAL,
NULL, 0);
@@
-225,12
+227,12
@@
int main(void)
NULL, 0);
PWM_NG_INIT16(&gen.servo4, 5, C, 10, PWM_NG_MODE_NORMAL,
NULL, 0);
NULL, 0);
PWM_NG_INIT16(&gen.servo4, 5, C, 10, PWM_NG_MODE_NORMAL,
NULL, 0);
-
+
/* SCHEDULER */
scheduler_init();
/* SCHEDULER */
scheduler_init();
- scheduler_add_periodical_event_priority(do_led_blink, NULL,
- 100000L / SCHEDULER_UNIT,
+ scheduler_add_periodical_event_priority(do_led_blink, NULL,
+ 100000L / SCHEDULER_UNIT,
LED_PRIO);
/* all cs management */
microb_cs_init();
LED_PRIO);
/* all cs management */
microb_cs_init();
@@
-246,9
+248,13
@@
int main(void)
sei();
sei();
- /*
finger + other
actuators */
+ /* actuators */
actuator_init();
actuator_init();
+ /* spickle, shovel */
+ spickle_init();
+ shovel_init();
+
state_init();
printf_P(PSTR("\r\n"));
state_init();
printf_P(PSTR("\r\n"));
@@
-259,7
+265,7
@@
int main(void)
gen.log_level = 5;
cobboard.flags |= DO_CS;
gen.log_level = 5;
cobboard.flags |= DO_CS;
- state_machine();
+ state_machine();
cmdline_interact();
return 0;
cmdline_interact();
return 0;