PropWare
3.0.0.229
C++ objects and CMake build system for Parallax Propeller
libpropeller
libpropeller
vnh2sp30
vnh2sp30.test.h
1
#include "unity.h"
2
#include "c++-alloc.h"
3
4
#include "libpropeller/vnh2sp30/vnh2sp30.h"
5
6
#include "propeller.h"
7
#include "libpropeller/pwm32/pwm32.h"
8
9
libpropeller::vnh2sp30
* sut;
10
11
//pwm32 * pwm;
12
13
14
libpropeller::PWM2
* pwm2;
15
libpropeller::PWM32
* pwm32;
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
libpropeller::PWM2
();
26
pwm2->
Start
();
27
28
pwm32 =
new
libpropeller::PWM32
();
29
pwm32->
Start
();
30
31
waitcnt
(
CLKFREQ
/ 10 +
CNT
);
32
33
sut =
new
libpropeller::vnh2sp30
();
34
35
36
//Init the PWM2 based version
37
sut->Init(pwm2, libpropeller::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(libpropeller::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(libpropeller::vnh2sp30::FORWARD, 100);
68
//while(true){}
69
}
70
71
};
libpropeller::PWM32::Stop
void Stop(void)
Definition:
pwm32.h:60
libpropeller::PWM32
Definition:
pwm32.h:30
libpropeller::PWM2
Definition:
pwm2.h:25
libpropeller::PWM2::Start
void Start(void)
Definition:
pwm2.h:31
libpropeller::vnh2sp30
Definition:
vnh2sp30.h:45
CLKFREQ
#define CLKFREQ
Returns the current clock frequency.
Definition:
propeller.h:46
libpropeller::PWM32::Start
void Start(void)
Definition:
pwm32.h:44
waitcnt
#define waitcnt(a)
Wait until system counter reaches a value.
Definition:
propeller.h:176
CNT
#define CNT
The system clock count.
Definition:
propeller1.h:151
UnityTests
Definition:
eeprom.test.h:14
libpropeller::PWM2::Stop
void Stop(void)
Definition:
pwm2.h:48
Generated on Fri May 20 2022 16:48:02 for PropWare by
1.8.17