//***************************************************************************** // // Interrupt handlers // //***************************************************************************** void SysTickIntHandler(void){ // Handle state changes if (done){ tick++; if (tick>1){ if (lose){ // Turn off the noise PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, false); PWMGenDisable(PWM0_BASE, PWM_GEN_0); unsigned long ulPeriod = SysCtlClockGet() / 220; // Set the PWM period to 220 (A) Hz. PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, ulPeriod); // Make some noise again PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, true); PWMGenEnable(PWM0_BASE, PWM_GEN_0); } } if (tick>2){ if (lose){ // Turn off the noise PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, false); PWMGenDisable(PWM0_BASE, PWM_GEN_0); unsigned long ulPeriod = SysCtlClockGet() / 440; // Set the PWM period to 440 (A) Hz. again PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, ulPeriod); lose = 0; } if (state==1){ startClassic(); tick = 0; done = 0; } else if(state==2){ if(tick>4){ RIT128x96x4Clear(); initMain(); state = 0; pointer = 0; tick = 0; done = 0; } } else if (state==3){ startContinuous(); tick = 0; done = 0; } } } }
void GPIOFIntHandler(void) { // Clear the GPIO interrupt. GPIOPinIntClear(GPIO_PORTF_BASE, GPIO_PIN_1); y = 0; // Counter for how long the snooze button was pressed while (GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_1)==0){ y++; } // If the snooze button was held long enough, add 5 minutes to the alarm if (y>500000){ int z; for (z=0; z<5; z++){ IncrementTimeA(); } } // Clear the screen RIT128x96x4Clear(); // Turn off the LED GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_2, GPIO_PIN_2); // Turn off the alarm PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT | PWM_OUT_1_BIT, false); PWMGenDisable(PWM0_BASE, PWM_GEN_0); // Disable the interrupt so that snooze and turn off alarm cannot be used GPIOPinIntDisable(GPIO_PORTF_BASE, GPIO_PIN_1); }
//-------------------------------- void pwm_stepper::Stop(bool bHard) { if (bHard) { PWMGenDisable(Base, Generator); } else { m_nSteps = ((Default_StartSpeed - m_nSpeed) / m_nDeceleration); } }
/* * ======== PWMTiva_close ======== * @pre Function assumes that the handle is not NULL */ void PWMTiva_close(PWM_Handle handle) { unsigned int key; uint8_t pwmPairOutput; PWMTiva_Object *object = handle->object; PWMTiva_HWAttrs const *hwAttrs = handle->hwAttrs; PWMTiva_setDuty(handle, 0); PWMOutputState(hwAttrs->baseAddr, hwAttrs->pwmOutput, false); key = Hwi_disable(); pwmPairOutput = (hwAttrs->pwmOutput & 0x01) ? object->pwmOutputBit >> 1 : object->pwmOutputBit << 1; /* Disable PWM generator only if the pair output is not being used. */ if (!((object->pwmStatus)->activeOutputs & pwmPairOutput)) { PWMGenDisable(hwAttrs->baseAddr, hwAttrs->pwmOutput & PWM_GEN_MASK); *((object->pwmStatus)->genPeriods + ((hwAttrs->pwmOutput / PWM_OUT_0) - 1)) = 0; } (object->pwmStatus)->activeOutputs &= ~(object->pwmOutputBit); if (!(object->pwmStatus)->activeOutputs) { /* PWM completely off, clear all settings */ (object->pwmStatus)->cyclesPerMicroSec = 0; (object->pwmStatus)->prescalar = 0; } Hwi_restore(key); Log_print1(Diags_USER1, "PWM: (%p) closed", (UArg) handle); }
void InitGPIO (void) { // GPIO test initialisation SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0 | SYSCTL_PERIPH_PWM); SysCtlPWMClockSet(SYSCTL_PWMDIV_1); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // airspeed output SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); // transponder output SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); // airspeed response pin SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); // transponder response pin // Configure airspeed input GPIOPinTypeGPIOInput(GPIO_PORTE_BASE, UUT_AIRSPEED_RESPONSE_PIN_PE3); GPIOIntTypeSet(GPIO_PORTE_BASE, UUT_AIRSPEED_RESPONSE_PIN_PE3, GPIO_RISING_EDGE); GPIOPortIntRegister(GPIO_PORTE_BASE, &airspeed_response_isr); // Configure transponder input GPIOPinTypeGPIOInput(GPIO_PORTB_BASE, UUT_TRANSPONDER_RESPONSE_PIN_PB3); GPIOIntTypeSet(GPIO_PORTB_BASE, UUT_TRANSPONDER_RESPONSE_PIN_PB3, GPIO_RISING_EDGE); GPIOPortIntRegister(GPIO_PORTB_BASE, &transponder_response_isr); // Configure airspeed pulse generation GPIOPinTypePWM(GPIO_PORTD_BASE, (1<<1)); // Airspeed output TODO: make pin macro PWMGenDisable(PWM0_BASE, PWM_GEN_0); PWMIntDisable(PWM0_BASE, PWM_GEN_0); PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_LOAD); // configure pwm for end-of-cycle interrupt PWMGenIntRegister(PWM0_BASE, PWM_GEN_0, airspeed_pulse_isr); // Configure transponder pulse generation GPIOPinTypePWM(GPIO_PORTF_BASE, (1<<3)); // Transponder output TODO: make pin macro PWMGenDisable(PWM0_BASE, PWM_GEN_2); PWMIntDisable(PWM0_BASE, PWM_GEN_2); PWMGenConfigure(PWM0_BASE, PWM_GEN_2, PWM_GEN_MODE_DOWN); PWMGenIntTrigEnable(PWM0_BASE, PWM_GEN_2, PWM_INT_CNT_LOAD); // configure pwm for end-of-cycle interrupt PWMGenIntRegister(PWM0_BASE, PWM_GEN_2, transponder_pulse_isr); // Configure UUT reset signal SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypeGPIOOutput(GPIO_PORTG_BASE, GPIO_PIN_4); GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_4, GPIO_PIN_4); }
// Upon the PWM rising edge, the current system time is measured, a counter is incremented // and the number of pulses generated to that point is checked. void transponder_pulse_isr(void) { PWMGenIntClear(PWM0_BASE, PWM_GEN_2, PWM_INT_CNT_LOAD); if(g_transponder_pulse_count >= 0) g_transponder_times[g_transponder_pulse_count] = stopwatch_get_time_us(&g_transponder_stopwatch); //TODO: consider if the response hasnt occured g_transponder_pulse_count++; stopwatch_start(&g_transponder_stopwatch); if (g_transponder_pulse_count >= g_num_pulses) PWMGenDisable(PWM0_BASE, PWM_GEN_2); }
// Save as the first airspeed pulse gen ISR as above, however // The PWM module is disabled after 3 pulses are generated void airspeed_pulse_isr_gpio_test_b(void) { PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_LOAD); if(g_airspeed_pulse_count >= 1) // Proccess last latency measurement g_airspeed_times[g_airspeed_pulse_count] = stopwatch_get_time_us(&g_airspeed_stopwatch); // Increment the pulse count if output is currently enabled and disable output // if two pulses have been generated g_airspeed_pulse_count += 1 - test_b_output_toggle(); stopwatch_start(&g_airspeed_stopwatch); if (g_airspeed_pulse_count >= MAX_NUM_PULSES) PWMGenDisable(PWM0_BASE, PWM_GEN_0); }
// Upon the PWM rising edge, the current system time is measured, a counter is incremented // and the number of pulses generated to that point is checked. void airspeed_pulse_isr(void) { PWMGenIntClear(PWM0_BASE, PWM_GEN_0, PWM_INT_CNT_LOAD); //GPIOPinWrite(GPIO_PORTC_BASE, (1<<2), (1<<2)); // debug if(g_airspeed_pulse_count >= 0) // Proccess last latency measurement g_airspeed_times[g_airspeed_pulse_count] = stopwatch_get_time_us(&g_airspeed_stopwatch); g_airspeed_pulse_count++; stopwatch_start(&g_airspeed_stopwatch); if (g_airspeed_pulse_count >= g_num_pulses) PWMGenDisable(PWM0_BASE, PWM_GEN_0); //GPIOPinWrite(GPIO_PORTC_BASE, (1<<2), ~(1<<2)); // debug }
//-------------------------------- void pwm_stepper::OnInterrupt() { m_nSteps--; if (0 >= m_nSteps) { m_nSteps = 0; m_nPhase = Phase_Stop; } if (m_bDirectionForward) { m_nRelativeSteps++; } else { m_nRelativeSteps--; } switch (m_nPhase) { case Phase_Accel: m_nSpeed -= m_nAcceleration; if (m_nTargetSpeed >= m_nSpeed) { m_nSpeed = m_nTargetSpeed; m_nPhase = Phase_Steady; } PWMGenPeriodSet(Base, Generator, m_nSpeed); PWMPulseWidthSet(Base, PWM_OUT_2, 64); PWMGenEnable(Base, Generator); break; case Phase_Steady: if (m_nSteps <= ((Default_StartSpeed - m_nSpeed) / m_nDeceleration)) { m_nPhase = Phase_Decel; } break; case Phase_Decel: m_nSpeed += m_nDeceleration; if (Default_StartSpeed <= m_nSpeed) { m_nSpeed = Default_StartSpeed; m_nPhase = Phase_Stop; } PWMGenPeriodSet(Base, Generator, m_nSpeed); PWMPulseWidthSet(Base, PWM_OUT_2, 64); PWMGenEnable(Base, Generator); break; case Phase_Stop: PWMGenDisable(Base, Generator); break; default: break; } }
void SolarPanel(void *vParameters) { static unsigned short motorDrive = 0; unsigned long period = 125000; static Bool Flag = FALSE; static unsigned long dutyCycle = 62500; static int remainingDeployment = 1000; while(1) { solarPanel * myPanel = (solarPanel*) vParameters; // DEREREFWEJFIOEAWN DEREFERENCE POINTERS //IntEnable(INT_GPIOB); // SysCtlPWMClockSet(SYSCTL_PWMDIV_32); // if (*(myPanel->solarPanelRetract)) // { // remainingDeployment = 0; // } // else{ // remainingDeployment = 1000; // 100% motor drive * 10 seconds // // char temp[20]; // sprintf(temp,"%u",*(myPanel->solarPanelDeploy)); // RIT128x96x4StringDraw(temp, 40, 80, 15); // sprintf(temp,"%u",*myPanel->solarPanelRetract); // RIT128x96x4StringDraw(temp, 60, 80, 15); // sprintf(temp,"%u",remainingDeployment); // RIT128x96x4StringDraw(temp, 80, 80, 15); if(!((*(myPanel -> solarPanelDeploy) && 0 == remainingDeployment) && (*(myPanel -> solarPanelRetract) && 1000 == remainingDeployment))) { if(*myPanel->solarPanelDeploy || *myPanel->solarPanelRetract) { SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); GPIOPinTypeGPIOInput(GPIO_PORTF_BASE, GPIO_PIN_0); GPIOPinWrite(GPIO_PORTF_BASE, GPIO_PIN_0, 0); GPIOPinTypePWM(GPIO_PORTF_BASE, GPIO_PIN_0); GPIOPadConfigSet(GPIO_PORTF_BASE, GPIO_PIN_0, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, period); PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, dutyCycle); PWMGenEnable(PWM0_BASE, PWM_GEN_0); PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, 1); } if(*(myPanel -> driveMotorSpeedInc)) { if((dutyCycle + (0.05 * period)) < period) // ensures duty cycle does not exceed 100% { dutyCycle += (period * 0.05); // Increments motor speed by 5% } (*(myPanel -> driveMotorSpeedInc)) = FALSE; } else if(*(myPanel -> driveMotorSpeedDec)) { int limit = dutyCycle - (0.05 * period); if(limit > 0) // ensures duty cycle does not drop below 0% { dutyCycle -= (period * 0.05); // Decrements motor speed by 5% } (*(myPanel -> driveMotorSpeedDec)) = FALSE; } motorDrive = dutyCycle * 100 / period; // (dutyCycle / period) * 100% / 10 // iterations per second // solar panels are set up such that // 10 seconds of 100% motorDrive will // fully retract or detract a solar panel // from a full ON or OFF state respectively if(*(myPanel -> solarPanelDeploy)) { if((remainingDeployment - motorDrive) < 0) { remainingDeployment = 0; } else { remainingDeployment -= motorDrive; } } else if(*(myPanel->solarPanelRetract)) { if((remainingDeployment + motorDrive) > 1000) { remainingDeployment = 1000; } else { remainingDeployment += motorDrive; } } if(remainingDeployment == 0 && *(myPanel -> solarPanelDeploy)) { *(myPanel -> solarPanelDeploy) = FALSE; *(myPanel -> solarPanelState) = TRUE; g_ulGPIOb=1; PWMGenDisable(PWM0_BASE, PWM_GEN_0); PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, 0); } else if(remainingDeployment == 1000) { if(*(myPanel -> solarPanelRetract)) { *(myPanel -> solarPanelRetract) = FALSE; *(myPanel -> solarPanelState) = FALSE; g_ulGPIOb=1; PWMGenDisable(PWM0_BASE, PWM_GEN_0); PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, 0); } } } vTaskDelay(500); } }
void ThrusterManage(void *vParameters) { unsigned long period = 125000; static unsigned long dutyCycle = 62500; thruster * myThruster = (thruster*) vParameters; // creates a pointer to void // to the myThruster data struct int duration; int magnitude; while(1) { duration = *(myThruster -> thrusterCommand) & 0xff00; magnitude = *(myThruster -> thrusterCommand) & 240; dutyCycle = magnitude * period / 240; if(dutyCycle >= 0.99 * period) { dutyCycle = 0.99 * period; } SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM); SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); GPIOPinTypeGPIOInput(GPIO_PORTG_BASE, GPIO_PIN_1); GPIOPinWrite(GPIO_PORTG_BASE, GPIO_PIN_1, 0); GPIOPinTypePWM(GPIO_PORTG_BASE, GPIO_PIN_1); GPIOPadConfigSet(GPIO_PORTG_BASE, GPIO_PIN_1, GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD); PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_UP_DOWN | PWM_GEN_MODE_NO_SYNC); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, period); PWMPulseWidthSet(PWM0_BASE, PWM_OUT_1, dutyCycle); PWMGenEnable(PWM0_BASE, PWM_GEN_0); PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, 1); // RIT128x96x4StringDraw("thrust ", 10, 80, 15); if(globalCounter % 500 == 0) { if ((magnitude != 0) && (duration != 0) && (*(myThruster -> fuelLevel) != 0)) { if (duration >= 1280) { int limit = *(myThruster -> fuelLevel) - (100 / (21600 / magnitude) * 5); if (limit <= 0) // if fuel level will drop below 0 in the next 5 seconds { *(myThruster -> fuelLevel) = 0; *(myThruster -> thrusterCommand) = 0x0000; // thrusterCommand set to zeros to avoid unncesscary iteration of function } else { //(*fuelLevel) -= 100 / (37324800 / magnitude) * 5; // document specified fuelLevel decrease rate *(myThruster -> fuelLevel) -= 100 / (21600 / magnitude) * 5; // fuelLevel decrease rate depends purely on magnitude // 21600 = (5% * 1800 seconds) / 240 * 100 // fuel lasts for 1800 seconds at 5% (for demo purposes), // is normalized by (/240) and the percentage magnitude is multiplied by 100 // similar calculations are used to derive the document // specific fuelLevel consumption *(myThruster -> thrusterCommand) -= (256 * 5); //subtracts 5 seconds of remaining runtime for major cycle looping } } else { int limit = *(myThruster -> fuelLevel) - (100 / (2160 / magnitude) * (duration / 256)); if (limit <= 0) // if the fuel level will drop below 0 in the remaining duration { *(myThruster -> fuelLevel) = 0; *(myThruster -> thrusterCommand) = 0x0000; // thrusterCommand set to zeros to avoid unncesscary iteration of function } else { //(*fuelLevel) -= 100 / ((37324800 / magnitude) * (duration / 256)); *(myThruster -> fuelLevel) -= 100 / ((2160 / magnitude) * (duration / 256)); // decreases fuelLevel by magnitude and remaining duration *(myThruster -> thrusterCommand) -= duration; // subtracts the remaining duration from thrusterCommand } } if (*(myThruster -> fuelLevel) <= 10) // sets fuelLow to TRUE when fuel is below or equal to 10 { *(myThruster -> fuelLow) = TRUE; } else // sets fuelLow to FALSE when fuel is greater than 10 { *(myThruster -> fuelLow) = FALSE; } } else { PWMGenDisable(PWM0_BASE, PWM_GEN_0); PWMOutputState(PWM0_BASE, PWM_OUT_1_BIT, 0); } } vTaskDelay(1000); } }
/* * Warning task function */ void warningRunFunction(void *dataptr) { static alarmState aState = OFF; static warningState wState = NONE; static batteryState bState = NORMAL; static warningState prevState; prevState = wState; static int wakeUpAlarmAt = 0; // Get measurement data WarningData *data = (WarningData *) dataptr; float temp = *(data->temperatureCorrected); float sysPress = *(data->systolicPressCorrected); float diaPress = *(data->diastolicPressCorrected); float pulse = *(data->pulseRateCorrected); int battery = *(data->batteryState); // Alarm condition if ( (temp < TEMP_MIN*ALARM_LOW || temp > (TEMP_MAX*ALARM_HIGH)) || (sysPress > SYS_MAX*ALARM_HIGH) || (diaPress > DIA_MAX*ALARM_HIGH) || (pulse < PULSE_MIN*ALARM_LOW || pulse > PULSE_MAX*ALARM_HIGH) ) { // Should only turn alarm ON if it was previously OFF. If it is // ASLEEP, shouldn't do anything. if (aState == OFF) aState = ON; } else aState = OFF; // Warning Condition if ( sysPress > SYS_MAX*ALARM_HIGH || diaPress > DIA_MAX*ALARM_HIGH ) wState = WARN_PRESS; else if ( temp < TEMP_MIN*WARN_LOW || temp > TEMP_MAX*WARN_HIGH ) wState = WARN_TEMP; else if ( pulse < PULSE_MIN*WARN_LOW || pulse > PULSE_MAX*WARN_HIGH ) wState = WARN_PULSE; else wState = NONE; // Battery Condition if (battery < BATTERY_MIN) bState = LOW; // Handle speaker, based on alarm state switch (aState) { case ON: PWMGenEnable(PWM0_BASE, PWM_GEN_0); break; case ASLEEP: PWMGenDisable(PWM0_BASE, PWM_GEN_0); break; default: // OFF PWMGenDisable(PWM0_BASE, PWM_GEN_0); break; } // Handle warning cases static int toggletime; switch (wState) { case WARN_PRESS: GPIOPinWrite(GPIO_PORTC_BASE, LED_GREEN, 0X00); if (wState != prevState) { GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0XFF); // need to flash toggletime = WARN_RATE_PRESS; } else if (0 == minor_cycle_ctr%toggletime) { if (GPIOPinRead(GPIO_PORTC_BASE, LED_RED) == 0) GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0XFF); // need to flash else GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0X00); // need to flash //toggletime+=WARN_RATE_PRESS; } break; case WARN_TEMP: GPIOPinWrite(GPIO_PORTC_BASE, LED_GREEN, 0X00); if (wState != prevState) { GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0XFF); // need to flash toggletime = WARN_RATE_TEMP; } else if (0 == minor_cycle_ctr%toggletime) { if (GPIOPinRead(GPIO_PORTC_BASE, LED_RED) == 0) GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0XFF); // need to flash else GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0X00); // need to flash //toggletime+=WARN_RATE_TEMP; } break; case WARN_PULSE: GPIOPinWrite(GPIO_PORTC_BASE, LED_GREEN, 0X00); if (wState != prevState) { GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0XFF); // need to flash toggletime = WARN_RATE_PULSE; } else if (0==minor_cycle_ctr%toggletime) { if (GPIOPinRead(GPIO_PORTC_BASE, LED_RED) == 0) GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0XFF); // need to flash else GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0X00); // need to flash //toggletime+=WARN_RATE_PULSE; } break; default: // NORMAL GPIOPinWrite(GPIO_PORTC_BASE, LED_GREEN, 0xFF); GPIOPinWrite(GPIO_PORTC_BASE, LED_RED, 0x00); break; } if (bState == LOW) { GPIOPinWrite(GPIO_PORTC_BASE, LED_YELLOW, 0xFF); GPIOPinWrite(GPIO_PORTC_BASE, LED_GREEN, 0x00); } else GPIOPinWrite(GPIO_PORTC_BASE, LED_YELLOW, 0x00); /* This is the alarm override * Upon override, the alarm is silenced for some time. * silence length is defined by ALARM_SLEEP_PERIOD * * If the button is pushed, the value returned is 0 * If the button is NOT pushed, the value is non-zero */ if (0 == GPIOPinRead(GPIO_PORTE_BASE, GPIO_PIN_0) && (aState == ON) ) { //GPIOPinWrite(GPIO_PORTC_BASE, LED_YELLOW, 0XFF); // for debug, lights led aState = ASLEEP; wakeUpAlarmAt = minor_cycle_ctr + ALARM_SLEEP_PERIOD; } // Check whether to resound alarm if (minor_cycle_ctr == wakeUpAlarmAt && aState == ASLEEP) { aState = ON; GPIOPinWrite(GPIO_PORTC_BASE, LED_YELLOW, 0X00); // for debug, kills led } }