[tuxdroid-svn] r1112 - in firmware: tuxaudio/trunk tuxcore/trunk
Status: Beta
Brought to you by:
ks156
From: jaguarondi <c2m...@c2...> - 2008-05-06 09:54:17
|
Author: jaguarondi Date: 2008-05-06 11:54:21 +0200 (Tue, 06 May 2008) New Revision: 1112 Modified: firmware/tuxaudio/trunk/AT26F004.c firmware/tuxaudio/trunk/AT26F004.h firmware/tuxaudio/trunk/PC_communication.c firmware/tuxaudio/trunk/flash.c firmware/tuxaudio/trunk/i2c.h firmware/tuxcore/trunk/adc.c firmware/tuxcore/trunk/debug.h firmware/tuxcore/trunk/global.h firmware/tuxcore/trunk/hardware.h firmware/tuxcore/trunk/i2c.h firmware/tuxcore/trunk/ir.c firmware/tuxcore/trunk/main.c firmware/tuxcore/trunk/motors.c firmware/tuxcore/trunk/sensors.c Log: * Cleanup of spaces and tabs. Modified: firmware/tuxaudio/trunk/AT26F004.c =================================================================== --- firmware/tuxaudio/trunk/AT26F004.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxaudio/trunk/AT26F004.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -27,7 +27,7 @@ static void unprotect_sectors(void); /** * \ingroup at26f004 - * \brief initialize a table with the sector adresses values + * \brief initialize a table with the sector adresses values */ static uint8_t sector_adress[11][3] = { {SECTOR0}, @@ -44,10 +44,10 @@ }; /** - * \ingroup at26f004 + * \ingroup at26f004 \brief This function set the write enable flag of the flash memory. - */ + */ uint8_t read_status(void) { uint8_t status; @@ -59,10 +59,10 @@ return status; } /** - * \ingroup at26f004 + * \ingroup at26f004 \brief This function set the write enable flag of the flash memory. - */ + */ void write_enable(void) { flash_select(); @@ -70,10 +70,10 @@ flash_unselect(); } /** - * \ingroup at26f004 + * \ingroup at26f004 \brief This function clear the write enable flag of the flash memory. - */ + */ void write_disable(void) { flash_select(); @@ -82,10 +82,10 @@ } /** - * \ingroup at26f004 + * \ingroup at26f004 \brief This function write into the flash memory status register. - */ + */ void write_status(uint8_t const status) { flash_select(); @@ -94,13 +94,13 @@ flash_unselect(); } /** - * \ingroup at26f004 - \param ad2 high address part - \param ad1 medium adress part + * \ingroup at26f004 + \param ad2 high address part + \param ad1 medium adress part \param ad0 lower adress part \brief This function unprotect a sector. - */ + */ void unprotect_sector(uint8_t const ad2, uint8_t const ad1, uint8_t const ad0) { flash_select(); @@ -112,10 +112,10 @@ flash_unselect(); } /** - * \ingroup at26f004 + * \ingroup at26f004 \brief This function erase the entire memory. - */ + */ void erase_flash(void) { @@ -138,13 +138,13 @@ } } /** - * \ingroup at26f004 - \param ad2 high address part - \param ad1 medium adress part + * \ingroup at26f004 + \param ad2 high address part + \param ad1 medium adress part \param ad0 lower adress part \brief This function write a byte in the flash memory. - */ + */ void program_flash(uint8_t const ad2, uint8_t const ad1, uint8_t const ad0, uint8_t const data) { @@ -162,13 +162,13 @@ } /** - * \ingroup at26f004 - \param ad2 high address part - \param ad1 medium adress part + * \ingroup at26f004 + \param ad2 high address part + \param ad1 medium adress part \param ad0 lower adress part \return Data read \brief This function read a single byte in the flash memory. - */ + */ uint8_t read_data(uint8_t const ad2, uint8_t const ad1, uint8_t const ad0) { uint8_t data1; @@ -186,11 +186,11 @@ } /** - * \ingroup at26f004 - \param first_block The first block to erase + * \ingroup at26f004 + \param first_block The first block to erase \param last_block The last block to erase - \brief This function erase a specified area in the memory. The memory will be erased by 4kB's blocks. - */ + \brief This function erase a specified area in the memory. The memory will be erased by 4kB's blocks. + */ void blockErase(uint8_t first_block, uint8_t last_block) { uint8_t diff, ad0, ad1; Modified: firmware/tuxaudio/trunk/AT26F004.h =================================================================== --- firmware/tuxaudio/trunk/AT26F004.h 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxaudio/trunk/AT26F004.h 2008-05-06 09:54:21 UTC (rev 1112) @@ -44,43 +44,43 @@ /** * \name Read opcodes @{ */ -#define READ_ARRAY 0x0B +#define READ_ARRAY 0x0B #define READ_ARRAY_LOW_F 0x03 /* @} */ /** \name Erase opcodes *@{ */ -#define BLOCK_ERASE_4K 0x20 -#define BLOCK_ERASE_32K 0x52 -#define BLOCK_ERASE_64K 0xD8 -#define CHIP_ERASE 0x60 +#define BLOCK_ERASE_4K 0x20 +#define BLOCK_ERASE_32K 0x52 +#define BLOCK_ERASE_64K 0xD8 +#define CHIP_ERASE 0x60 /* @} */ /** \name Program opcodes * @{ */ -#define BYTE_PROGRAM 0x02 -#define SEQU_PROGRAM 0xAF +#define BYTE_PROGRAM 0x02 +#define SEQU_PROGRAM 0xAF /* @} */ /** \name Sectors managment opcodes * @{ */ -#define WRITE_EN 0x06 -#define WRITE_DIS 0x04 -#define PROTECT_SECTOR 0x36 +#define WRITE_EN 0x06 +#define WRITE_DIS 0x04 +#define PROTECT_SECTOR 0x36 #define UNPROTECT_SECTOR 0x39 #define READ_SECT_PROTECT 0x3C /* @} */ /** \name Status command * @{ */ -#define READ_STATUS_REG 0x05 +#define READ_STATUS_REG 0x05 #define WRITE_STATUS_REG 0x01 /* @} */ /** \name Misc. opcodes * @{ */ -#define READ_MANUFACT 0x9F -#define DEEP_POWER_MODE 0xB9 +#define READ_MANUFACT 0x9F +#define DEEP_POWER_MODE 0xB9 #define RESUME_DEEP_MODE 0xAB -#define NOP 0x00 +#define NOP 0x00 /* @} */ /** Modified: firmware/tuxaudio/trunk/PC_communication.c =================================================================== --- firmware/tuxaudio/trunk/PC_communication.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxaudio/trunk/PC_communication.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -118,7 +118,7 @@ { if (frame_without_sound) frame_without_sound --; - + else sound_played = 0; } Modified: firmware/tuxaudio/trunk/flash.c =================================================================== --- firmware/tuxaudio/trunk/flash.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxaudio/trunk/flash.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -45,12 +45,12 @@ /** - * \ingroup flash + * \ingroup flash \brief Read the number of sound in the flash memory. This function scan the sound's indexes, and return the number of sound stored in the flash memory. - */ + */ uint8_t readFlashNumber(void) { @@ -87,10 +87,10 @@ ad[1] = read_data(0x00, (index>>8), (index & 0xFF)); index ++; ad[2] = read_data(0x00, (index>>8), (index & 0xFF)); - return (ad[0] << 4) + (ad[1] >> 4); + return (ad[0] << 4) + (ad[1] >> 4); } /** - * \ingroup flash + * \ingroup flash \brief Store a sound in the memory. This function contain 5 states : @@ -108,7 +108,7 @@ \note Each sound starts at the first byte of a 4kB block. To do this, the lower address byte is reset, and the medium address byte is incremented. -*/ +*/ void programming(void) { @@ -150,12 +150,12 @@ { programming_state = PROG_END; send_status_p(STATUS_FLASH_PROG_CMD, FLASH_FULL, 0, 0); - } + } else programming_state ++; frame_without_sound = 5000; - frame_without_sound_timeout = 5000; + frame_without_sound_timeout = 5000; send_status_p(STATUS_FLASH_PROG_CMD, IN_PROGRESS, ad[0], ad[1]); } @@ -170,7 +170,7 @@ { if (flash_state) programming_sound(); - + else { write_disable(); @@ -186,7 +186,7 @@ programming_state = PROG_END; } } - } + } else if (programming_state == WAITING_STATE) { if (write_toc == 1) @@ -212,7 +212,7 @@ } write_toc = 0; } - else if (programming_state == PROG_TOC) + else if (programming_state == PROG_TOC) { send_status_p(STATUS_FLASH_PROG_CMD, WRITE_TOC, 0, 0); numSound ++; @@ -268,19 +268,19 @@ } /** - * \ingroup flash + * \ingroup flash \brief Erase the flash memory. - + The first step is to send the command to erase the flash. After, the status is polled while the erase process isn't finished. When the BUSY flag is null, the erase sequence is stopped. -*/ +*/ void erase(void) { uint8_t static enter = 1; if (enter) { - erase_flash(); + erase_flash(); enter = 0; } else if (!(read_status() & BUSY)) @@ -302,14 +302,14 @@ } /** - * \ingroup flash + * \ingroup flash \brief This function is used to play a sound from the flash memory. The first step (playInit) is to initialize the flash memory with the selected sound to play. Many tests are made to ensure that the sound to play exist, the indexes are correct, etc. The second step (playingSound) is to fill the fifo with the sound's bytes, and to verify the addresses. - */ + */ void playSound(void) @@ -322,7 +322,7 @@ /* Static functions */ /** - * \ingroup flash + * \ingroup flash \brief This function is used to init the memory to play a sound. \param nsound Track number to be played. @@ -333,7 +333,7 @@ If these conditions are respected, the memory is initialised with the first sound's byte address. The next index is stored to identify the end of the sound track. -*/ +*/ static void playInit(uint8_t const nsound) { @@ -407,7 +407,7 @@ } /* minimum index not respected */ if (ad[3] < ad[0]) { - flashPlay = 0; + flashPlay = 0; return; } /* check that the stop index is greater than the start index */ else if (ad[3] == ad[0]) @@ -440,12 +440,12 @@ /* Static functions */ /** - * \ingroup flash + * \ingroup flash \brief Read the flash memory and fill the fifo. This function reads bytes into the flash memory and fill the fifo. When the last byte is read, the sound play's sequence is stopped. - */ + */ static void playingSound(void) { @@ -482,10 +482,10 @@ /* Static functions */ /** - * \ingroup flash + * \ingroup flash \brief Stop the play sequence. - - */ + + */ static void stopPlaying(void) { soundToPlay = 0; @@ -496,14 +496,14 @@ } /** - * \ingroup flash - \brief Init the programming sequence - + * \ingroup flash + \brief Init the programming sequence + To perform a sequential programming, the first step is to send the correct OP code, and the three address bytes where the first data byte must be stored. - The second step is to send the OP code and a data to write. - - This function perform the first step. + The second step is to send the OP code and a data to write. + + This function perform the first step. */ static void init_programming(uint8_t adi0, uint8_t adi1, uint8_t adi2) { @@ -518,14 +518,14 @@ spiSend(data); else spiSend(0x80); - + flash_unselect(); // Chip Deselect } /** - * \ingroup flash - \brief Program the sound's data into the flash memory + * \ingroup flash + \brief Program the sound's data into the flash memory This function is executed while the SPI start command is not present. Each cycle, one byte is popped from the PWM fifo and stored in the sound flash. @@ -542,20 +542,20 @@ The sound_stored flag is set when at least one byte is stored in the memory. Else, this variable is null. - */ + */ static void programming_sound(void) { while (!spi_start) { - if (FifoLength(PWMFifo)) + if (FifoLength(PWMFifo)) { uint8_t data; sound_stored = 1; frame_without_sound = STOP_FRAME_NUMBER; frame_without_sound_timeout = STOP_FRAME_NUMBER; - flash_select(); + flash_select(); spiSend(SEQU_PROGRAM); FifoGet(PWMFifo, &data); spiSend(data); Modified: firmware/tuxaudio/trunk/i2c.h =================================================================== --- firmware/tuxaudio/trunk/i2c.h 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxaudio/trunk/i2c.h 2008-05-06 09:54:21 UTC (rev 1112) @@ -41,8 +41,8 @@ struct i2c_msg { uint8_t addr; /**> Slave address, the AVR only supports 7-bit address space. */ - uint8_t len; /**> Message length. */ - uint8_t *buf; /**> Pointer to msg data. */ + uint8_t len; /**> Message length. */ + uint8_t *buf; /**> Pointer to msg data. */ enum i2c_state state; }; Modified: firmware/tuxcore/trunk/adc.c =================================================================== --- firmware/tuxcore/trunk/adc.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/adc.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -82,7 +82,7 @@ \brief Start a conversion on the selected channel. \param ad_mux (ADMUX) Reference, format and channel selection. \ingroup adc - + ADC Multiplexer Selection Register - ADMUX Bit 7:6 - REFS1:0: Reference Selection Bits 0 0 AREF, Internal Vref turned off @@ -117,7 +117,7 @@ */ uint16_t ADC_read() { - union16_t adc_value; + union16_t adc_value; /* ADCH should be read after ADCL otherwise ADCL stays wite protected * (c.f. datasheet). */ adc_value.b[0] = ADCL; Modified: firmware/tuxcore/trunk/debug.h =================================================================== --- firmware/tuxcore/trunk/debug.h 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/debug.h 2008-05-06 09:54:21 UTC (rev 1112) @@ -17,7 +17,7 @@ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -/* $Id:$ */ +/* $Id$ */ /** * \defgroup debug Debugging aid Modified: firmware/tuxcore/trunk/global.h =================================================================== --- firmware/tuxcore/trunk/global.h 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/global.h 2008-05-06 09:54:21 UTC (rev 1112) @@ -104,7 +104,7 @@ */ /* gStatus.mot:[0] Spin motor - * xxxxxxx0 === Spin off + * xxxxxxx0 === Spin off * xxxxxxx1 === Spin on */ #define GSTATUS_MOT_SPIN 0x01 /* gStatus.mot:[1] Eyes/Mouth motor Modified: firmware/tuxcore/trunk/hardware.h =================================================================== --- firmware/tuxcore/trunk/hardware.h 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/hardware.h 2008-05-06 09:54:21 UTC (rev 1112) @@ -36,7 +36,7 @@ /** \ingroup hardware */ /*! @{ */ -/** +/** * \name Head button * The head button switch shortcuts to ground when pressed. * @{ */ @@ -50,7 +50,7 @@ #define SW_HD_MK _BV(PB5) /*! @} */ -/** +/** * \name Position switches * All position switches shortcuts to ground when pressed. * @@ -60,7 +60,7 @@ * position of the flippers. * - The eyes and mouth both have 2 switches to detect when they are open or * closed. The corresponding switch is pressed when a plain position is - * reached. In between, both switches are released. + * reached. In between, both switches are released. * @{ */ /** Spin switch mask. */ #define PSW_SPIN_MK _BV(PD3) @@ -104,7 +104,7 @@ #define PSW_EYES_MK (PSW_EYES_O_MK | PSW_EYES_C_MK) /*! @} */ -/** +/** * \name IR * - The IR led is controlled through a power driver. Setting the output pin * will turn the led on. @@ -127,7 +127,7 @@ #define IR_REC_MK _BV(PD2) /*! @} */ -/** +/** * \name Phototransistor * The Phototransistor is connected as an LDR to a 1MOhms resistor. A second * pull-up of 10kOhms can be added in parallel to change the load. The extra @@ -145,7 +145,7 @@ #define LIGHT_ADMUX 0x06 /*! @} */ -/** +/** * \name Charger inhibit * This pin inhibits the charge when set high. It shouldn't be left in high-z * otherwise the charge won't be stable. Keep it low. @@ -161,7 +161,7 @@ #define CHARGER_INH_MK _BV(PB6) /*! @} */ -/** +/** * \name LED * The leds are directly connected to the output pins through a 100 Ohms * resistor. @@ -180,7 +180,7 @@ #define LED_MK (LED_R_MK | LED_L_MK) /*! @} */ -/** +/** * \name External I/O * The external I/O is routed to the external connector which is accessible in * the battery compartment of tux. There's a 330 Ohms resistor in series to @@ -196,7 +196,7 @@ #define EXIO_MK _BV(PB7) /*! @} */ -/** +/** * \name Motors * The motor drivers use 2 pins to move forward or backward. Setting the first * pin to high will move forward, setting the other will turn backward. You @@ -260,7 +260,7 @@ #define MOT_SPIN_MK (MOT_SPIN_L_MK | MOT_SPIN_R_MK) /*! @} */ -/** +/** * \name Battery * The battery voltage can be measured on the pin ADC7 through a resistive * divider. Modified: firmware/tuxcore/trunk/i2c.h =================================================================== --- firmware/tuxcore/trunk/i2c.h 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/i2c.h 2008-05-06 09:54:21 UTC (rev 1112) @@ -43,8 +43,8 @@ struct i2c_msg { uint8_t addr; /**> Slave address, the AVR only supports 7-bit address space. */ - uint8_t len; /**> Message length. */ - uint8_t *buf; /**> Pointer to msg data. */ + uint8_t len; /**> Message length. */ + uint8_t *buf; /**> Pointer to msg data. */ }; extern void i2c_init(void); Modified: firmware/tuxcore/trunk/ir.c =================================================================== --- firmware/tuxcore/trunk/ir.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/ir.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -168,7 +168,7 @@ gStatus.ir = ((uint8_t)irReceivedCode & 0x3F); /* Check if the code comes from our remote control. */ if ((irReceivedCode & 0x07C0) == 0x0740) - gStatus.ir |= GSTATUS_IR_VALID; /* set valid bit */ + gStatus.ir |= GSTATUS_IR_VALID; /* set valid bit */ if (irReceivedCode & 0x0800) gStatus.ir |= GSTATUS_IR_TOGGLE; /* set toggle bit */ else Modified: firmware/tuxcore/trunk/main.c =================================================================== --- firmware/tuxcore/trunk/main.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/main.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -57,7 +57,7 @@ */ DBG_STACK_INIT -/** +/** * \name Software timers * The main tick has a period of 4ms and is driven by a hardware timer * interrupt. Counters are used to get 100ms and 1s ticks. Modified: firmware/tuxcore/trunk/motors.c =================================================================== --- firmware/tuxcore/trunk/motors.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/motors.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -31,7 +31,7 @@ #include "motors.h" #include "common/defines.h" /** - * \name Motors PWM + * \name Motors PWM * @{ */ uint8_t flippers_params_pwm = 5; uint8_t spin_params_pwm = 5; @@ -170,7 +170,7 @@ /*! @} */ /** - * \name Motors command parser + * \name Motors command parser * These functions parse the received command, and call the specific motor * function. * @{ */ @@ -184,7 +184,7 @@ void motors_run(uint8_t motor, uint8_t const value, uint8_t const param) { uint8_t cnt; - + if (motor == MOT_EYES) { if (param & 0x01) @@ -238,7 +238,7 @@ \brief Parse the MOTORS_SET_CMD to command a motor with a specific number of movements. \param motor The motor to command \param pwm The PWM value - + The PWM can be used only for the spinning and the flippers. */ void motors_config(uint8_t const motor, uint8_t const pwm) @@ -515,9 +515,9 @@ \brief Open the mouth. \ingroup mouth - This function open the mouth if it's not already open. + This function open the mouth if it's not already open. The command is sent only if the mouth is not open or if the motor is - running. + running. We don't know the absolute mouth position. So, a command is sent with 2 movements, and a flag is set to specify the final position. When the final position is reached, the mouth_move_counter is reinitialized, and the @@ -536,9 +536,9 @@ \brief Close the mouth. \ingroup mouth - This function close the mouth if it's not already closed. + This function close the mouth if it's not already closed. The command is sent only if the mouth is not closed or if the motor is - running. + running. We don't know the absolute mouth position. So, a command is sent with 2 movements, and a flag is set to specify the final position. When the final position is reached, the mouth_move_counter is reinitialized, and the @@ -705,7 +705,7 @@ if (gStatus.pos == 0) wave_flippers(1,5); else - flippers_move_counter = 2; + flippers_move_counter = 2; } /** @@ -723,7 +723,7 @@ if (gStatus.pos == 1) wave_flippers(1,5); else - flippers_move_counter = 2; + flippers_move_counter = 2; } /** Modified: firmware/tuxcore/trunk/sensors.c =================================================================== --- firmware/tuxcore/trunk/sensors.c 2008-05-06 09:53:54 UTC (rev 1111) +++ firmware/tuxcore/trunk/sensors.c 2008-05-06 09:54:21 UTC (rev 1112) @@ -50,7 +50,7 @@ To execute this function, the STATUS_SENT flag OR the ADC_READY flag must be set. The STATUS_SEND flag is set when the status are send to the PC. The ADC_READY flag is set when an interrupt on the ADC module occurs. - When the state machine is in the last state, it will be resetted and wait while the status are sent. If status are sent before the last state, the cycle continue. + When the state machine is in the last state, it will be resetted and wait while the status are sent. If status are sent before the last state, the cycle continue. */ void sensors_control(void) { @@ -67,7 +67,7 @@ light_control(ADC_read()); if (gStatus.mot) motorsStatus = 1; - + ADC_start(BATTERY_ADMUX); // XXX arg : ADMUX sensorsControlState ++; } @@ -75,7 +75,7 @@ { if (gStatus.mot) motorsStatus = 1; - battery_control(ADC_read()); + battery_control(ADC_read()); sensorsControlState = 0; } } |