Ejemplo n.º 1
0
void rtc_init()
{
    mprint("Loading RTC\n");
    rtc_print_time();
    mprint("RTC functioning properly.\n");
    _kill();
}
Ejemplo n.º 2
0
//*****************************************************************************
// execute callback for microrl library
// do what you want here, but don't write to argv!!! read only!!
int execute (int argc, const char * const * argv)
{
	int i = 0;
	// just iterate through argv word and compare it with your commands
	while (i < argc) {
		if (strcmp (argv[i], _CMD_HELP) == 0) 
        {
 		  print ("microrl library v");
		  print (MICRORL_LIB_VER);
		  print ("\n\r");
		  print_help ();        // print help
		} 
        else if (strcmp (argv[i], _CMD_CLEAR) == 0) 
        {
		  print ("\033[2J");    // ESC seq for clear entire screen
		  print ("\033[H");     // ESC seq for move cursor at left-top corner
		}  
		/* Вывести даду и время */
        else if (strcmp (argv[i], _CMD_TIME) == 0) 
        {
          rtc_print_time();
		  return 0;
		}
        /* Вывести температуру */
		else if (strcmp (argv[i], _CMD_TEMP) == 0) 
        {
          float temper;
		  if (!DALLAS_GetTemperature(&temper))
			printf ("Temperature: %.2f\r\n", temper);
		  return 0;
		}                		
		
        else 
        {
		  print ("command: '");
		  print ((char*)argv[i]);
		  print ("' Not found.\n\r");
		}
		i++;
	}
	return 0;
}
Ejemplo n.º 3
0
void rtc_print_time_as_proc()
{
    rtc_print_time();
    _kill();
}