Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: FXAS21002 TLV320 mbed sinelookup C12832 FXOS8700
Revision 16:2edf3d4ccbe3, committed 2017-07-04
- Comitter:
- k4zuki
- Date:
- Tue Jul 04 16:53:05 2017 +0000
- Parent:
- 15:f9f642239cb6
- Commit message:
- update frdm_i2s to make it more flexible over chip models
Changed in this revision
--- a/da7212dev.lib Fri Jun 09 17:01:20 2017 +0000 +++ b/da7212dev.lib Tue Jul 04 16:53:05 2017 +0000 @@ -1,1 +1,1 @@ -https://github.com/K4zuki/da7212dev/#9a1d42a3fbf74f7688a27161e914474e333188a5 +https://github.com/K4zuki/da7212dev/#b0614de5c301706e806a6f725c2d3e96308f0b28
--- a/frdm_i2s.lib Fri Jun 09 17:01:20 2017 +0000 +++ b/frdm_i2s.lib Tue Jul 04 16:53:05 2017 +0000 @@ -1,1 +1,1 @@ -https://github.com/K4zuki/frdm_i2s/#88b1a5ed7c4ba1eb320f52bd56ad2dfb8bc60a28 +https://github.com/K4zuki/frdm_i2s/#43a4384dfa00ac10afa3b5c771096f00aacbdb0d
--- a/main.cpp Fri Jun 09 17:01:20 2017 +0000
+++ b/main.cpp Tue Jul 04 16:53:05 2017 +0000
@@ -91,7 +91,7 @@
#include "sinelookup.h"
//DA7212 codec(I2C_SDA, I2C_SCL);
//TLV320 codec(I2C_SDA, I2C_SCL);
-FrdmI2s i2s(PTC1, PTE11, PTE12,TRANSMIT);
+FrdmI2s i2s(PTC6,PTC1, PTE11, PTE12,TRANSMIT);
uint16_t phase_l;
uint16_t phase_r;
@@ -107,7 +107,7 @@
void play(void)
{
- int to_write = i2s.max_fifo_points() - (i2s.fifo_points());
+ int to_write = i2s.get_fifo_limit() - (i2s.fifo_points());
for(int i = 0; i < to_write; i+=2) {
minibuf[i] = (int)sine16lookup[(SINE16LENGTH - 1) &( phase_l+skipper)];
minibuf[i+1] = (int)sine16lookup[(SINE16LENGTH - 1) & (phase_r+skipper)];
@@ -125,6 +125,8 @@
volume = pot2.read_u16() >> 10;
phase_l = 0;
phase_r = 512;
+ int to_write =0;
+ int irq=0;
// codec.power(true);
// codec.frequency(SAMPLERATE);
@@ -135,8 +137,8 @@
i2s.frequency(SAMPLERATE);
i2s.wordsize(16);
- i2s.stereomono(STEREO);
- i2s.role(MASTER);
+ i2s.stereomono(FrdmI2s::STEREO);
+ i2s.role(FrdmI2s::MASTER);
// i2s.attach(&play);
i2s.start();
@@ -153,8 +155,11 @@
// lcd.printf("Volume: %+03d", (volume - 57));
// lcd.locate(0,15);
// lcd.printf("Skipper: %04d", skipper);
- for(int j=0;j<8;j++){
- I2S0->TDR[0] = 0x5555AAAA;
+ irq = (I2S0->TCSR &I2S_TCSR_FEF_MASK) >> I2S_TCSR_FEF_SHIFT;
+ to_write = i2s.get_fifo_limit() - (i2s.fifo_level());
+ pc.printf("%d, %d\r",irq,to_write);
+ for(int j=0;j<to_write ;j++){
+ I2S0->TDR[0] = 0x55AA;
}
}
}