void user_init(void) { CONFIG_POT(); config_esos_f15ui(); f15ui_flashLED3(250); esos_RegisterTask(READ_POT_SW1); esos_RegisterTask(READ_POT_SW2); }
/**************************************************** * user_init() **************************************************** */ void user_init(void) { // Call the hardware-provided routines to print the // HELLO_MSG to the screen. Must use this call because // the ESOS communications subsystems is not yet fully // initialized, since this call is in user_init() // // In general, users should call hardware-specific // function like this. __esos_unsafe_PutString( HELLO_MSG ); #ifdef __linux // register our little ESOS task to mimic MCU's TIMER T1 IRQ which kicks off // the ESOS S/W timers when they expire esos_RegisterTask( __simulated_isr ); #endif // configure our hardware to support to support our application CONFIG_LED1(); esos_pic24_configI2C1(400); //configure I2C for 400 KHz ESOS_INIT_SEMAPHORE(sem_ds1631Ready, 0); ESOS_INIT_SEMAPHORE(sem_dataReady, 0); ESOS_INIT_SEMAPHORE(sem_dataPrinted, 0); // user_init() should register at least one user task esos_RegisterTask(start_ds1631); esos_RegisterTask(listenForCommand); // register our callback function with ESOS to create a software timer esos_RegisterTimer( swTimerLED, 250); } // end user_init()
void user_init(void) { config_esos_f15ui(); f15ui_flashLED3(1000); configECAN1(); CHANGE_MODE_ECAN1(ECAN_MODE_NORMAL); esos_RegisterTask(CANFactory); esos_RegisterTask(CAN_FIFO); } // end user_init()
void user_init(void) { esos_init_menu(); // initilize the menu, LCD and UI configECAN1(); // init can CHANGE_MODE_ECAN1(ECAN_MODE_NORMAL); // setup the CAN esos_pic24_configI2C1(400); // setup the I2C // used for my own curiosity for the SPI transmission CONFIG_RD2_AS_DIG_OUTPUT(); _LATD2 = 1; u16_position = 0; // initial values u8_dutyCount = 0; // initial values u16_positionDACB = 0; // initial values u8_dutyCountDACB = 0; // initial values b_CANINUSE = 0; esos_create_menu(8); // setup the menu // see the .h file for details esos_insert_menu_title(TEAM, SET, SV3C, "team", '0'); esos_insert_menu_title(WAVEFORM, SET, SV3C, "wvform", '0'); esos_insert_menu_title(FREQ, SET, SVDATA, "freq", '0'); esos_insert_menu_title(AMPLTD, SET, SVDATA, "ampltd", '0'); esos_insert_menu_title(DUTY, SET, SVDATA, "duty", '0'); esos_insert_menu_title(LM60, READ, NONE, "LM60", '0'); esos_insert_menu_title(LEDSET, SET, SVDATA, "LEDs", '0'); esos_insert_menu_title(ABOUT, STATIC, NONE, "About", '0'); esos_setSV3C(TEAM, "APPLE ", "CHERRY ", "TEACHER"); esos_setSV3C(WAVEFORM, "tri ", "sine ", "square "); esos_setSVDATA(FREQ, 64, 2047, FALSE, FALSE); esos_setSVDATA(AMPLTD, 0, 30, FALSE, FALSE); esos_setSVDATA(DUTY, 0, 100, FALSE, FALSE); esos_setSVDATA(LM60, 0, 100, FALSE, FALSE); esos_setSVDATA(LEDSET, 0, 1110, TRUE, TRUE); esos_setStaticInfo(ABOUT, "Developers DIGITAL FUNCTION SYNTHESIZER", "James CPE Andrew EE John CPE Wyatt CPE"); configSPI1(); // configure the spi configTimer2(); // configure timer 2 configTimer3(); // configure timer 3 esos_setSVDATAValue(DUTY, 50); // set the default duty cycle esos_setSVDATAValue(AMPLTD, 30); // set the default ampl esos_setSV3C_VALUE(TEAM, 1); esos_setSV3C_VALUE(WAVEFORM, 1); u8_currentMenuIndex = MY_ID; // initial index is set to MY_ID // enable the interrupts ESOS_REGISTER_PIC24_USER_INTERRUPT( ESOS_IRQ_PIC24_T2, ESOS_USER_IRQ_LEVEL1, _T2Interrupt); ESOS_ENABLE_PIC24_USER_INTERRUPT(ESOS_IRQ_PIC24_T2); ESOS_REGISTER_PIC24_USER_INTERRUPT( ESOS_IRQ_PIC24_T3, ESOS_USER_IRQ_LEVEL1, _T3Interrupt); ESOS_ENABLE_PIC24_USER_INTERRUPT(ESOS_IRQ_PIC24_T3); esos_RegisterTask(LEDS); // for change in LED states esos_RegisterTask(DACA); // for change in wave esos_RegisterTask(DACB); // for change in wave esos_RegisterTask(CAN_RX); // CAN RX esos_RegisterTask(CAN_TEMP_TX); // CAN TX esos_RegisterTask(SET_TEAM); // TEAM SETUP esos_RegisterTask(BUILD_LIST); // LIST esos_RegisterTask(UPDATE_TEMP); // UPDATES THE TEMP } // end user_init()
/****************************************************************************** * Function: void user_init(void) * * PreCondition: None * * Input: None * * Output: None * * Side Effects: None * * Overview: user_init is a centralized initialization routine where * the user can setup their application. It is called * automagically by ES_OS during the operating system * initialization. * * Note: The user should set up any state machines and init * all application variables. They can also turn on * any needed peripherals here. * * The user SHALL NOT mess with the interrupt hardware * directly!!! The ES_OS must be aware of the interrupts * and provides osXXXXXXX functions for the user to use. * Using these ES_OS-provided functions, the user may * (and probably should) initialize, register, and enable * interrupts in this routine. * * Furthermore, the user should register AT LEAST one * user application task here (via esos_RegisterTask) or * the ES_OS scheduler will have nothing to schedule * to run when this function returns. * *****************************************************************************/ void user_init(void) { uint16* pu16_ptr; uint16 u16_junk; __esos_hw_PutString( HELLO_MSG ); /* * Now, let's get down and dirty with ESOS and our user tasks * * Once tasks are registered, they will start executing in * the ESOS scheduler. */ // here are several combinations of tasks that should work together #if 0 esos_RegisterTask( upper_case ); #endif #if 0 esos_RegisterTask( child_echo_buffers ); #endif #if 1 esos_RegisterTask( random_xmit ); #endif #if 0 esos_RegisterTask( check_timers ); #endif #if 0 esos_RegisterTask( child_echo_buffers ); esos_RegisterTask( random_xmit ); #endif #if 0 esos_RegisterTask( random_1 ); esos_RegisterTask( random_2 ); esos_RegisterTask( random_3 ); #endif #if 0 esos_RegisterTask( echo ); esos_RegisterTask( random_1 ); esos_RegisterTask( random_2 ); esos_RegisterTask( random_3 ); #endif #if 0 esos_RegisterTask( child_echo_buffers ); esos_RegisterTask( random_1 ); esos_RegisterTask( random_2 ); esos_RegisterTask( random_3 ); #endif #if 0 esos_RegisterTask( upper_case ); esos_RegisterTask( random_1 ); esos_RegisterTask( random_2 ); esos_RegisterTask( random_3 ); #endif #if 0 pst_MyTasks[0] = esos_RegisterTask( random_1 ); pst_MyTasks[1] = esos_RegisterTask( random_2 ); pst_MyTasks[2] = esos_RegisterTask( random_3 ); esos_RegisterTask( task_ctrl ); #endif #if 0 pst_MyTasks[0] = esos_RegisterTask( random_1 ); pst_MyTasks[1] = esos_RegisterTask( random_2 ); pst_MyTasks[2] = esos_RegisterTask( random_3 ); esos_RegisterTask( task_ctrl ); esos_RegisterTask( init_print ); esos_RegisterTask( watchdog ); #endif } // end user_init()
void user_init(void) { // configure our hardware config_esos_f15ui(); // register our task esos_RegisterTask(serial_menu); esos_RegisterTask(switch_detection_LED1); esos_RegisterTask(RPG_fast_detection_LED2); esos_RegisterTask(RPG_medium_detection_LED2); esos_RegisterTask(RPG_on_detection_LED2); esos_RegisterTask(SW1_to_serial); esos_RegisterTask(SW2_to_serial); esos_RegisterTask(SW3_to_serial); esos_RegisterTask(SW1_double_press_detection); esos_RegisterTask(SW2_double_press_detection); esos_RegisterTask(SW3_double_press_detection); esos_RegisterTask(RPG_to_serial); // do heartbeat f15ui_flashLED3(500); }