Changeset 60 for webserver/example
- Timestamp:
- 04/04/10 10:49:44 (15 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c
r59 r60 30 30 31 31 32 33 portLONG meterIntStatus = 0; /* which meter interrupts were triggered? (bitwise 0 to 7) */ 34 35 32 36 int rtcHOURS; 33 37 int rtcMINUTES; … … 48 52 { 49 53 50 /* this runs every 1000ms */54 /* this runs every METERS_INT_CHECK_INTERVAL_MS ms */ 51 55 52 56 basementGasCalculation(); … … 71 75 rtcSECONDS = RTC_CTIME0 & MASKSEC; // Read Second 72 76 73 xSemaphoreTake( xMetersSemaphore, 1000 ); /* timeout 1 sec*/77 xSemaphoreTake( xMetersSemaphore, METERS_INT_CHECK_INTERVAL_MS ); /* timeout METERS_INT_CHECK_INTERVAL_MS ms */ 74 78 75 79 … … 145 149 { 146 150 151 if ( (meterIntStatus & (1<<10)) != 0) 152 { 153 handleMeterTick(METER_INDEX_TST); 154 meterIntStatus &= (~(1<<10)); 155 } 156 157 if ( (meterIntStatus & (1<<0)) != 0) 158 { 159 handleMeterTick(METER_INDEX_GAS); 160 meterIntStatus &= (~(1<<0)); 161 } 162 163 if ( (meterIntStatus & (1<<1)) != 0) 164 { 165 handleMeterTick(METER_INDEX_EL1); 166 meterIntStatus &= (~(1<<1)); 167 } 168 169 if ( (meterIntStatus & (1<<2)) != 0) 170 { 171 handleMeterTick(METER_INDEX_EL2); 172 meterIntStatus &= (~(1<<2)); 173 } 174 175 if ( (meterIntStatus & (1<<3)) != 0) 176 { 177 handleMeterTick(METER_INDEX_AU1); 178 meterIntStatus &= (~(1<<3)); 179 } 180 181 147 182 } 148 183 webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h
r56 r60 11 11 #define METER_INDEX_AU1 4 /* index of Auxiliary input 1 */ 12 12 #define METER_INDEX_AU2 5 /* index of Auxiliary input 1 */ 13 14 15 #define METERS_INT_CHECK_INTERVAL_MS 100 /* how often (in ms) do we check if one of the I/O lines has triggered */ 13 16 14 17 webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c
r59 r60 13 13 extern xTickCount; /* millisecond tick counter */ 14 14 15 extern meterIntStatus; 15 16 16 17 int globalValue = 0; … … 33 34 if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ 34 35 { 35 handleMeterTick(METER_INDEX_TST); 36 meterIntStatus |= (1<<10); 37 //handleMeterTick(METER_INDEX_TST); 36 38 IO2_INT_CLR |= (1<<10); 37 39 } 38 40 if ((IO2_INT_STAT_R & (1 << 0)) != 0) /* P0.0 interrupt triggered - connector J4, Pin 0*/ 39 41 { 40 handleMeterTick(METER_INDEX_GAS); 42 meterIntStatus |= (1<<0); 43 //handleMeterTick(METER_INDEX_GAS); 41 44 IO2_INT_CLR |= (1<<0); 42 45 } 43 46 if ((IO2_INT_STAT_R & (1 << 1)) != 0) /* P0.1 interrupt triggered - connector J4, Pin 1*/ 44 47 { 45 handleMeterTick(METER_INDEX_EL1); 48 meterIntStatus |= (1<<1); 49 //handleMeterTick(METER_INDEX_EL1); 46 50 IO2_INT_CLR |= (1<<1); 47 51 } 48 52 if ((IO2_INT_STAT_R & (1 << 2)) != 0) /* P0.3 interrupt triggered - connector J4, Pin 3*/ 49 53 { 50 handleMeterTick(METER_INDEX_EL2); 54 meterIntStatus |= (1<<2); 55 //handleMeterTick(METER_INDEX_EL2); 51 56 IO2_INT_CLR |= (1<<2); 52 57 } 53 58 if ((IO2_INT_STAT_R & (1 << 3)) != 0) /* P0.4 interrupt triggered - connector J4, Pin 4*/ 54 59 { 55 handleMeterTick(METER_INDEX_AU1); 60 meterIntStatus |= (1<<3); 61 //handleMeterTick(METER_INDEX_AU1); 56 62 IO2_INT_CLR |= (1<<3); 57 63 } … … 59 65 //if ((IO2_INT_STAT_R & (1 << 4)) != 0) /* P0.2 interrupt triggered - connector J4, Pin 2*/ 60 66 //{ 67 // meterIntStatus |= (1<<4); 61 68 // handleMeterTick(METER_INDEX_AU2); 62 69 // IO2_INT_CLR |= (1<<4);