mp3.c
int mp3_init(void)
{
    // MP3 chip select, data select, chip reset
    DDRF  |= (1 << PF4) | (1 << PF1) | (1 << PF5);
    PORTF |= (1 << PF4) | (1 << PF1) | (1 << PF5);

    // All of the spi stuff is configured by the SD card,
    // so we don't need to do anything here.

    // Turn SPI frequency doubling off for this one communication
    SPSR &= ~(1 << SPI2X);

    // Turn up clock multiplier
    mp3_write(0x3, 0x9800);

    // Turn SPI frequency doubling back on, since the VS1003 now
    // has a clock multiplier enabled and can talk fast.
    SPSR |= (1 << SPI2X);

    // Check to make sure that this chip is the right one.
    const uint16_t version = (mp3_read(0x1) & 0xf0) >> 4;
    if (version != 3)
        return 0;

    mp3_write_volume();

    return 1;
}
// Initializes and checks mp3 player.  Returns 1 if successful, 0 otherwise.
Initializes and checks mp3 player.  Returns 1 if successful, 0 otherwise.
Initializes and checks mp3 player . Returns 1 if successful 0 otherwise .
int mp3_init(void)
{
    DDRF  |= (1 << PF4) | (1 << PF1) | (1 << PF5);
    PORTF |= (1 << PF4) | (1 << PF1) | (1 << PF5);
    SPSR &= ~(1 << SPI2X);
    mp3_write(0x3, 0x9800);
    SPSR |= (1 << SPI2X);
    const uint16_t version = (mp3_read(0x1) & 0xf0) >> 4;
    if (version != 3)
        return 0;
    mp3_write_volume();
    return 1;
}
int mp3_init ( void ) { DDRF |= ( 1 << PF4 ) | ( 1 << PF1 ) | ( 1 << PF5 ) ; PORTF |= ( 1 << PF4 ) | ( 1 << PF1 ) | ( 1 << PF5 ) ; SPSR &= ~ ( 1 << SPI2X ) ; mp3_write ( 0x3 , 0x9800 ) ; SPSR |= ( 1 << SPI2X ) ; const uint16_t version = ( mp3_read ( 0x1 ) & 0xf0 ) >> 4 ; if ( version != 3 ) return 0 ; mp3_write_volume ( ) ; return 1 ; }
Initializes and checks mp3 player.
Initializes and checks mp3 player .
// MP3 chip select, data select, chip reset // All of the spi stuff is configured by the SD card, // so we don't need to do anything here. // Turn SPI frequency doubling off for this one communication // Turn up clock multiplier // Turn SPI frequency doubling back on, since the VS1003 now // has a clock multiplier enabled and can talk fast. // Check to make sure that this chip is the right one.