
Dialog DA7212 evaluating project DEVELOP branch
Dependencies: FXAS21002 TLV320 mbed sinelookup C12832 FXOS8700
Revision 9:fe61a56fa5a9, committed 2016-03-25
- Comitter:
- k4zuki
- Date:
- Fri Mar 25 11:41:34 2016 +0000
- Parent:
- 8:42093f0e5d9e
- Child:
- 10:31c65ba8b7ea
- Commit message:
- internal register access not working orz
Changed in this revision
--- a/DA7212dev.lib Fri Mar 25 16:09:13 2016 +0900 +++ b/DA7212dev.lib Fri Mar 25 11:41:34 2016 +0000 @@ -1,1 +1,1 @@ -http://developer.mbed.org/users/k4zuki/code/DA7212dev/#30c558de9e08 +http://developer.mbed.org/users/k4zuki/code/DA7212dev/#86077ebd05dd
--- a/I2S.lib Fri Mar 25 16:09:13 2016 +0900 +++ b/I2S.lib Fri Mar 25 11:41:34 2016 +0000 @@ -1,1 +1,1 @@ -https://developer.mbed.org/users/k4zuki/code/I2S/#19e26fafc029 +https://developer.mbed.org/users/k4zuki/code/I2S/#d2062a747673
--- a/main.cpp Fri Mar 25 16:09:13 2016 +0900 +++ b/main.cpp Fri Mar 25 11:41:34 2016 +0000 @@ -6,7 +6,7 @@ #include "sinelookup.h" // #include "TLV320.h" // #include "DA7212.h" -// #include "I2S.h" +#include "I2S.h" // #include "C12832.h" // C12832 lcd(D11, D13, D12, D7, D10); @@ -18,53 +18,63 @@ #define SAMPLERATE 32000 -/* //DA7212 codec(I2C_SDA, I2C_SCL); -TLV320 codec(I2C_SDA, I2C_SCL); -I2S i2s(I2S_TRANSMIT, PTC1, PTB19, PTB18); - -AnalogIn aIn(p19); -AnalogIn vol(p20); - -float phase_l; -float phase_r; -int minibuf[16]; -float skipper; -float volume; -float phase_kill; - - -extern "C" void HardFault_Handler() -{ - error("Hard Fault!\n"); -} - +//TLV320 codec(I2C_SDA, I2C_SCL); +//I2S i2s(I2S_TRANSMIT, PTC1, PTB19, PTB18); -void play(void) -{ - int to_write = i2s.max_fifo_points() - (i2s.fifo_points()); - for(int i = 0; i < to_write; i+=2) { - minibuf[i] = int(float(sine16lookup[int(phase_l)])*volume); - //minibuf[i] = int(sine16lookup[int(phase_l)]); - minibuf[i+1] = int(float(sine16lookup[int(phase_r)])*volume); - phase_l+=skipper; - phase_r = phase_l + phase_kill; - while(phase_l >= SINE16LENGTH) { - phase_l -= SINE16LENGTH; - } - - while(phase_r >= SINE16LENGTH) { - phase_r -= SINE16LENGTH; - } - while(phase_r< 0) phase_r += SINE16LENGTH; - } - i2s.write(minibuf, to_write); -} -*/ +//AnalogIn aIn(p19); +//AnalogIn vol(p20); +// +//float phase_l; +//float phase_r; +//int minibuf[16]; +//float skipper; +//float volume; +//float phase_kill; +// +// +//extern "C" void HardFault_Handler() +//{ +// error("Hard Fault!\n"); +//} +// +// +//void play(void) +//{ +// int to_write = i2s.max_fifo_points() - (i2s.fifo_points()); +// for(int i = 0; i < to_write; i+=2) { +// minibuf[i] = int(float(sine16lookup[int(phase_l)])*volume); +// //minibuf[i] = int(sine16lookup[int(phase_l)]); +// minibuf[i+1] = int(float(sine16lookup[int(phase_r)])*volume); +// phase_l+=skipper; +// phase_r = phase_l + phase_kill; +// while(phase_l >= SINE16LENGTH) { +// phase_l -= SINE16LENGTH; +// } +// +// while(phase_r >= SINE16LENGTH) { +// phase_r -= SINE16LENGTH; +// } +// while(phase_r< 0) phase_r += SINE16LENGTH; +// } +// i2s.write(minibuf, to_write); +//} +Serial pc(USBTX,USBRX); +#define _I2S0_TCSR (*((uint32_t*)0x4002F000u)) /* main */ int main() { - I2S0_TCSR |= 1u<<31; + pc.baud(115200); + pc.printf("printf\n\r"); + uint32_t hoge = 0; + pc.printf("hoge = 0x%08X\n\r",hoge); + pc.printf("hoge = "); + hoge = (*((uint32_t*)(0x4002F000))); + pc.printf("0x%08X\n\r",hoge); +// (((I2S_Type *)0x4002F000u)->TCSR); +// pc.printf("&I2S0_TCSR = %08X\n\r",hoge); +// ((I2S0_TCSR)) |= 1u<<31; +// pc.printf("&I2S0_TCSR = %08X\n\r",I2S0_TCSR); // skipper = (aIn*49)+1; // // codec.power(true); @@ -74,14 +84,16 @@ // codec.headphone_volume(0.5); // codec.start(); // - i2s.frequency(SAMPLERATE); - // i2s.wordsize(16); - // i2s.stereomono(I2S_STEREO); - // i2s.masterslave(I2S_MASTER); - // i2s.attach(&play); - // i2s.start(); +// i2s.frequency(SAMPLERATE); +// i2s.wordsize(16); +// i2s.stereomono(I2S_STEREO); +// i2s.masterslave(I2S_MASTER); +// i2s.attach(&play); +// i2s.start(); while(1) - {; + { + pc.printf("."); + wait_ms(500); // skipper = (aIn*30)+1; // // volume = 1;