This program just echos back characters from the PC Console Interface. It does no further testing outside the M3 processor.

Dependencies:   C027-REVB mbed

main.cpp

Committer:
dixter1
Date:
2013-12-14
Revision:
0:cd857d770d29

File content as of revision 0:cd857d770d29:

#include "mbed.h"
#include "C027.h"

DigitalOut mdm_activity(LED);

int main() 
{
    int led_toggle_count = 5;

    C027 c027;
    c027.mdmPower(true,false);
    
#if 0
    while(1) {
        mdm_activity = !mdm_activity;
        wait(0.2);
    }
#else
    while( led_toggle_count-- > 0 )
    {
        mdm_activity = !mdm_activity;
        wait(0.2);
    }
#endif

    // open the mdm serial port
    Serial mdm(MDMTXD, MDMRXD);
    mdm.baud(MDMBAUD);
    // tell the modem that we can always receive data
    DigitalOut mdmRts(MDMRTS);
    mdmRts = 0; // (not using flow control)
    
    // open the PC serial port and (use the same baudrate)
    Serial pc(USBTX, USBRX);
    pc.baud(MDMBAUD);
    
    while (1)
    {
        // transfer data from pc to modem
        if (pc.readable() && pc.writeable())
            pc.putc(pc.getc());
    }
}