Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 37) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c (revision 42) @@ -16,4 +16,8 @@ portBASE_TYPE Init_P2_0(void); void basementGasCalculation(void); + +xLCDMessage xMessage; +char lcdText[] = "a "; + portLONG basementGasReading = 0; @@ -39,4 +43,5 @@ // TODO: put this in again, right now it interferes with Solar UART3! +xMessage.pcMessage = &(lcdText[0]); for( ;; ) @@ -101,4 +106,15 @@ IO2_INT_EN_F &= ~(1<<10); /* disable falling edge interrupt for P2:10 */ + IO2_INT_EN_R |= (1<<0); /* enable rising edge interrupt for P2:0 */ + IO2_INT_EN_F &= ~(1<<0); /* disable falling edge interrupt for P2:0 */ + IO2_INT_EN_R |= (1<<1); /* enable rising edge interrupt for P2:1 */ + IO2_INT_EN_F &= ~(1<<1); /* disable falling edge interrupt for P2:1 */ + IO2_INT_EN_R |= (1<<2); /* enable rising edge interrupt for P2:2 */ + IO2_INT_EN_F &= ~(1<<2); /* disable falling edge interrupt for P2:2 */ + IO2_INT_EN_R |= (1<<3); /* enable rising edge interrupt for P2:3 */ + IO2_INT_EN_F &= ~(1<<3); /* disable falling edge interrupt for P2:3 */ + IO2_INT_EN_R |= (1<<4); /* enable rising edge interrupt for P2:4 */ + IO2_INT_EN_F &= ~(1<<4); /* disable falling edge interrupt for P2:4 */ + VICVectAddr17 = (portLONG) vP2_0_ISR_Wrapper; /* EINT-3 interrupt handler */ Index: /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c =================================================================== --- /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 32) +++ /webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c (revision 42) @@ -4,8 +4,17 @@ #include "MetersIncludes.h" + +#include "emac.h" +#include "partest.h" +#include "portlcd.h" +#include "flash.h" + extern xMetersSemaphore; extern xTickCount; /* millisecond tick counter */ -void handleGasMeterTick(void); + +int globalValue = 0; + +void handleMeterTick(portSHORT portNum); /* The interrupt entry point. */ @@ -18,13 +27,37 @@ void vP2_0_ISR_Handler( void ) { +extern int testValue; portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; - if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered */ + testValue++; + if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ { - handleGasMeterTick(); + handleMeterTick(10); + IO2_INT_CLR |= (1<<10); } - // else if ((IO2_INT_STAT_R & (1 << n)) != 0) /* some other interrupt triggered */ + else if ((IO2_INT_STAT_R & (1 << 0)) != 0) /* P0.0 interrupt triggered - connector J4, Pin 0*/ { - ; + handleMeterTick(0); + IO2_INT_CLR |= (1<<0); + } + else if ((IO2_INT_STAT_R & (1 << 1)) != 0) /* P0.1 interrupt triggered - connector J4, Pin 1*/ + { + handleMeterTick(1); + IO2_INT_CLR |= (1<<1); + } + else if ((IO2_INT_STAT_R & (1 << 2)) != 0) /* P0.2 interrupt triggered - connector J4, Pin 2*/ + { + handleMeterTick(2); + IO2_INT_CLR |= (1<<2); + } + else if ((IO2_INT_STAT_R & (1 << 3)) != 0) /* P0.3 interrupt triggered - connector J4, Pin 3*/ + { + handleMeterTick(3); + IO2_INT_CLR |= (1<<3); + } + else if ((IO2_INT_STAT_R & (1 << 4)) != 0) /* P0.4 interrupt triggered - connector J4, Pin 4*/ + { + handleMeterTick(4); + IO2_INT_CLR |= (1<<4); } Index: /webserver/example/EnergyMeters/EnergyMeters/Common/Minimal/flash.c =================================================================== --- /webserver/example/EnergyMeters/EnergyMeters/Common/Minimal/flash.c (revision 34) +++ /webserver/example/EnergyMeters/EnergyMeters/Common/Minimal/flash.c (revision 42) @@ -66,7 +66,26 @@ #include "task.h" + +#include "FreeRTOS.h" +#include "semphr.h" +#include "task.h" +//#include "MetersIncludes.h" + /* Demo program include files. */ #include "partest.h" #include "flash.h" + +#include "emac.h" +#include "partest.h" +#include "portlcd.h" +#include "flash.h" + + +char meterMsg[] = "BLBL1234567"; + +extern xQueueHandle xLCDQueue; +xLCDMessage xMessage; +extern lcdText; +int testValue = 0; #define ledSTACK_SIZE configMINIMAL_STACK_SIZE @@ -101,4 +120,5 @@ unsigned portBASE_TYPE uxLED; + /* The parameters are not used. */ ( void ) pvParameters; @@ -132,4 +152,15 @@ vParTestToggleLED( uxLED ); + LCD_cls(); + xMessage.xColumn = 0; + xMessage.pcMessage = &meterMsg[0]; + itoa(testValue, &(meterMsg[0]), 10); + //testValue++; + + // xMessage.pcMessage = "FAIL"; + xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); + + + /* Delay for half the flash period then turn the LED off. */ vTaskDelayUntil( &xLastFlashTime, xFlashRate );