libpropeller
Making PropellerGCC Easier
 All Classes Files Functions Variables Enumerations Enumerator Macros Pages
vnh2sp30.test.h
Go to the documentation of this file.
1 #include "unity.h"
2 #include "c++-alloc.h"
3 
5 
6 #include "propeller.h"
8 
10 
11 //pwm32 * pwm;
12 
13 
16 
17 const int pwmPin = 6;
18 const int inApin = 7;
19 const int inBpin = 5;
20 
21 class UnityTests {
22 public:
23 
24  static void setUp(void) {
25  pwm2 = new PWM2();
26  pwm2->Start();
27 
28  pwm32 = new PWM32();
29  pwm32->Start();
30 
31  waitcnt(CLKFREQ / 10 + CNT);
32 
33  sut = new vnh2sp30();
34 
35 
36  //Init the PWM2 based version
37  sut->Init(pwm2, vnh2sp30::X, pwmPin, inApin, inBpin);
38 
39  //Init the PWM32 based version
40  //sut->Init(pwm32, pwmPin, inApin, inBpin);
41 
42 
43  }
44 
45  static void tearDown(void) {
46  delete sut;
47  sut = NULL;
48 
49  pwm2->Stop();
50  delete pwm2;
51  pwm2 = NULL;
52 
53  pwm32->Stop();
54  delete pwm32;
55  pwm32 = NULL;
56  }
57 
58  static void test_Nothing(void) {
59  for (int i = 0; i <= 90; i++) {
60  sut->Set(vnh2sp30::FORWARD, i);
61  waitcnt(CLKFREQ / 10 + CNT);
62  }
63  //TEST_IGNORE_MESSAGE("Need to have a motor connected...");
64  }
65 
66  static void test_Nothing2(void) {
67  sut->Set(vnh2sp30::FORWARD, 100);
68  //while(true){}
69  }
70 
71 };
72 
73 
74