KIK 01 Prototype 05
Dependencies: AverageMCP3008 mbed-rtos mbed mcp3008
Fork of KIK01_Proto03 by
Diff: main.cpp
- Revision:
- 16:30cb822e072f
- Parent:
- 15:8f674acdac03
- Child:
- 17:a5d9908bd456
--- a/main.cpp Thu Jul 06 05:15:17 2017 +0000 +++ b/main.cpp Thu Jul 06 07:20:41 2017 +0000 @@ -20,7 +20,7 @@ #define TITLE_STR2 ("20170704") #define PI_F (3.1415926f) -#define SAMPLING_RATE (16000) +#define SAMPLING_RATE (48000) #define SAMPLING_PERIOD (1.0f/SAMPLING_RATE) #define ENVELOPE_UPDATE_RATE SAMPLING_RATE @@ -28,11 +28,12 @@ AnalogOut Dac1(PA_4); -SPI SpiM(SPI_MOSI, SPI_MISO, SPI_SCK); -MCP3008 Adc0(&SpiM, D10); -MCP3008 Adc1(&SpiM, D9); +SPI SpiM1(SPI_MOSI, SPI_MISO, SPI_SCK); +MCP3008 Adc0(&SpiM1, D10); +MCP3008 Adc1(&SpiM1, D9); -SpiAmpController ampController(&SpiM, D8, D7); +SPI SpiM2(PB_15, PB_14, PB_13); +SpiAmpController ampController(&SpiM2, PB_1, PC_4); // Check pins DigitalOut Dout0(D2); @@ -229,11 +230,7 @@ // Amplitude Envelope amplitude = envelopeAmplitude.getAmplitude(envelopeTicks); - SpiM.lock(); - SpiM.frequency(16000000); ampController.outDca(amplitude * 4096); - SpiM.frequency(2000000); - SpiM.unlock(); envelopeTicks++; if (envelopeTicks >= envelopeLength) { @@ -319,8 +316,11 @@ { printf("%s %s\r\n", TITLE_STR1, TITLE_STR2); - SpiM.format(0, 0); - SpiM.frequency(2000000); + SpiM1.format(0, 0); + SpiM1.frequency(2000000); + + SpiM2.format(0, 0); + SpiM2.frequency(20000000); frequency = 1000.0f; phiDelta = 2.0f * frequency / SAMPLING_RATE;