Exemple #1
0
void
rb_call_inits()
{
    Init_sym();
    Init_var_tables();
    Init_Object();
    Init_Comparable();
    Init_Enumerable();
    Init_Precision();
    Init_eval();
    Init_String();
    Init_Exception();
    Init_Thread();
    Init_Numeric();
    Init_Bignum();
    Init_Array();
    Init_Hash();
    Init_Struct();
    Init_Regexp();
    Init_pack();
    Init_Range();
    Init_IO();
    Init_Dir();
    Init_Time();
    Init_Random();
    Init_signal();
    Init_process();
    Init_load();
    Init_Proc();
    Init_Math();
    Init_GC();
    Init_marshal();
    Init_version();
}
Exemple #2
0
void
rb_call_inits()
{
    Init_PreSymbol();
    Init_id();
    Init_var_tables();
    Init_Object();
    Init_Class();
    Init_VM();
    Init_Encoding();
    Init_Comparable();
    Init_Enumerable();
    Init_Precision();
    Init_String();
    Init_Symbol();
    Init_Exception();
    Init_eval();
    Init_jump();
    Init_Numeric();
    Init_Bignum();
    Init_syserr();
    Init_Array();
    Init_Hash();
    Init_ENV();
    Init_Struct();
    Init_Regexp();
    Init_pack();
    Init_marshal();
    Init_Range();
    Init_IO();
    Init_Dir();
    Init_Time();
    Init_Random();
    Init_signal();
    Init_process();
    Init_load();
    Init_Proc();
    Init_Binding();
    Init_Math();
    Init_GC();
    Init_Enumerator();
    Init_Thread();
    //Init_Cont();
    Init_Rational();
    Init_Complex();
    Init_version();
    Init_PostGC();
    Init_ObjC();
    Init_BridgeSupport();
    Init_FFI();
    Init_Dispatch();
    Init_Transcode();
    Init_sandbox();
    Init_PostVM();
}
Exemple #3
0
void
rb_call_inits()
{
    Init_sym();
    Init_id();
    Init_var_tables();
    Init_Object();
    Init_top_self();
    Init_Encoding();
    Init_Comparable();
    Init_Enumerable();
    Init_Precision();
    Init_String();
    Init_Exception();
    Init_eval();
    Init_jump();
    Init_Numeric();
    Init_Bignum();
    Init_syserr();
    Init_Array();
    Init_Hash();
    Init_Struct();
    Init_Regexp();
    Init_pack();
    Init_transcode();
    Init_marshal();
    Init_Range();
    Init_IO();
    Init_Dir();
    Init_Time();
    Init_Random();
    Init_signal();
    Init_process();
    Init_load();
    Init_Proc();
    Init_Binding();
    Init_Math();
    Init_GC();
    Init_Enumerator();
    Init_VM();
    Init_ISeq();
    Init_Thread();
    Init_Cont();
    Init_version();
}
Exemple #4
0
int main(int argc, char **argv)
{
    int iFd,iNum;
    char *lspTmp;
  char sTmpFile[125]="";
    char sMoniTxnFile[125]="";
    char sCurrentTime[15];
    int ivalue;
    int iSleep=0;
    
    initial();
    
    giSleep=5;
    gch=0;
    giCurOffset=0;
    giCurRow=0;
    if( argc !=3 )
    {
           printf("USGE:%s [ -d date ] [ -s sleep]\n",argv[0]);
           exit(0);
  }
  
  memset(gsCurrentDate,0x00,sizeof(gsCurrentDate));
  if( argv[1][1] == 'd' )
      memcpy(gsCurrentDate,argv[2],8);
  else
  {
         memset(sCurrentTime,0x00,sizeof(sCurrentTime));
       CommonGetCurrentTime (sCurrentTime);
       memcpy(gsCurrentDate,sCurrentTime,8);
  }      
  
  sprintf (gsLogFile, "txtmon_%8.8s.log",gsCurrentDate);
  
  if( argv[1][1] == 's' )
      giSleep=atoi(argv[2]);
  else 
        giSleep=0;
      
    putenv("TERM=vt100");
  if((lspTmp = getenv("MONI_TXT_FILE")) == NULL)
  {
        HtLog (gsLogFile, HT_LOG_MODE_ERROR, __FILE__,__LINE__,
              "Call getenv(TXT_MONI_FILE, error %d", errno);
        return -1;
  }
  strcpy(sMoniTxnFile,lspTmp);
  CommonAllTrim(sMoniTxnFile);
  
  HtLog (gsLogFile, HT_LOG_MODE_ERROR, __FILE__,__LINE__,"sMoniTxnFile[%s]",sMoniTxnFile);
  HtLog (gsLogFile, HT_LOG_MODE_NORMAL, __FILE__,__LINE__, "giCurRow[%d] giCurOffset[%d]",
                  giCurRow,giCurOffset);
    if (giSleep >0 )
    {
              signal(SIGINT,out_p);
              while(1)
            {    
                Init_Time();
                if(OpenFile(&iFd,sMoniTxnFile,&iNum))
                {
                    Clear_Display(DISPLAY_TOP,DISPLAY_LEFT,DISPLAY_HIGH,DISPLAY_WIDTH);
                    ShowWin(iFd,iNum);
                    close(iFd);
                }
                
                refresh();
                sleep(giSleep);
                gch=0;
          }
          
    }else
    {
        setjmp(env);
        signal(SIGALRM,timeout_p);
        signal(SIGINT,out_p);
        while(1)
        {    
            Init_Time();
            if(OpenFile(&iFd,sMoniTxnFile,&iNum))
            {
                Clear_Display(DISPLAY_TOP,DISPLAY_LEFT,DISPLAY_HIGH,DISPLAY_WIDTH);
                ShowWin(iFd,iNum);
                close(iFd);
            }
            
            refresh();
            alarm(1);
            gch=getch();
            alarm(0);
      } 
   }
}
int main(void)
{
	//printf("Main()\r\n"); //SEMIHOSTING DEBUG OUT
	// LED lamp 12800 MAX (before no response, wont turn on) But a few second delay before Diode saturation (light comes on)
	// 12400 - min for reasonable saturation delay
	dimmingValue = 11000; // 12600

	//printf("RCC clocks Str\r\n"); //SEMIHOSTING DEBUG OUT
	RCC_APB1PeriphClockCmd(RCC_APB1Periph_USART3,ENABLE); // ESP8266 - Wifi
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOB,ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_AFIO, ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_GPIOA, ENABLE);
	RCC_APB2PeriphClockCmd(RCC_APB2Periph_USART1, ENABLE);
	//printf("RCC clocks Fin\r\n"); //SEMIHOSTING DEBUG OUT


	POWER_LED_Config.GPIO_Speed = GPIO_Speed_50MHz;
	POWER_LED_Config.GPIO_Mode = GPIO_Mode_Out_PP;
	POWER_LED_Config.GPIO_Pin = GPIO_Pin_0 | GPIO_Pin_1 | GPIO_Pin_6; // PB1 - Maple On-board LED | PB6 - Maple Pin 16 | PB0 - CH_PD (Power ON) Pin for ESP8266 Wifi
	GPIO_Init(GPIOB,&POWER_LED_Config);

	//SetArray_Size(USART3_RxBuffer,RxBuffSize);

	//printf("GPIO Port: B Pins: 0,1,6 Fin\r\n"); //SEMIHOSTING DEBUG OUT

		GPIOB->BRR = GPIO_Pin_0; // Power OFF for ESP8266
		//printf("ESP8266 Powered OFF (CH01 Pin Disabled (Pulled Low))\r\n"); //SEMIHOSTING DEBUG OUT
		GPIOB->BSRR = GPIO_Pin_1; // PB1 - Maple On-board LED
		GPIOB->BRR = GPIO_Pin_6; // PB6 - Maple Pin 16
		GPIOB->BSRR = GPIO_Pin_0; // Power On for ESP8266
		//printf("ESP8266 Powered ON\r\n"); //SEMIHOSTING DEBUG OUT
	GPIO_EXTILineConfig(GPIO_PortSourceGPIOB,GPIO_PinSource14);

	ZeroCross_Config.GPIO_Mode = GPIO_Speed_50MHz;
	ZeroCross_Config.GPIO_Mode = GPIO_Mode_IPD;
	ZeroCross_Config.GPIO_Pin = GPIO_Pin_14; // PB14 - Maple Pin 29
	GPIO_Init(GPIOB,&ZeroCross_Config);
	//printf("GPIOB Pin 14 configured for Zero-Crossing detection (Maple Pin 29)\r\n"); //SEMIHOSTING DEBUG OUT

	Button_Config.GPIO_Mode = GPIO_Mode_IN_FLOATING;
	Button_Config.GPIO_Speed = GPIO_Speed_50MHz;
	Button_Config.GPIO_Pin = GPIO_Pin_8 | GPIO_Pin_7;
	GPIO_Init(GPIOB,&Button_Config);
	//printf("GPIOB Pin 14 configured for Zero-Crossing detection (Maple Pin 29)\r\n"); //SEMIHOSTING DEBUG OUT



	//Init_USART3(460800,ENABLE);
	//Init_USART1(460800,ENABLE);

	//*********USE USART3 Rx in DMA Mode
	#define ESP_RX_DMA_BUF_POLL_Interval_ms 1000 //Every 1 Sec check the Rx Buffer
	//uint32_t LastRxBufferReadTime = 0;
	Init_USART3_DMA(2000000,USART3_RxBuffer, USART3_RxBufferSize);

	//*********USE USART3 Rx in DMA Mode


	//Init_USART3(2000000,ENABLE);
	//Init_USART1(2000000,ENABLE);

	//for (mj=0;mj<500000;mj++);// FOR TESTING

	//for (mj=0;mj<5000;mj++);// FOR TESTING
	//Need to wait for a sec before transmitting data. Let ESP8266 power on
	//for (mj=0;mj<500000;mj++); // FOR TESTING


	//USART_SendData(USART3,"AT/r/n");

	ConfigZeroCrossExternalInt();
	ConfigZeroCross_NVIC();
	Init_Time(MILLISEC);

	//for (mj=0;mj<20500;mj++);
	//Wifi_Init();
	//printf("Wifi_Init() Complete\r\n"); //SEMIHOSTING DEBUG OUT
	//for (mj=0;mj<20500;mj++);
	for (mj=0;mj<130500;mj++);
	//ConnectToAP("Nonya","porsche911");
	//for (mj=0;mj<70500;mj++);
	//printf("Preparing to start local ESP8266 server at ID: 1 Port: 80\r\n"); //SEMIHOSTING DEBUG OUT
	Wifi_SendCommand(WIFI_JOIN_NONYA);
	StartServer(1,80);

	Wifi_SendCommand(WIFI_GET_CURRENT_IP);

	//Sets data of first few bites of DMA so it doesn't start with 12 null terminators.
	USART3_RxBuffer[0] = "1";
	USART3_RxBuffer[1] = "1";
	USART3_RxBuffer[2] = "1";
	USART3_RxBuffer[3] = "1";
	USART3_RxBuffer[4] = "1";
	USART3_RxBuffer[5] = "1";
	USART3_RxBuffer[6] = "1";
	USART3_RxBuffer[7] = "1";
	USART3_RxBuffer[8] = "1";
	USART3_RxBuffer[9] = "1";
	USART3_RxBuffer[10] = "1";
	USART3_RxBuffer[11] = "1";
	USART3_RxBuffer[12] = "1";



	//Main Run Loop
	for(;;)
    {

		if(restRequestWaiting == 1)
		{
			SendRESTResponse(activeConnectionNum,RESTResponse_Headers_Test_OK,RESTResponse_Body_TEST_JSON);
		}
      //This Polls the dma buffer ever [poll interval] For new incoming data from esp (Starting with +IPD)
		if((Millis() - lastDMABuffPoll) >= DMA_Rx_Buff_Poll_Int_ms)
		{
			lastDMABuffPoll = Millis();
			currentIPD = Wifi_CheckDMABuff_ForIPDData();
			if(currentIPD.Valid == 1)
			{
				SendRESTResponse(currentIPD.ConnectionNum, RESTResponse_Headers_Test_OK, customRESTResponse);
			}
		}
		//Check for data to transmit USART3

		if(GPIO_ReadInputDataBit(GPIOB,GPIO_Pin_8)) // Power cycle the ESP8266
		{
			Wifi_SendCommand(Command_To_Redirect);
			for (mj=0;mj<130500;mj++);//debounce
		}
    }
}