/****************************************************************************** * LED_TurnOffLed * * Turns off on or more LEDs. Doesn't check/affect flashing states. *******************************************************************************/ void LED_TurnOffLed(LED_t LEDNr) { if (LEDNr & LED1) Led1Off(); if (LEDNr & LED2) Led2Off(); if (LEDNr & LED3) Led3Off(); if (LEDNr & LED4) Led4Off(); }
void MotorClass::Stop(void) { GPIO_ResetBits(MOTOR_A1_GPIO,MOTOR_A1_PIN); GPIO_ResetBits(MOTOR_A2_GPIO,MOTOR_A2_PIN); GPIO_SetBits(MOTOR_B1_GPIO,MOTOR_B1_PIN); GPIO_SetBits(MOTOR_B2_GPIO,MOTOR_B2_PIN); iOverloadDelay=0; Led2Off(); Led3Off(); chState=MOTOR_STOP; }
void MotorClass::Upward(void) // A1, B2 - вверх { // отключаем A2 и B1 GPIO_ResetBits(MOTOR_A2_GPIO,MOTOR_A2_PIN); GPIO_SetBits(MOTOR_B1_GPIO,MOTOR_B1_PIN); Led2Off(); // ждем закрытия транзисторов Delay.ms(SWITCH_DELAY); // включаем A1 и B2 GPIO_SetBits(MOTOR_A1_GPIO,MOTOR_A1_PIN); GPIO_ResetBits(MOTOR_B2_GPIO,MOTOR_B2_PIN); iOverloadDelay=0; chState=MOTOR_UPWARD; Led3On(); }
/** Main program entry point. This routine configures the hardware required by the application, then * enters a loop to run the application tasks in sequence. */ int main(void) { //RFCOMM_SendFrame(0x10003000,0x10003004,4,4,130,0x10003200); uint16_t tick; SetupHardware(); LPC_TIM0->TCR = 1; Led1On(); Led2On(); Led1Off(); Led2Off(); EVENT_USB_Host_DeviceUnattached(); for (;;) { //uint8_t ButtonStatus = Buttons_GetStateMask(); /* Check if the system update interval has elapsed */ if(LPC_TIM0->IR &0x01) { /* Clear the timer compare flag */ LPC_TIM0->IR |= 0x01; if (RFCOMM_SensorStream){ Led1On(); } else{ if(tick++>=50) { tick = 0; Led1Not(); } } /* If the bluetooth stack is active, manage timeouts within each layer */ BluetoothAdapter_TickElapsed(); KeyScan(); if(sendFlag){ rfcomm_send_data(); } } BluetoothAdapter_USBTask(); USB_USBTask(); } }
void Main(void) { InterruptInit(); IntDisableAll(); Platform_Init(); TS_Init(); /* Init the kernel. */ TMR_Init(); /* Init the TMR module */ NvModuleInit(); Uart_ModuleInit(); /* This only creates the MAC TS thread. */ MacInit(); /* Use TS for MAC - the MAC TS ID must be known at this step. */ Init_802_15_4(TRUE); #if gZtcIncluded_d Ztc_TaskInit(); #endif /* gZtcIncluded_d */ /*initialize the application*/ gAppTaskID_c = TS_CreateTask(gTsAppTaskPriority_c, AppTask); MApp_init(); #if (gLpmIncluded_d == 1) /*do not allow the device to enter sleep mode*/ PWR_DisallowDeviceToSleep(); #endif /* gLpmIncluded_d == 1 */ /*All LED's are switched OFF*/ Led1Off(); Led2Off(); Led3Off(); Led4Off(); /* Start the task scheduler. Does not return. */ TS_Scheduler(); }