Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void board_setFS(uint8_t fs)
- {
- //cli();
- uint16_t ratio = 0;
- RST_CS_PORT &= ~(1<<RST_CS_PIN); //CS8416 power down
- AD_RST_PORT &= ~(1<<AD_RST_PIN); //reset AD
- _delay_ms(50);
- switch(fs)
- {
- case 0b010: //44.1
- set_mck(0);
- set_pdur(1);
- ratio = 0;
- break;
- case 0b000:
- set_mck(1);
- set_pdur(1);
- ratio = 0;
- break;
- case 0b110:
- set_mck(0);
- set_pdur(1);
- ratio = 1;
- break;
- case 0b100:
- set_mck(1);
- set_pdur(1);
- ratio = 1;
- break;
- case 0b011:
- set_mck(0);
- set_pdur(0);
- ratio = 2;
- break;
- case 0b001: //192
- set_mck(1);
- set_pdur(0);
- ratio = 2;
- break;
- }
- _delay_ms(50);
- RST_CS_PORT |= (1<<RST_CS_PIN); //CS8416 power up
- AD_RST_PORT |= (1<<AD_RST_PIN);
- //nastavení AD1955 přes SPI
- ratio = (ratio << 8);
- spi_send(0x201, RIGHT);
- _delay_ms(1);
- spi_send((ratio | 0xC00), RIGHT);
- _delay_ms(1);
- spi_send(0x201, LEFT); //see datasheet of the AD1955
- _delay_ms(1);
- spi_send((ratio | 0x800), LEFT);
- _delay_ms(50);
- RE_MUTE_PORT |= (1<<RE_MUTE_PIN);
- _delay_ms(10);
- //sei();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement