Codesnippet
This code snippet initializes the MCU and the module. It first sends an initial message to the user
and then logs an events such as calls or messages on the microSD card and reads the current GPS
location, all in an infinite loop.
01 void main( void )
02 {
03 system_init();
04 at_init( rsp_handler, UART1_Write, buffer, sizeof( buffer ) );
05 at_cmd_save( "+CMS ERROR", 1000, NULL, NULL, NULL,
at_cb_send_init_message );
06 at_cmd_save( "+FSMEM", 3000, NULL, NULL, NULL, at_cb_microsd_end );
07 at_cmd_save( "+CMT", 3000, NULL, NULL, NULL, sms_action_handler );
08 at_cmd_save( "+CMGS", 1000, NULL, NULL, NULL, at_cb_send_init_message
);
09
10 gsm_gnss_2_power_on();
11
12 gsm_gnss_2_init();
13
14 send_SMS(); // Sending initial message
15
16 while( !msg_sent ) at_process(); // Waiting for SMS sending
status
17
18 LOG( "rn**********************************************************rn"
);
19 LOG( "Finished Sending SMS Message.");
20 LOG( "rn**********************************************************rn"
);
21
22 micro_SD(); // Creating files on microSD
23
24 while( !sd_f ) at_process(); // Waiting for SD card
operations
25
26 LOG( "rn**********************************************************rn"
);
27 LOG( "Finished SD Initialization.");
28 LOG( "rn**********************************************************rn"
);
29 Delay_ms( 1000 );
30
31 LOG( "rn**********************************************************rn"
);