00001 00009 /* Includes */ 00010 #include "esos_adc_example_config.h" 00011 00017 static ESOS_USER_TASK(heartbeat) { 00018 ESOS_TASK_BEGIN(); 00019 while (TRUE) { 00020 ESOS_TASK_WAIT_TICKS(HALF_HEARTBEAT_PERIOD); 00021 HEARTBEAT = !HEARTBEAT; //toggle the HEARTBEAT LED 00022 } 00023 ESOS_TASK_END(); 00024 } 00025 00026 ESOS_USER_TASK(report_adc) { 00027 static uint8 u8_i; 00028 ESOS_TASK_BEGIN(); 00029 while (TRUE) { 00030 ESOS_TASK_WAIT_TICKS(UPDATE_PERIOD); 00031 ESOS_TASK_WAIT_ON_AVAILABLE_OUT_COMM(); 00032 for (u8_i = 0; u8_i < NUM_ADC1_PINS; u8_i++) { 00033 ESOS_TASK_WAIT_ON_SEND_UINT8(((union16) au16_ADC1Buffer[u8_i]).u8[0]); 00034 ESOS_TASK_WAIT_ON_SEND_UINT8(((union16) au16_ADC1Buffer[u8_i]).u8[1]); 00035 } 00036 ESOS_TASK_SIGNAL_AVAILABLE_OUT_COMM(); 00037 } 00038 ESOS_TASK_END(); 00039 } 00040 00041 /* 00042 * This function is called by ESOS during initialization. From here, you may call 00043 * any initialization functions you want. The developer can make no assumptions about 00044 * task scheduling or timing. 00045 */ 00046 void user_init(void) { 00047 CONFIG_HEARTBEAT(); //HEARTBEAT is RB15, set as digital output 00048 00049 esos_RegisterTask(heartbeat); 00050 esos_RegisterTask(report_adc); 00051 initialize_ADC1(); 00052 }