Practica 2 Ejercicio 1 DSP
Dependencies: mbed mydsc_sampling_example mydsc
Revision 1:3454f8f520e4, committed 2020-02-25
- Comitter:
- joliver02
- Date:
- Tue Feb 25 17:10:24 2020 +0000
- Parent:
- 0:b7c05aca6d5f
- Commit message:
- Practica 2 DSP v1
Changed in this revision
main.cpp | Show annotated file Show diff for this revision Revisions of this file |
mydsc_sampling_example.lib | Show annotated file Show diff for this revision Revisions of this file |
diff -r b7c05aca6d5f -r 3454f8f520e4 main.cpp --- a/main.cpp Wed Oct 30 17:32:19 2019 +0000 +++ b/main.cpp Tue Feb 25 17:10:24 2020 +0000 @@ -36,28 +36,28 @@ const int32_t PHI = -256; ///< Phase shift mydsc_ring_buffer_t rb; ///< circular queue or ring buffer. -Ticker ticker; +Ticker ticker; //Variable ticker void ticker_isr() { - static unsigned int k = 0; + static unsigned int k = 0; //Dato no accesado desde otra funcion - analog_out_1 = ( 1.0 + sin(2*PI*k*H)) / 2.0; - mydsc_ring_buffer_push(&rb, analog_in); - analog_out_2 = *mydsc_ring_buffer_sample(&rb, PHI); + analog_out_1 = ( 1.0 + sin(2*PI*k*H)) / 2.0; //Genera su salida analogica. Salida senoidal + mydsc_ring_buffer_push(&rb, analog_in); //Apuntador RB e inserta el balor en PHI + analog_out_2 = *mydsc_ring_buffer_sample(&rb, PHI); //Emular un arreglo, lee el valor con un apuntador k++; } int main() { // Setup - Serial tty(USBTX, USBRX); + Serial tty(USBTX, USBRX); //Clase para el puerto Serial - mydsc_ring_buffer_init(&rb, SIZE); + mydsc_ring_buffer_init(&rb, SIZE); //Se inicializa y se da el tamaño de memoria ticker.attach(&ticker_isr, H); - tty.baud(115200); + tty.baud(115200); //Velocidad a 115200 Baudios para el plotter while(1) { // Loop - tty.printf("%f\t%f\n", (*mydsc_ring_buffer_sample(&rb, 0)),(*mydsc_ring_buffer_sample(&rb, PHI))); + tty.printf("%f\t%f\n", (*mydsc_ring_buffer_sample(&rb, 0)),(*mydsc_ring_buffer_sample(&rb, PHI))); // } }
diff -r b7c05aca6d5f -r 3454f8f520e4 mydsc_sampling_example.lib --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mydsc_sampling_example.lib Tue Feb 25 17:10:24 2020 +0000 @@ -0,0 +1,1 @@ +https://os.mbed.com/users/ghsalazar/code/mydsc_sampling_example/#b7c05aca6d5f