Exemplo n.º 1
0
//
//	Description:
//		Initialize all LED_871x objects.
//
void
rtl8188eu_InitSwLeds(
	_adapter	*padapter
	)
{
	struct led_priv *pledpriv = &(padapter->ledpriv);

	pledpriv->LedControlHandler = LedControlUSB;

	pledpriv->SwLedOn = SwLedOn_8188EU;
	pledpriv->SwLedOff = SwLedOff_8188EU;

	InitLed(padapter, &(pledpriv->SwLed0), LED_PIN_LED0);

	InitLed(padapter, &(pledpriv->SwLed1), LED_PIN_LED1);
}
void vibrate(int offMsec, int id)
{
	if (!InitLed()) return;
	LedOn(id);
	Sleep(offMsec);
	LedOff(id);
}
Exemplo n.º 3
0
int main(void)
{
	/* perform the needed initialization here */

	InitLed();

	currentLed = REDLED;
	LedOn(currentLed);

	for(;;){

		// Esperar para cambiar el estado del led
		for( i = counter ; i > 0 ; --i ){

		}

		ToggleLed(currentLed);

		switch(currentLed){
		case REDLED:
			currentLed = YELOWLED;
			break;
		case YELOWLED:
			currentLed = GREENLED;
			break;
		case GREENLED:
			currentLed = RGBLED_RED;
			break;
		case RGBLED_RED:
			currentLed = RGBLED_BLUE;
			break;
		case RGBLED_BLUE:
			currentLed = RGBLED_GREEN;
			break;
		case RGBLED_GREEN:
			currentLed = RGBLED_VIOLT;
			break;
		case RGBLED_VIOLT:
			currentLed = REDLED;
			break;
		default:
			break;
		}

		ToggleLed(currentLed);

		if( elapsedCycles < TOGGLE_CYCLES ){
			++elapsedCycles;
		}
		else{
			if( counter < accelCounter ){
				counter = 10000000;
			}
			counter = counter - accelCounter;
			elapsedCycles = 0;
		}

	}
	return 0;
}
Exemplo n.º 4
0
/** \brief Main function
 *
 * This is the main entry point of the software.
 *
 * \returns 0
 *
 * \remarks This function never returns. Return value is only to avoid compiler
 *          warnings or errors.
 */
int main(void)
{
	InitLed();
	InitTeclas();

	uint32_t i;
	edu_ciaa_ledRGB RGB;
    edu_ciaa_key mi_key;



	apagarLed(rojo);
	apagarLed(amarillo);
	apagarLed(verde);


	RGB.LEDrojo=ENCENDIDO;
    RGB.LEDverde=ENCENDIDO;
    RGB.LEDazul=ENCENDIDO;

   /* perform the needed initialization here */

   while(1) {



	   leerTeclas(& mi_key);

	   for (i=PERIODO; i!=0; i--)
       {
        asm ("nop");
       }

	   if(mi_key.Tecla_1==PULSADO)
	   {
		   toogleRGB(& RGB);
	   }
	   if(mi_key.Tecla_2==PULSADO)
	   {
		   toogle(rojo);
	   }
	   if(mi_key.Tecla_3==PULSADO)
	   {
	   	   toogle(amarillo);
	   }
	   if(mi_key.Tecla_4==PULSADO)
	   {
	  	   toogle(verde);
	   }


      /* add your code here */
   }


   return 0;


}/*este es el del main*/
void main()
{
	P2 = 0xF7;
	InitLed();
	InitTimer0();
	while(1)
		;
}
void SetLedStatus(int wLed, int wStatus)
{
	if (!InitLed()) return;
	NLED_SETTINGS_INFO nsi;
	nsi.LedNum = (INT) wLed;
	nsi.OffOnBlink = (INT) wStatus;
	pNLedSetDevice(NLED_SETTINGS_INFO_ID, &nsi);
}
int GetLedCount()
{
	if (!InitLed()) return 0;
	NLED_COUNT_INFO nci;
	int wCount = 0;
	if(pNLedGetDeviceInfo(NLED_COUNT_INFO_ID, (PVOID) &nci))
		wCount = (int) nci.cLeds;
	return wCount;
} 
Exemplo n.º 8
0
/******************************************************************************
* LED_Init
*
* Initialize the LED system.
*******************************************************************************/
void LED_Init(void)
{
  /* Create and init all LEDs */
  InitLed();
  
  /* allocate a timer for use in flashing LEDs */
  mLEDTimerID = TMR_AllocateTimer();
  TurnOffLeds();
}
Exemplo n.º 9
0
/****************************************************************************
* 程序入口函数
****************************************************************************/
void main(void)
{
    InitLed();		      //设置LED1相应的IO口
    InitKey();            //设置S1相应的IO口
    
    while(1)
    {
        if (KeyScan())    //按键按下则改变LED状态
            LED1 = ~LED1;       
    }
}
Exemplo n.º 10
0
void InitSystem(void)
{
	InitLed();
	InitUart();
	BluetoothInit();
	InitAdc();
	InitSensor();
	InitFan();
	InitRtc();
	InitSecondTimer();
}
Exemplo n.º 11
0
/*
 *	Description:
 *		Initialize all LED_871x objects.
 *   */
void
rtl8812ae_InitSwLeds(
	_adapter	*padapter
)
{
	struct led_priv *pledpriv = &(padapter->ledpriv);

	pledpriv->LedControlHandler = LedControlPCIE;

	if (IS_HARDWARE_TYPE_8812(padapter)) {
		pledpriv->SwLedOn = SwLedOn_8812AE;
		pledpriv->SwLedOff = SwLedOff_8812AE;
	} else {
		pledpriv->SwLedOn = SwLedOn_8821AE;
		pledpriv->SwLedOff = SwLedOff_8821AE;
	}

	InitLed(padapter, &(pledpriv->SwLed0), LED_PIN_LED0);

	InitLed(padapter, &(pledpriv->SwLed1), LED_PIN_LED1);
}
Exemplo n.º 12
0
int main(void)
{
    /* Reset of all peripherals, Initializes the Flash interface and the Systick. */
    HAL_Init();

    /* Configure the system clock */
    SystemClock_Config();

    InitLed();
    InitButton();

    //Initialization done separately
    //TODO: Add Clock and GPIO_Init to structure definitions
    Pinx Out_Pin_1 = SetPinx(GPIOD, GPIO_PIN_11);
    Pinx Out_Pin_2 = SetPinx(GPIOD, GPIO_PIN_13);
    Pinx In_Pin_1 = SetPinx(GPIOC, GPIO_PIN_1);
    Pinx In_Pin_2 = SetPinx(GPIOC, GPIO_PIN_3);

    Paddle paddle_1 = SetPaddle(In_Pin_1, Out_Pin_1, false);
    Paddle paddle_2 = SetPaddle(In_Pin_2, Out_Pin_2, false);

		//Keep in mind, Inverse Logic
		WritePinx(paddle_1.out,true);
		WritePinx(paddle_2.out,true);
	
    while (1)
    {
        if ((DebounceRead(paddle_1.in,DEBOUNCE_SAMPLING_N,DEBOUNCE_THRESHOLD) == GPIO_PIN_SET) && (paddle_1.state == false))	
        {	
            //int xyz = DebounceRead(paddle_1.in,DEBOUNCE_SAMPLING_N,DEBOUNCE_THRESHOLD);
            WritePinx(paddle_1.out,false);
            paddle_1.state = true;
            HAL_Delay(SHIFT_TIME_MS);
            WritePinx(paddle_1.out,true);
        }
        else if (DebounceRead(paddle_1.in,DEBOUNCE_SAMPLING_N,DEBOUNCE_THRESHOLD) == GPIO_PIN_RESET)
        {
            paddle_1.state = false;
        }
            
        if ((DebounceRead(paddle_2.in,DEBOUNCE_SAMPLING_N,DEBOUNCE_THRESHOLD) == GPIO_PIN_SET) && (paddle_2.state == false))	
        {	
            WritePinx(paddle_2.out,false);
            paddle_2.state = true;
            HAL_Delay(SHIFT_TIME_MS);
            WritePinx(paddle_2.out,true);
        }
        else if (DebounceRead(paddle_2.in,DEBOUNCE_SAMPLING_N,DEBOUNCE_THRESHOLD) == GPIO_PIN_RESET)
        {
            paddle_2.state = false;
        }
    }
}
Exemplo n.º 13
0
BOOL CDlgMotorMontior::OnInitDialog() 
{
	CDialog::OnInitDialog();

	m.Info.bSubDlgOpen = true;
	f.UpdateButtonState();

	// init button 
	m_btnOK.SetIcon(IDI_OK);;
	m_btnOK.SetAlign(CButtonST::ST_ALIGN_VERT);;
	m_btnOK.SetFlat(FALSE);
	
	m_btnCancel.SetIcon(IDI_CANCEL);
	m_btnCancel.SetAlign(CButtonST::ST_ALIGN_VERT);
	m_btnCancel.SetFlat(FALSE);

	m_btnModify.SetIcon(IDI_SAVE);
	m_btnModify.SetAlign(CButtonST::ST_ALIGN_VERT);
	m_btnModify.SetFlat(FALSE);

	m_btnTorque.SetIcon(IDI_MANUAL_TORQUE);
	m_btnTorque.SetAlign(CButtonST::ST_ALIGN_VERT);
	m_btnTorque.SetFlat(FALSE);

	m_bStop = false; 

	// Init Led 
	InitLed();

	// Init UI
	EnableUI();

	// Pre Select Motor
	OnSelect();

	// Set Timer for get Motor Status
	SetTimer(ID_TIME_GET_STATUS, _Status_Timer, NULL);

	// Pre set default value for each wnd
	UpdateData(FALSE);

	//
	f.SetTitleExtend(this, theApp.enTtileMachineFile );

	//
	f.ChangeLanguage(GetSafeHwnd());
	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 14
0
BOOL CDlgIOMontiorHandler::OnInitDialog() 
{
	CDialog::OnInitDialog();
	
	//
	InitLed();

	//
	InitTips();

	// Set Timer for get IO Status
	SetTimer(ID_TIME_GET_STATUS, _Status_Timer, NULL);

	
	return TRUE;  // return TRUE unless you set the focus to a control
	              // EXCEPTION: OCX Property Pages should return FALSE
}
Exemplo n.º 15
0
void main(void)
{
	uchar Key_Value;  //读出的键值		
	InitLed();
	InitKey();
	while(1)
	{
		P0 = 0xf0;//亮P0 = 0xff闪
                 //P1 = 0xff;			
		if(P0 != 0xf0)
		{
			Delay_1ms(15);	//按键消抖
			if(P0 != 0xf0)
			{
				Key_Value = Keyscan();		
			}
		}	         
		P1 = table[Key_Value % 16];		//显示低位键值		
		Delay_1ms(5);
	}
}
Exemplo n.º 16
0
void RgbLedInit(void){


	currentColor.red = 255;
	currentColor.green = 255;
	currentColor.blue = 255;

	cyclesPerPeriod = 20;

	ScaleColorToCycles();

	// Contadores para prender y apagar los leds
	timeBaseCounter = cyclesPerPeriod;		// Iniciar el contador base igual al periodo
	ellapsedRedCycles = 0;
	ellapsedGreenCycles = 0;
	ellapsedBlueCycles = 0;

	// Inicializar el led rbg y apagarlo
	InitLed();
	LedOff(RGBLED_RED);
	LedOff(RGBLED_GREEN);
	LedOff(RGBLED_BLUE);
}
Exemplo n.º 17
0
/** \brief Main function
 *
 * This is the main entry point of the software.
 *
 * \returns 0
 *
 * \remarks This function never returns. Return value is only to avoid compiler
 *          warnings or errors.
 */
int main(void)
{
	uint32_t i;
	edu_ciaa_ledRGB RGB;


    InitLed();

	prenderLed(rojo);
	apagarLed(rojo);
	apagarLed(amarillo);
	apagarLed(verde);

	apagarRGB(& RGB);

   /* perform the needed initialization here */

   while(1) {

toogle(amarillo);

	   RGB.LEDrojo=ENCENDIDO;
	   RGB.LEDverde=APAGADO;
	   RGB.LEDazul=APAGADO;
 for (i=PERIODO; i!=0; i--)
 {
 asm ("nop");
 }
	   toogleRGB(& RGB);



   RGB.LEDrojo=APAGADO;
   RGB.LEDverde=ENCENDIDO;
   RGB.LEDazul=APAGADO;

   for (i=PERIODO; i!=0; i--)
    {
    asm ("nop");
    }
   	   toogleRGB(& RGB);



RGB.LEDrojo=APAGADO;
RGB.LEDverde=APAGADO;
RGB.LEDazul=ENCENDIDO;

for (i=PERIODO; i!=0; i--)
 {
 asm ("nop");
 }
	   toogleRGB(& RGB);

   }


   return 0;


}/*este es el del mail*/