Serial communication protocol project

Dependencies:   C12832 DataCommClassVersion mbed

main.cpp

Committer:
askksa12543
Date:
2015-03-23
Revision:
1:ab8aac1fc1ad
Parent:
0:836e980f9b44

File content as of revision 1:ab8aac1fc1ad:

#include "mbed.h"
#include "C12832.h"
#include "DataComm.h"

DataComm test;
C12832 lcd(p5, p7, p6, p8, p11); //LCD structure
void* data;
int i=0;

int main()
{
    //clear lcd screen, print current build message
    lcd.cls();
    lcd.locate(0,3);
    lcd.printf("Testing receive data"); 
    test.setClockIn(p21); //clock in pin
    test.setSerialIn(p22); //data in pin        
    test.listen();
    //clear lcd screen, print current build message
    lcd.cls();
    lcd.locate(0,3);
    lcd.printf("Preamble Recieved"); 
    data = test.receive_data();
    //clear debugging message - and reset lcd to original position before printing data.
    lcd.cls();
    lcd.locate(0,3);
    lcd.printf("Received: "); 
    lcd.printf("%s", data);         
}


//listen runs in the address while loop - when listen returns because the preamble has been found
//then it checks if the address is correct - if it isn't it goes back to listen - if it is end the loop to receive data.
//addressing - while(!address)
               //{
                     //test.listen();
                     //if(test.check_address())
                     //     address = 1;
               //}