# CONFIG_MCU_AT90S2343 is not set
# CONFIG_MCU_ATTINY22 is not set
# CONFIG_MCU_ATTINY26 is not set
+# CONFIG_MCU_ATTINY45 is not set
# CONFIG_MCU_AT90S4414 is not set
# CONFIG_MCU_AT90S4433 is not set
# CONFIG_MCU_AT90S4434 is not set
# CONFIG_MCU_ATMEGA32 is not set
# CONFIG_MCU_ATMEGA323 is not set
# CONFIG_MCU_ATMEGA325 is not set
+# CONFIG_MCU_ATMEGA328P is not set
# CONFIG_MCU_ATMEGA3250 is not set
-CONFIG_MCU_ATMEGA328P=y
# CONFIG_MCU_ATMEGA64 is not set
# CONFIG_MCU_ATMEGA645 is not set
# CONFIG_MCU_ATMEGA6450 is not set
# CONFIG_MCU_AT90S1200 is not set
# CONFIG_MCU_ATMEGA2560 is not set
# CONFIG_MCU_ATMEGA256 is not set
+# CONFIG_MCU_ATXMEGA128A1 is not set
+CONFIG_MCU_ATMEGA168P=y
+# CONFIG_MCU_ATMEGA1284P is not set
CONFIG_QUARTZ=8000000
#
#
# Communication modules
#
-# CONFIG_MODULE_LUFA is not set
# CONFIG_MODULE_UART is not set
# CONFIG_MODULE_UART_9BITS is not set
# CONFIG_MODULE_UART_CREATE_CONFIG is not set
# CONFIG_AVRDUDE_PROG_PAVR is not set
# CONFIG_AVRDUDE_PROG_BUTTERFLY is not set
# CONFIG_AVRDUDE_PROG_AVR910 is not set
+# CONFIG_AVRDUDE_PROG_AVR911 is not set
# CONFIG_AVRDUDE_PROG_STK500 is not set
-# CONFIG_AVRDUDE_PROG_STK500V1 is not set
-CONFIG_AVRDUDE_PROG_ARDUINO=y
# CONFIG_AVRDUDE_PROG_AVRISP is not set
# CONFIG_AVRDUDE_PROG_BSD is not set
# CONFIG_AVRDUDE_PROG_DAPA is not set
# CONFIG_AVRDUDE_PROG_JTAG1 is not set
# CONFIG_AVRDUDE_PROG_AVR109 is not set
-CONFIG_AVRDUDE_PORT="/dev/ttyUSB0"
-CONFIG_AVRDUDE_BAUDRATE=57600
+CONFIG_AVRDUDE_PROG_AVRISPMKII=y
+# CONFIG_AVRDUDE_PROG_ARDUINO is not set
+CONFIG_AVRDUDE_PORT="usb"
+CONFIG_AVRDUDE_BAUDRATE=19200
#
# Avarice
#include <aversive.h>
+#include <aversive/wait.h>
struct servo {
uint8_t bit;
};
static struct servo servo_table[] = {
+ {
+ .bit = 2,
+ .command = 300,
+ },
{
.bit = 3,
- .command = 0,
+ .command = 700,
},
{
.bit = 4,
#define BYPASS_ENABLE 14
#define BYPASS_DISABLE 15
+#define LED_ON() do { PORTB |= 0x02; } while(0)
+#define LED_OFF() do { PORTB &= ~0x02; } while(0)
+
/*
* SPI protocol:
*
uint8_t t, diff;
/* LED */
- DDRB = 0x20;
+ DDRB = 0x02;
+
+#if 0 /* LED debug */
+ while (1) {
+ LED_ON();
+ wait_ms(100);
+ LED_OFF();
+ wait_ms(100);
+ }
+#endif
- /* servo outputs */
- DDRD = 0xf8;
- DDRB |= 0x01;
+ /* servo outputs PD2-PD7 */
+ DDRD = 0xfc;
/* start timer1 at clk/1 (8Mhz) */
TCNT1 = 0;
sei();
- bypass = 1;
+ bypass = 0;
while (1) {
t = TCNT0;
for (i = 0; i < NB_SERVO; i++) {
}
/* bypass mode */
while (bypass == 1) {
- PORTD = ((PINC & 0x0f) << 3) | ((PINB & 0x01) << 7);
+ LED_ON();
+ PORTD = (PINC & 0x3f) << 2;
poll_spi();
}
+ LED_OFF();
}
return 0;