Changeset 42 for webserver

Show
Ignore:
Timestamp:
02/01/10 22:01:35 (15 years ago)
Author:
phil
Message:

merge with other version (from laptop) - now interrupts for more channels, LCD display used

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • webserver/example/EnergyMeters/EnergyMeters/Common/Minimal/flash.c

    r34 r42  
    6666#include "task.h" 
    6767 
     68 
     69#include "FreeRTOS.h" 
     70#include "semphr.h" 
     71#include "task.h" 
     72//#include "MetersIncludes.h" 
     73 
    6874/* Demo program include files. */ 
    6975#include "partest.h" 
    7076#include "flash.h" 
     77 
     78#include "emac.h" 
     79#include "partest.h" 
     80#include "portlcd.h" 
     81#include "flash.h" 
     82 
     83 
     84char meterMsg[] = "BLBL1234567"; 
     85 
     86extern xQueueHandle xLCDQueue; 
     87xLCDMessage xMessage; 
     88extern lcdText; 
     89int testValue = 0; 
    7190 
    7291#define ledSTACK_SIZE           configMINIMAL_STACK_SIZE 
     
    101120unsigned portBASE_TYPE uxLED; 
    102121 
     122 
    103123        /* The parameters are not used. */ 
    104124        ( void ) pvParameters; 
     
    132152                vParTestToggleLED( uxLED ); 
    133153 
     154                LCD_cls(); 
     155                xMessage.xColumn = 0; 
     156                xMessage.pcMessage = &meterMsg[0]; 
     157                itoa(testValue, &(meterMsg[0]), 10); 
     158                //testValue++; 
     159               
     160               // xMessage.pcMessage = "FAIL"; 
     161                xQueueSend( xLCDQueue, &xMessage, portMAX_DELAY ); 
     162 
     163 
     164 
    134165                /* Delay for half the flash period then turn the LED off. */ 
    135166                vTaskDelayUntil( &xLastFlashTime, xFlashRate ); 
  • webserver/example/EnergyMeters/Source/EnergyMeters/Meters.c

    r37 r42  
    1616portBASE_TYPE Init_P2_0(void); 
    1717void basementGasCalculation(void); 
     18 
     19xLCDMessage xMessage; 
     20char lcdText[]  = "a       "; 
     21 
    1822 
    1923portLONG basementGasReading = 0; 
     
    3943  // TODO: put this in again, right now it interferes with Solar UART3! 
    4044 
     45xMessage.pcMessage = &(lcdText[0]); 
    4146 
    4247  for( ;; ) 
     
    101106  IO2_INT_EN_F &= ~(1<<10); /* disable falling edge interrupt for P2:10 */ 
    102107 
     108  IO2_INT_EN_R |= (1<<0); /* enable rising edge interrupt for P2:0 */ 
     109  IO2_INT_EN_F &= ~(1<<0); /* disable falling edge interrupt for P2:0 */ 
     110  IO2_INT_EN_R |= (1<<1); /* enable rising edge interrupt for P2:1 */ 
     111  IO2_INT_EN_F &= ~(1<<1); /* disable falling edge interrupt for P2:1 */ 
     112  IO2_INT_EN_R |= (1<<2); /* enable rising edge interrupt for P2:2 */ 
     113  IO2_INT_EN_F &= ~(1<<2); /* disable falling edge interrupt for P2:2 */ 
     114  IO2_INT_EN_R |= (1<<3); /* enable rising edge interrupt for P2:3 */ 
     115  IO2_INT_EN_F &= ~(1<<3); /* disable falling edge interrupt for P2:3 */ 
     116  IO2_INT_EN_R |= (1<<4); /* enable rising edge interrupt for P2:4 */ 
     117  IO2_INT_EN_F &= ~(1<<4); /* disable falling edge interrupt for P2:4 */ 
     118 
    103119  VICVectAddr17 = (portLONG) vP2_0_ISR_Wrapper; /* EINT-3 interrupt handler */ 
    104120 
  • webserver/example/EnergyMeters/Source/EnergyMeters/Meters_ISRs.c

    r32 r42  
    44#include "MetersIncludes.h" 
    55 
     6 
     7#include "emac.h" 
     8#include "partest.h" 
     9#include "portlcd.h" 
     10#include "flash.h" 
     11 
    612extern xMetersSemaphore; 
    713extern xTickCount; /* millisecond tick counter */ 
    814 
    9 void handleGasMeterTick(void); 
     15 
     16int globalValue = 0; 
     17 
     18void handleMeterTick(portSHORT portNum); 
    1019 
    1120/* The interrupt entry point. */ 
     
    1827void vP2_0_ISR_Handler( void ) 
    1928{ 
     29extern int testValue; 
    2030  portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE; 
    2131 
    22   if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered */ 
     32  testValue++; 
     33  if ((IO2_INT_STAT_R & (1 << 10)) != 0) /* P2.10 interrupt triggered - SPI Load Switch */ 
    2334  { 
    24     handleGasMeterTick(); 
     35    handleMeterTick(10); 
     36    IO2_INT_CLR |= (1<<10); 
    2537  } 
    26  // else if ((IO2_INT_STAT_R & (1 << n)) != 0) /* some other interrupt triggered */ 
     38  else if ((IO2_INT_STAT_R & (1 << 0)) != 0) /* P0.0 interrupt triggered - connector J4, Pin 0*/ 
    2739  { 
    28     ; 
     40    handleMeterTick(0); 
     41    IO2_INT_CLR |= (1<<0); 
     42  } 
     43  else if ((IO2_INT_STAT_R & (1 << 1)) != 0) /* P0.1 interrupt triggered - connector J4, Pin 1*/ 
     44  { 
     45    handleMeterTick(1); 
     46    IO2_INT_CLR |= (1<<1); 
     47  } 
     48  else if ((IO2_INT_STAT_R & (1 << 2)) != 0) /* P0.2 interrupt triggered - connector J4, Pin 2*/ 
     49  { 
     50    handleMeterTick(2); 
     51    IO2_INT_CLR |= (1<<2); 
     52  } 
     53  else if ((IO2_INT_STAT_R & (1 << 3)) != 0) /* P0.3 interrupt triggered - connector J4, Pin 3*/ 
     54  { 
     55    handleMeterTick(3); 
     56    IO2_INT_CLR |= (1<<3); 
     57  } 
     58  else if ((IO2_INT_STAT_R & (1 << 4)) != 0) /* P0.4 interrupt triggered - connector J4, Pin 4*/ 
     59  { 
     60    handleMeterTick(4); 
     61    IO2_INT_CLR |= (1<<4); 
    2962  } 
    3063