[tuxdroid-svn] r515 - firmware/tuxaudio/branches/audio_cleanup
Status: Beta
Brought to you by:
ks156
From: Paul_R <c2m...@c2...> - 2007-09-12 12:39:38
|
Author: Paul_R Date: 2007-09-12 14:39:37 +0200 (Wed, 12 Sep 2007) New Revision: 515 Modified: firmware/tuxaudio/branches/audio_cleanup/main.c Log: * Cleanup main.c Modified: firmware/tuxaudio/branches/audio_cleanup/main.c =================================================================== --- firmware/tuxaudio/branches/audio_cleanup/main.c 2007-09-12 12:20:09 UTC (rev 514) +++ firmware/tuxaudio/branches/audio_cleanup/main.c 2007-09-12 12:39:37 UTC (rev 515) @@ -36,6 +36,11 @@ #include "config.h" #include "PC_communication.h" +/* XXX AT26F004.h must be included here read_data function is used in + * send_info(). + */ +#include "AT26F004.h" + /* * Version number */ @@ -43,13 +48,13 @@ #define CPU_NUMBER TUXAUDIO_CPU_NUM /* audio CPU */ const author_t author __attribute__ ((section("version.3"))) = { -AUTHOR_CMD, AUTHOR_ID, 0}; + AUTHOR_CMD, AUTHOR_ID, 0}; const revision_t svn_revision __attribute__ ((section("version.2"))) = { -REVISION_CMD, SVN_REV, SVN_STATUS}; + REVISION_CMD, SVN_REV, SVN_STATUS}; const version_t tag_version __attribute__ ((section("version.1"))) = { -VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; + VERSION_CMD, CPU_VER_JOIN(CPU_NUMBER, VER_MAJOR), VER_MINOR, VER_UPDATE}; static uint8_t info_flg = 0; /* indicates if version information should be sent */ static uint8_t pre_sleep_delay = 0; /* set when sleep should be entered */ @@ -183,7 +188,6 @@ i2cSlaveReceiveService(4, audioBuf); sei(); } - audioBufIdx = 0; /* clear buffer; this buffer can only hold one command so should be simply reset here */ } @@ -203,7 +207,6 @@ } else if (command[0] == STORE_INDEX_CMD) { - /* param: command[1] : lower address byte */ /* command[2] : middle address byte */ /* command[3] : higher address byte */ @@ -245,8 +248,6 @@ int main(void) { - - init_avr(); // Init AVR resetFifo(&PWMFifo); /* Initialise the PWM fifo */ @@ -277,8 +278,6 @@ { EIFR = (_BV(INT1) | _BV(INT0)); /* INT0, INT1 external interrupt flag */ EIMSK = (_BV(INT1) | _BV(INT0)); /* INT0, INT1 external interrupt request enable */ - /* EIFR= (_BV(INT1) | _BV(INT0)); [> INT0, INT1 external interrupt flag <] */ - /* EIMSK = (_BV(INT1)); [> INT0, INT1 external interrupt request enable <] */ } } @@ -296,14 +295,10 @@ } if (programmingFlash) // Restora all the context for flash programming - { flashProgramming(); - } if (flashPlay) - { playSound(); - } if (sendSensorsFlag) { @@ -338,8 +333,6 @@ DDRD &= ~0x02; } } - - sendCommands(); /* Send commands on I2C */ if (audioBufIdx) @@ -355,10 +348,16 @@ } } +// External Interrupt 0 service routine PD2 +ISR(SIG_INTERRUPT0) +{ + spi_start = 1; +} + // External Interrupt 1 service routine PD3 ISR(SIG_INTERRUPT1) { - spi_ready = 1; // Set the flag SPI ready from RF + spi_ready = 1; } /* @@ -419,13 +418,7 @@ //OCR0A = 250; // Normal operation for ADC sampling if FIFO Adaptative is on } } - if (--sendSensorsCmpt == 0) + if (--sendSensorsCmpt == 0) sendSensorsFlag = 1; /* send status to the behavioural CPU, 8KHz divided by 256 lead to a status sent each 32ms */ } } - -// External Interrupt 0 service routine PD2 -ISR(SIG_INTERRUPT0) -{ - spi_start = 1; -} |