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: mbed
Diff: main.cpp
- Revision:
- 4:f7d06462819b
- Parent:
- 3:7d014ee1c543
- Child:
- 5:b58e5d191b17
--- a/main.cpp Wed Apr 29 13:01:10 2015 +0000
+++ b/main.cpp Wed Apr 29 13:08:15 2015 +0000
@@ -1,13 +1,13 @@
// Goal: Program that receives and send 4 channels of data.
// Receives: 1kHz
// Sends: 70kbits/s
-// Ver qual o melhor modo de blueth (i2C,SPI,UART);
-/* DONE:
- Receber sinais Analógicos
- */
-/* TO DO:
- Juntar ao módulo Bluetooth
- */
+
+//DONE:
+ // O programa lê e envia dados da taxa indicada por TIMER_RATE
+//TODO:
+ // Fazer uma interrupção Serial de Envio?
+ // Utilizar Putc? Apenas se tiver o programaque concatena bytes.
+ // Olhar Módulo Bluetooth.(Ver qual o melhor modo de blueth (i2C,SPI,UART);)
#include "mbed.h"
@@ -18,7 +18,7 @@
#define RESP 2
#define PPG 3
-/*------------- Sample Speed Timer --------*/
+/*---------------- Sample Speed Timer --------------*/
#define TIMER_RATE 1
/*-----READS THE ANALOG SIGNAL FROM THE SENSORS-----*/
@@ -34,7 +34,7 @@
Serial pc(USBTX,USBRX);
-/*------HANDLES THE TIMER AND SERIAL INTERRUPTIONS------------*/
+/*---HANDLES THE TIMER AND SERIAL INTERRUPTIONS-----*/
void t0_handler(void);
void rx_Handler(void);
@@ -60,6 +60,7 @@
if(test == '2'|| test == '2')
{ // wake up routine
+ pc.printf("Should go to timer");
t0.attach(&t0_handler,TIMER_RATE); //start counting ----Data read in a 1kHz freq. (1mS)
}else if (test=='3'|| test == '3')
@@ -77,7 +78,7 @@
buffer[ECG2] = Ecg2.read_u16();
buffer[RESP] = Resp.read_u16();
buffer[PPG] = Ppg.read_u16();
- pc.printf("%i,%i,%i,%i\n",buffer[ECG1],buffer[ECG2],buffer[RESP],buffer[PPG]);
+ pc.printf("%i,%i,%i,%i\n",buffer[ECG1],buffer[ECG2],buffer[RESP],buffer[PPG]);//PUTC
TimerStatus = 0;
}
@@ -91,8 +92,9 @@
TimerStatus = 1;
}
+ //This function must
+
void rx_Handler(void){
-
// A programação não estava funcionando poisnão se deve utilizar interrupções para realizar grandes tarefas;
// Elas travam e não funciona mais nada.
// Como fazer para não ficar testando no main?? Sexta feira no globo reporter
@@ -102,3 +104,16 @@
pc.putc(test);
}
+/*Commit
+
+A programação do jeito que está não é a mais rápida possível, é a mais fácil de ser manuseada já que utiliza a função printf e envia
+Strings inteiras com os dados lidos das entradas analógicas. A vantagem é que o usuário não necessita concatenar dois bytes como teria defazê-lo caso utilizasse
+a função putchar.
+
+Caso queria otimizar a velocidade de envio, deve-se utilizar a função putchar e concatenar os dados!!
+
+Quanto ao consumo, ainda deve ser verificado as funções que reduziriam.
+
+Neste código, algumas variáveis ficam constantemente sendo testadas no Main, isso pode reduzir a eficiencia energética do projeto
+
+ */
\ No newline at end of file