USB stick covox & pwm wav player
Dependents: wave_player_pwm_and_covox_lib
Diff: wave_player.cpp
- Revision:
- 3:97da0d3bf0cd
- Parent:
- 2:da5d90e12f27
--- a/wave_player.cpp Fri Dec 05 02:31:00 2014 +0000 +++ b/wave_player.cpp Thu Jan 03 13:48:19 2019 +0000 @@ -13,6 +13,7 @@ #include <mbed.h> #include <stdio.h> +#include "pinout.h" #include <wave_player.h> @@ -206,8 +207,23 @@ #ifdef VERBOSE printf("ISR rdptr %d got %u\n",DAC_rptr,DAC_fifo[DAC_rptr]); #endif - wave_DAC->write_u16(DAC_fifo[DAC_rptr]); +// wave_DAC->write_u16(DAC_fifo[DAC_rptr]); + wave_player::covox_out(DAC_fifo[DAC_rptr]); wave_PWM->write(float(DAC_fifo[DAC_rptr]/65536.0)); DAC_rptr=(DAC_rptr+1) & 0xff; } } + +void wave_player::covox_out(int covox) +{ +R0 = (covox>>7) & 1; +R1 = (covox >> 8) & 1; +R2 = (covox >> 9) & 1; +R3 = (covox >> 10) & 1; +R4 = (covox >> 11) & 1; +R5 = (covox >> 12) & 1; +R6 = (covox >> 13) & 1; +R7 = (covox >> 14) & 1; +R8 = (covox >> 15) & 1; +//R9 = ((covox) & 1) | ((covox >> 1) & 1) | ((covox >> 2) & 1); +} \ No newline at end of file