void ButtonHandler(){ uint32_t mask=GPIOIntStatus(GPIO_PORTF_BASE,false); uint8_t value=0; if(mask & GPIO_PIN_4){ //Boton izquierdo value= GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4); if(value==0){ //boton pulsado // Activa el Timer4A (empezara a funcionar) TimerEnable(TIMER4_BASE, TIMER_A); pulsacionLarga=true; }else{ TimerDisable(TIMER4_BASE,TIMER_A); if(pulsacionLarga){ xEventGroupSetBits(xEventGroup, PilotoAutomaticoBit); if((xTaskCreate(PilAuto, (signed portCHAR *)"Piloto Auto", LED1TASKSTACKSIZE,NULL,tskIDLE_PRIORITY + 1, &PilautTaskHandle) != pdTRUE)) { while(1); } } } } if(mask & GPIO_PIN_0){ //boton derecho xEventGroupClearBits( xEventGroup, PilotoAutomaticoBit ); } GPIOIntClear(GPIO_PORTF_BASE,GPIO_PIN_0|GPIO_PIN_4); }
//***************************************************************************** // //! This is the Pulse Per Second (PPS) interrupt handler. //! The updateCounter is incremented on each Pulse per second call, if equal to //! the update rate, the GPS data is parsed and logged. // //***************************************************************************** void PortKIntHandler(void) { uint32_t intStatus = 0; // // Get the current interrupt status for Port K // intStatus = GPIOIntStatus(GPIO_PORTK_BASE,true); // // Clear the set interrupts for Port K // GPIOIntClear(GPIO_PORTK_BASE,intStatus); // // Execute code for PK2 interrupt // if((intStatus & GPIO_INT_PIN_2) == GPIO_INT_PIN_2){ if (updateRate == updateCounter++) { GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x02); gpsData(); GPIOPinWrite(GPIO_PORTN_BASE, GPIO_PIN_1, 0x00); updateCounter = 0; // // Disable PPS interrupt after one read if in low power mode // if (lowPowerOn == 1) { IntDisable(INT_GPIOK); logComplete = 1; } } } } // End function PortKIntHandler
void confGPIO(){ //Inicializa el puerto F (LEDs) --> No hace falta si usamos la libreria RGB // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // ROM_GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); //ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3, 0); //LEDS APAGADOS ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, GPIO_PIN_1|GPIO_PIN_2|GPIO_PIN_3); SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOE); //Inicializa los LEDs usando libreria RGB RGBInit(1); SysCtlPeripheralSleepEnable(GREEN_TIMER_PERIPH); SysCtlPeripheralSleepEnable(BLUE_TIMER_PERIPH); RGBEnable(); //Inicializamos los botones y su interrupción SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ButtonsInit(); GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_0|GPIO_INT_PIN_4); GPIOIntRegister(GPIO_PORTF_BASE,ButtonHandler); GPIOIntTypeSet(GPIO_PORTF_BASE,GPIO_INT_PIN_0|GPIO_INT_PIN_4, GPIO_BOTH_EDGES); GPIOIntEnable(GPIO_PORTF_BASE, GPIO_INT_PIN_0|GPIO_INT_PIN_4); SysCtlPeripheralSleepEnable(SYSCTL_PERIPH_GPIOF); }
void mode2unset() { GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); //Clear any existing interrupts GPIOIntDisable(GPIO_PORTF_BASE, GPIO_PIN_4); //Enable the GPIO Interrupts on Port F IntDisable(INT_TIMER1A); TimerIntDisable(TIMER1_BASE,TIMER_TIMA_TIMEOUT); }
/** * @brief interrupt handler, updates timer, when fired * * */ void PIOINT1_IRQHandler(void) { GPIOIntClear( TRIG_IN_PORT_1, TRIG_IN_PIN_1); /* detect change time */ timeLast1 = timeEdge1; timeEdge1 = millis(); }
//definition of isr for PORT F void GPIO_PORTF_isr(void) { uint32_t actual_GPIO_PORTF_status=((GPIO_PIN_0 | GPIO_PIN_4) & ~GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0 | GPIO_PIN_4)); switch (actual_GPIO_PORTF_status) { case GPIO_PIN_4: //if SW1 is pressed ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_1, GPIO_PIN_1); //turn on RED LED UARTprintf("RED LED on\n\r"); break; case GPIO_PIN_0: //if SW2 is pressed ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); //turn on BLUE LED UARTprintf("BLUE LED on\n\r"); break; case (GPIO_PIN_0|GPIO_PIN_4): //either SW1 and SW2 are pressed ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_1, GPIO_PIN_2 | GPIO_PIN_1); //turn on RED & BLUE LEDs UARTprintf("RED & BLUE LEDs on\n\r"); break; default: //neither SW1 nor SW2 are pressed ROM_GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2 | GPIO_PIN_1 , 0); //turn off RED & BLUE LEDs UARTprintf("RED & BLUE LEDs off\n\r"); break; } GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_0 | GPIO_INT_PIN_4); }
//***************************************************************************** // // Called by the NVIC as a result of GPIO port E interrupt event. For this // application GPIO port E pin 5 is the interrupt line for the ISL29023 // // Notifies the application that light is outside of threshold limits. // Task will poll the semaphore and adjust the ranges accordingly. // //***************************************************************************** void IntHandlerGPIOPortE(void) { unsigned long ulStatus; portBASE_TYPE xHigherPriorityTaskWoken; ulStatus = GPIOIntStatus(GPIO_PORTE_BASE, true); // // Clear all the pin interrupts that are set // GPIOIntClear(GPIO_PORTE_BASE, ulStatus); if(ulStatus & GPIO_PIN_5) { // // ISL29023 has indicated that the light level has crossed outside of // the intensity threshold levels set in INT_LT and INT_HT registers. // xSemaphoreGiveFromISR(g_xISL29023AdjustRangeSemaphore, &xHigherPriorityTaskWoken); // // If the give of this semaphore causes a task to be ready then // make sure it has opportunity to run immediately upon return from // this ISR. // if(xHigherPriorityTaskWoken == pdTRUE) { portYIELD_FROM_ISR(true); } } }
void decodeMatrixInput() { SysCtlDelay(1000000); // debounce wait uint32_t input = GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); if ((input & 0xF0) != 0xF0) // try to decode if something is pushed. { int i, row = -1, col = -1; for (i = 1; i < 5; i++) // get row { if (!(input & (8 << i))) row = i - 1; } for(i = 0; i < 4; i++) // get col { GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, 4 << i); if (GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7) & (16 << row)) { col = i; break; } } if (col != -1 && row != -1) activePattern = row * 4 + col; // get the char of the button. } GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_2|GPIO_PIN_3|GPIO_PIN_4|GPIO_PIN_5, 0); GPIOIntClear(GPIO_PORTC_BASE, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); SysCtlDelay(1000000); // wait to allow button to be lifted }
/** * @brief interrupt handler, updates timer, when fired * * */ void PIOINT2_IRQHandler(void) { GPIOIntClear( TRIG_IN_PORT_2, TRIG_IN_PIN_2); /* detect change time */ timeLast2 = timeEdge2; timeEdge2 = millis(); }
//***************************************************************************** // // Called by the NVIC as a result of GPIO port M interrupt event. For this // application GPIO port M pin 3 is the interrupt line for the MPU9150 // // For BoosterPack 2 Interface use Port M pin 7. // //***************************************************************************** void GPIOPortMIntHandler(void) { unsigned long ulStatus; // // Get the status flags to see which pin(s) caused the interrupt. // ulStatus = GPIOIntStatus(GPIO_PORTM_BASE, true); // // Clear all the pin interrupts that are set // GPIOIntClear(GPIO_PORTM_BASE, ulStatus); // // Check if this is an interrupt on the MPU9150 interrupt line. // // For BoosterPack 2 use Pin 7 instead. // if(ulStatus & GPIO_PIN_3) { // // Turn on the LED to show that transaction is starting. // LEDWrite(CLP_D3 | CLP_D4, CLP_D3); // // MPU9150 Data is ready for retrieval and processing. // MPU9150DataRead(&g_sMPU9150Inst, MPU9150AppCallback, &g_sMPU9150Inst); } }
/***************************************************** * Function: init_BtnHandler * Description: Initializes button interrupt * Initializes timer for button counter * Input: NONE * Output: NONE *****************************************************/ void init_BtnHandler(void) { // Unlock un-maskable pin HWREG(BTN_OVERRIDE_REG + GPIO_O_LOCK) = GPIO_LOCK_KEY; // Set up our interrupt for button presses IntMasterDisable(); // Disable all interrupts GPIOIntDisable(BTN_OVERRIDE_REG, BTN_OVERRIDE); GPIOPinTypeGPIOInput(BTN_OVERRIDE_REG, BTN_OVERRIDE); GPIOPadConfigSet(BTN_OVERRIDE_REG, BTN_OVERRIDE, GPIO_STRENGTH_4MA, GPIO_PIN_TYPE_STD_WPU); // Set Pull-up GPIOIntTypeSet(BTN_OVERRIDE_REG, BTN_OVERRIDE, GPIO_BOTH_EDGES); // Set edge to trigger on GPIOIntClear(BTN_OVERRIDE_REG, BTN_OVERRIDE); // Clear the interrupt bit GPIOIntEnable(BTN_OVERRIDE_REG, BTN_OVERRIDE); // Enable the interrupt IntEnable(INT_GPIOE); // Lock un-maskable pin HWREG(BTN_OVERRIDE_REG + GPIO_O_LOCK) = 0; // Setup timer interrupt for button pressing // This timer will run up and when it is released we will check how long it was running SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER0); TimerConfigure(BTN_OVERRIDE_TIM_BASE, TIMER_CFG_PERIODIC); // Setup interrupt as 32 bit timer counting up TimerLoadSet(BTN_OVERRIDE_TIM_BASE, BTN_OVERRIDE_TIM, clockTime/1000); // Load Timer IntEnable(INT_TIMER0A); TimerIntEnable(BTN_OVERRIDE_TIM_BASE, TIMER_TIMA_TIMEOUT); // Turn the input pin to the button high GPIOPinTypeGPIOOutput(BTN_OVERRIDE_CONTROL_REG, BTN_OVERRIDE_CONTROL); GPIOPinWrite(BTN_OVERRIDE_CONTROL_REG, BTN_OVERRIDE_CONTROL, BTN_OVERRIDE_CONTROL); }
void mode2set() { GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); //Clear any existing interrupts GPIOIntEnable(GPIO_PORTF_BASE, GPIO_PIN_4); //Enable the GPIO Interrupts on Port F TimerLoadSet(TIMER1_BASE, TIMER_A,SysCtlClockGet()/3); //Set the Max Value of the timer IntEnable(INT_TIMER1A); TimerIntEnable(TIMER1_BASE,TIMER_TIMA_TIMEOUT); //Enable Timer1 Interrupt }
/** Port E interrupt service routine @note Must be configured in startup_ccs.c or else will not be called. */ void IntGPIOe(void) { buttonIsr(0); // Button 0 was pressed #ifdef TIVA GPIOIntClear(GPIO_PORTE_BASE, GPIO_PIN_4); //Clear interrupts #else GPIOPinIntClear(GPIO_PORTE_BASE, GPIO_PIN_4); //Clear interrupts #endif }
void Interrupt_PB3Init(void) { GPIOIntRegister(GPIO_PORTB_BASE,Interrupt_PB3Handler); ROM_GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, GPIO_PIN_3); ROM_GPIOPadConfigSet(GPIO_PORTB_BASE,GPIO_PIN_3,GPIO_STRENGTH_2MA,GPIO_PIN_TYPE_STD_WPU); GPIOIntDisable(GPIO_PORTB_BASE,GPIO_INT_PIN_3); GPIOIntClear(GPIO_PORTB_BASE,GPIO_INT_PIN_3); GPIOIntTypeSet(GPIO_PORTB_BASE,GPIO_INT_PIN_3,GPIO_LOW_LEVEL); }
void onButtonUp(void) { if (GPIOIntStatus(GPIO_PORTF_BASE, false) & GPIO_PIN_4) { // PF4 was interrupt cause printf("Button Up\n"); GPIOIntRegister(GPIO_PORTF_BASE, onButtonDown); // Register our handler function for port F GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_FALLING_EDGE); // Configure PF4 for falling edge trigger GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); // Clear interrupt flag } }
// Interrupt handler for the GPIO motion detector signal void GPIOMotionDetectorIsr(void) { GPIOIntClear(GPIO_PORTA_BASE, GPIO_INT_PIN_2 | GPIO_INT_PIN_5); #ifdef RUN_AS_MASTER motionDetectorTrigged = 1; #else IRIntHandler(); #endif }
//Called when detect SRDY goes low first void POLL(){ //MRDY Goes LOW (assuming SRDY is LOW) MRDY_write(0); //Send POLL command to CC2530 //TODO: Check if the the Type data is also Zero uint8_t *nullByte = (uint8_t *)malloc(1); nullByte = ""; SPI_transfer(nullByte,1); //free(nullByte); //Start To Recieve Data when SRDY goes HIGH uint8_t *RX_data = malloc(254); uint16_t count = 0; while (!SRDY_read()){ SPI_receive(RX_data+count,1); count++; } //call a management function //Give the data return from function to cc2530 //Here We call the registerd function to provide dataToReturn commandPasre(RX_data); //MRDY Goes HIGH MRDY_write(1); free(RX_data); //Clear Interrupt //GPIO_PORTA_ICR_R = 0xFFFFFFFF; GPIOIntClear(GPIO_PORTA_BASE,0x00000080); /* SPI_receive(RX_data,1); length = *RX_data; free(RX_data); RX_data= malloc(sizeof(length+3)); RX_data[0] = length; SPI_receive(RX_data+1,length+2); */ }
void interrupt_handler(void) { GPIOIntClear(GPIO_PORTB_BASE, GPIO_INT_PIN_2); if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_2) == 0x0) { isr_flag = 1; } }
void interrupt_handler(void) { GPIOIntClear(GPIO_PORTF_BASE, GPIO_INT_PIN_2 | GPIO_INT_PIN_3); if(GPIOPinRead(port_F, GPIO_PIN_2) == 0x0) { display_flag = 1; } }
void brakeHandler(){ GPIOIntClear(GPIO_PORTB_BASE, GPIO_INT_PIN_0); if(GPIOPinRead(GPIO_PORTB_BASE, GPIO_PIN_0) == 0x0) { enableSys = 0; } }
/* * ======== WiFiCC3100_open ======== */ WiFi_Handle WiFiCC3100_open(WiFi_Handle handle, unsigned int spiIndex, WiFi_evntCallback evntCallback, WiFi_Params *params) { unsigned int key; WiFiCC3100_Object *object = handle->object; WiFiCC3100_HWAttrs const *hwAttrs = handle->hwAttrs; union { #if !defined(MSP430WARE) Hwi_Params hwiParams; #endif Semaphore_Params semParams; } paramsUnion; key = Hwi_disable(); if (object->isOpen) { Hwi_restore(key); Log_warning0("WiFi Hwi already in use."); return (NULL); } object->isOpen = true; Hwi_restore(key); /* Construct semaphores to block read/write transactions. */ Semaphore_Params_init(&(paramsUnion.semParams)); paramsUnion.semParams.mode = Semaphore_Mode_BINARY; paramsUnion.semParams.instance->name = "WiFi.writeSemaphore"; Semaphore_construct(&(object->writeSemaphore), 0, &(paramsUnion.semParams)); paramsUnion.semParams.instance->name = "WiFi.readSemaphore"; Semaphore_construct(&(object->readSemaphore), 0, &(paramsUnion.semParams)); #if !defined(MSP430WARE) Hwi_Params_init(&(paramsUnion.hwiParams)); paramsUnion.hwiParams.arg = (UArg) handle; paramsUnion.hwiParams.enableInt = false; /* Hwi_construct cannot fail, use NULL instead of an Error Block */ Hwi_construct(&(object->wifiHwi), hwAttrs->irqIntNum, WiFiCC3100_hostIntHandler, &(paramsUnion.hwiParams), NULL); #endif #if defined(MSP430WARE) || defined(MSP432WARE) MAP_GPIO_clearInterruptFlag(hwAttrs->irqPort, hwAttrs->irqPin); MAP_GPIO_enableInterrupt(hwAttrs->irqPort, hwAttrs->irqPin); #else GPIOIntClear(hwAttrs->irqPort, hwAttrs->irqPin); GPIOIntEnable(hwAttrs->irqPort, hwAttrs->irqPin); #endif /* Store SPI interface parameters */ object->spiIndex = spiIndex; object->bitRate = params->bitRate; return (handle); }
void onButtonDown(void) { if (GPIOIntStatus(GPIO_PORTF_BASE, false) & GPIO_PIN_4) { /*The GPIOIntStatus returns the value of the GPIORIS register and in this case, AND's it with the Pin 4 mask. So if the condition for the interrupt has occurred for the Pin then the if statement is true.*/ // PF4 was interrupt cause printf("Button Down\n"); GPIOIntRegister(GPIO_PORTF_BASE, onButtonUp); // Register our handler function for port F GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_RISING_EDGE); // Configure PF4 for rising edge trigger GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); // Clear interrupt flag } }
void PIOINT0_IRQHandler(void) { uint32_t regVal; regVal = GPIOIntStatus( PORT0, 7 ); if ( regVal ) { SingleResponseIsr(); GPIOIntClear( PORT0, 7 ); } return; }
void interrupt_setup(void) { // Interrupt setuü GPIOIntDisable(GPIO_PORTF_BASE, GPIO_PIN_4); // Disable interrupt for PF4 (in case it was enabled) GPIOIntClear(GPIO_PORTF_BASE, GPIO_PIN_4); // Clear pending interrupts for PF4 GPIOIntRegister(GPIO_PORTF_BASE, onButtonDown); // Register our handler function for port F GPIOIntTypeSet(GPIO_PORTF_BASE, GPIO_PIN_4, GPIO_FALLING_EDGE); // Configure PF4 for falling edge trigger GPIOIntEnable(GPIO_PORTF_BASE, GPIO_PIN_4); // Enable interrupt for PF4 }
/** Port F interrupt service routine @note Must be configured in startup_ccs.c or else will not be called. */ void IntGPIOf(void) { uint32_t buttonState = GPIOPinRead(GPIO_PORTF_BASE, ALL_BUTTONS); if ((~buttonState) & LEFT_BUTTON) buttonIsr(1); else if ((~buttonState) & RIGHT_BUTTON) buttonIsr(2); #ifdef TIVA GPIOIntClear(GPIO_PORTF_BASE, ALL_BUTTONS); //Clear interrupts #else GPIOPinIntClear(GPIO_PORTF_BASE, ALL_BUTTONS); //Clear interrupts #endif }
/***************************************************************************** ** Function name: PIOINT2_IRQHandler ** ** Descriptions: Use one GPIO pin(port2 pin1) as interrupt source ** ** parameters: None ** Returned value: None ** *****************************************************************************/ void PIOINT2_IRQHandler(void) { uint32_t regVal; gpio2_counter++; regVal = GPIOIntStatus( PORT2, 1 ); if ( regVal ) { p2_1_counter++; GPIOIntClear( PORT2, 1 ); } return; }
/***************************************************************************** ** Function name: PIOINT1_IRQHandler ** ** Descriptions: Use one GPIO pin(port1 pin1) as interrupt source ** ** parameters: None ** Returned value: None ** *****************************************************************************/ void PIOINT1_IRQHandler(void) { uint32_t regVal; gpio1_counter++; regVal = GPIOIntStatus( PORT1, 4 ); if ( regVal ) { p1_1_counter++; GPIOIntClear( PORT1, 4 ); } return; }
//Button interrupt handler void interrupt_handler(void){ //Clear the interrupt ports GPIOIntClear(GPIO_PORTC_BASE, GPIO_INT_PIN_5 | GPIO_INT_PIN_6); if(GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_5) == 0x20){ frequency -= 10000;} if(GPIOPinRead(GPIO_PORTC_BASE, GPIO_PIN_6) == 0x40){ frequency += 10000;} //Set new timer frequency TimerLoadSet(TIMER0_BASE, TIMER_A, frequency); }
/************ FUNCTION DEFINITIONS ****************/ void modeselect(void) { if(GPIOIntStatus(GPIO_PORTF_BASE,false) & GPIO_INT_PIN_0) { GPIOIntClear(GPIO_PORTF_BASE,GPIO_PIN_0); for(i=0;i<2000;i++); if (GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_0)==0) { mode++; if (mode==6) mode = 1; switch(mode) //According to mode, initialize peripherals and disable other peripherals { case 1: mode2unset(); mode3unset(); mode4unset(); mode5unset(); mode1set(); break; case 2: mode1unset(); mode3unset(); mode4unset(); mode5unset(); mode2set(); break; case 3: mode2unset(); mode1unset(); mode4unset(); mode5unset(); mode3set(); break; case 4: mode2unset(); mode1unset(); mode3unset(); mode5unset(); mode4set(); break; case 5: mode2unset(); mode1unset(); mode4unset(); mode3unset(); mode5set(); break; } } } if((GPIOIntStatus(GPIO_PORTF_BASE,false)&GPIO_INT_PIN_4)&& (mode==2||mode==5)) { GPIOIntClear(GPIO_PORTF_BASE,GPIO_PIN_4); if(!GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_4)) { mode2(); TimerLoadSet(TIMER1_BASE, TIMER_A,SysCtlClockGet()/3); //Set the Max Value of the timer TimerEnable(TIMER1_BASE,TIMER_A); //Start the timer } else { TimerDisable(TIMER1_BASE,TIMER_A); fast_flag=0; } } }
/* * This is the interrupt handler for the button that changes the LEDs brightness */ void PortFIntHandler(){ uint32_t status=0; status = GPIOIntStatus(GPIO_PORTF_BASE,true); GPIOIntClear(GPIO_PORTF_BASE,status); if( GPIOPinRead(GPIO_PORTF_BASE,GPIO_PIN_1) == 0) Maxbrilho = 255; else Maxbrilho = 50; MudaPadrao = 1; }