Bridge to test NBIoT schield

Dependencies:   mbed

main.cpp

Committer:
aratti
Date:
2018-01-24
Revision:
1:6d9b0810f7b8
Parent:
0:aabe1b05abb9

File content as of revision 1:6d9b0810f7b8:

#include "mbed.h"

Serial pc(SERIAL_TX, SERIAL_RX,9600);
DigitalOut led(LED1);
DigitalOut BG96_reset(D7);
DigitalOut VBAT_3V8_EN(D11);
//DigitalOut BG96_W_DISABLE(D11);
DigitalOut BG96_PWRKEY(D10);

Serial BG96_uart(PA_9, PA_10,9600);

int main()
{
    BG96_reset = 1;
    VBAT_3V8_EN = 1;
//    BG96_W_DISABLE = 0;
    BG96_PWRKEY = 1;
    pc.printf("Press '1' to turn LED1 ON, '0' to turn it OFF\n");
    wait( 0.3 );
    BG96_reset = 0;
    wait( 0.1 );
    while(1) {
        char c;
        
        if( BG96_uart.readable() != 0 )
        {
            c = BG96_uart.getc();
            // c=pc.getc();
            pc.putc(c);
        }
        if( pc.readable() != 0 )
        {
            //c = BG96_uart.getc();
            c=pc.getc();
/*
            if( c == '!' )
            {
                BG96_reset = 1;
                pc.printf("reset\n");
                wait( 0.3 );
                BG96_reset = 0;
                wait( 0.1 );
            }
            else
*/                BG96_uart.putc(c);

        }
    }
}