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; }
/****************************************************************************** * 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::Downward(void) // A2, B1 - вниз { // отключаем A1 и B2 Led3Off(); GPIO_ResetBits(MOTOR_A1_GPIO,MOTOR_A1_PIN); GPIO_SetBits(MOTOR_B2_GPIO,MOTOR_B2_PIN); // ждем закрытия транзисторов Delay.ms(SWITCH_DELAY); // включаем A2 и B1 GPIO_SetBits(MOTOR_A2_GPIO,MOTOR_A2_PIN); GPIO_ResetBits(MOTOR_B1_GPIO,MOTOR_B1_PIN); iOverloadDelay=0; chState=MOTOR_DOWNWARD; Led2On(); }
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(); }