Biblioteka za upravljanje unipolarnim motorom
Diff: umotor.h
- Revision:
- 2:b769f13c7523
- Parent:
- 0:a3d5b06d790a
diff -r 9cd4fd37eee0 -r b769f13c7523 umotor.h --- a/umotor.h Mon Jan 30 00:22:04 2017 +0000 +++ b/umotor.h Wed Feb 08 01:22:42 2017 +0000 @@ -1,31 +1,34 @@ #ifndef STEPER_H #define STEPER_H +#ifndef MBED_H +#include "mbed.h" +#endif +#ifndef GLOBAL_NAZIVI_H +#include "global_nazivi.h" +#endif #define ARRAY_SIZE(x) (sizeof(x) / sizeof(*x)) #define BROJ_KORAKA 50 +typedef struct { + int u_krenuo; + int u_stao; +}UPozicija; + class Steper { public: Steper(); - void stepper_step(); + void stepper_step(int broji); void timer_isr(); void u_motor(); - + void pboneCallback(void); + void UEnable(); + UPozicija u_poz; + int Brzina(int okretaja); private: - void pboneCallback(); - void pbtwoCallback(); - void togglerOff(); - void togglerRed(); - DigitalOut ledSec; - DigitalOut riseL; - DigitalOut fallL; - InterruptIn pbone; - InterruptIn pbtwo; - Timer t; - Ticker toggler; - Ticker led; - Timeout detachToggler; + Timer u_t; + Ticker u_ticker; DigitalOut coil1, coil2, coil3, coil4;