Changeset 46 for webserver/example/EnergyMeters/Source
- Timestamp:
- 02/07/10 11:36:21 (15 years ago)
- Files:
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c
r45 r46 138 138 } 139 139 140 // Init Example Button meter 141 meterItems[METER_INDEX_BUTTON].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ 142 meterItems[METER_INDEX_BUTTON].timeLastTick = getEpochTimeWithMs(); /* when did the last tick occur? epoch (seconds) */ 143 meterItems[METER_INDEX_BUTTON].timeBeforeLastTick = getEpochTimeWithMs(); /* when did the tick before last tick occur? epoch (seconds) */ 144 meterItems[METER_INDEX_BUTTON].valueLastTick = 1; /* what value did we have at the last tick? */ 145 meterItems[METER_INDEX_BUTTON].currentValue = 1; /* same: start value of the meter */ 146 meterItems[METER_INDEX_BUTTON].valueBeforeLastTick = 0; /* what value did we have at the tick before the last tick? */ 147 140 148 // Init Gas meter 141 149 meterItems[METER_INDEX_GAS].meterEnabled = 1; /* 0: item not used, 1: meter enabled */ webserver/example/EnergyMeters/Source/EnergyMeters/MetersIncludes.h
r45 r46 3 3 unsigned long long getEpochTimeWithMs(void); 4 4 5 #define NUMBER_OF_METERS 11/* the number of meters we use */5 #define NUMBER_OF_METERS 5 /* the number of meters we use */ 6 6 7 #define METER_INDEX_GAS 10 /* index of the gas meter data */ 7 #define METER_INDEX_BUTTON 0 /* index of the button example meter data */ 8 9 #define METER_INDEX_GAS 1 /* index of the gas meter data */ 8 10 9 11 #define DEBOUNCE_TICK_THRESHOLD_MS 50 /* when two ticks are less than this time period apart, the second tick is ignored (debouncing) */ webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c
r45 r46 33 33 if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ 34 34 { 35 handleMeterTick( 10);35 handleMeterTick(METER_INDEX_BUTTON); 36 36 IO2_INT_CLR |= (1<<10); 37 37 } 38 38 else if ((IO2_INT_STAT_R & (1 << 0)) != 0) /* P0.0 interrupt triggered - connector J4, Pin 0*/ 39 39 { 40 handleMeterTick( 0);40 handleMeterTick(METER_INDEX_GAS); 41 41 IO2_INT_CLR |= (1<<0); 42 42 }