[ FORK ] I2S library for FRDM 64F, forked from p07gbar/I2S
Fork of I2S by
Revision 10:94430ea76fc4, committed 2016-03-29
- Comitter:
- k4zuki
- Date:
- Tue Mar 29 09:07:43 2016 +0000
- Parent:
- 8:b0e13a7e04eb
- Parent:
- 9:c045309c3929
- Commit message:
- merge
Changed in this revision
diff -r b0e13a7e04eb -r 94430ea76fc4 I2S.cpp --- a/I2S.cpp Tue Mar 29 18:01:54 2016 +0900 +++ b/I2S.cpp Tue Mar 29 09:07:43 2016 +0000 @@ -374,7 +374,7 @@ void I2S::mclk_freq(int freq) { mclk_frequency = 12288000; - write_registers(); +// write_registers(); } void I2S::frequency(int desired_freq) @@ -499,13 +499,19 @@ SIM_SCGC5 |= SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK; if (pin_setup_err == 0) { + + PORTC->PCR[8] &= PORT_PCR_MUX_MASK; + PORTC->PCR[8] |= PORT_PCR_MUX(0x04); // PTC8 I2S0_MCLK + if (_rxtx == I2S_TRANSMIT) { int val1 = 1; if (deallocating) { val1 = 0; } + PORTC->PCR[1] &= PORT_PCR_MUX_MASK; PORTC->PCR[1] |= PORT_PCR_MUX(0x04); // PTC1 I2S0_TXD0 + if (WordSelect_d == true) { PORTB->PCR[18] &= PORT_PCR_MUX_MASK; PORTB->PCR[18] |= PORT_PCR_MUX(0x04); // PTB18 I2S0_TX_BCLK @@ -558,7 +564,7 @@ { // output = input [(I2SFRAC+1) / (I2SDIV+1) ] = (48M* (32/125)) // SIM_CLKDIV2 |= SIM_CLKDIV2_I2SDIV(124) | SIM_CLKDIV2_I2SFRAC(31); - I2S0->MDR = I2S_MDR_FRACT(31) | I2S_MDR_DIVIDE(124); + I2S0->MDR = I2S_MDR_FRACT(63) | I2S_MDR_DIVIDE(624); } void I2S::_i2s_init(void) {