/* This file is part of MANTIS OS, Operating System for Nymph. See http://mantis.cs.colorado.edu/ Copyright (C) 2003 University of Colorado, Boulder */ /** * @File: helloWorld.c * @Brief: A file to test the Interface Board SIO * * Modifications * Aug07, add 'deep sleep' to monitor how low it goes. */ #include "mos.h" #include "command_daemon.h" #include "printf.h" #include "com.h" #include "dev.h" #define GREEN 2 #define YELLOW 1 #define RED 4 void hello(); //---------------------------------------- void start (void) { mos_thread_new (hello, MOS_COMMANDER_STACK_SIZE + 120, PRIORITY_NORMAL); } /** @brief Thread is not waiting on interrupts, ok to sleep */ // SUSPEND_STATE_IDLE = 0, /** @brief Thread needs an interrupt, do not sleep */ // SUSPEND_STATE_SLEEP, /** @brief Total number of suspend states */ // SUSPEND_STATE_MAX void hello() { uint8_t i=0, leds; mos_thread_set_suspend_state(SUSPEND_STATE_SLEEP); // for lowest power // mos_thread_set_suspend_state(SUSPEND_STATE_IDLE); // for lowest power // mos_thread_set_suspend_state(SUSPEND_STATE_MAX); printf("\n\rHelloWorld....Cycling LED's 5-sec on, 5-sec off with each mode setting....."); while( 1 ) { switch( ++i ) { case 1: { leds = RED; com_mode(IFACE_RADIO, IF_OFF); // to turn off the radio printf("\n\rcom_mode IfaceRadio: IF_OFF"); break; } case 2: { leds = GREEN | RED; com_mode(IFACE_RADIO, IF_STANDBY); // to turn on the radio printf("\n\rcom_mode IfaceRadio: IF_STANDBY"); break; } case 3: { leds = GREEN | RED | YELLOW; com_mode(IFACE_RADIO, IF_IDLE); // to turn on the radio printf("\n\rcom_mode IfaceRadio: IF_IDLE"); i=0; break; } } mos_led_display( leds ); mos_thread_sleep( 5000 ); mos_led_display( 0 ); // printf("\n\rabcdefghyijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890abcdefghijklmnopqrstuvwxyz1234567890ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"); // mos_led_display(i%8); mos_thread_sleep(5000); } mos_led_display( 0 ); } //---------------------------------------- /* printf("\nSizeof char=%C, uint8=%C uint16=%C int=%C long=%C float=%C \n", sizeof(char),sizeof(uint8_t), sizeof(uint16_t), sizeof(int), sizeof(long), sizeof(float) ); */