PropWare
C++ objects and CMake build system for Parallax Propeller
Home
Download
Getting Started
Documentation
Reference
About
Related Links
Namespace List
Class List
File List
Examples
Build System
File List
File Members
libpropeller
libpropeller
pulsewidthreader
pulse_width_reader.h
1
#ifndef libpropeller_readpulsewidths_h__
2
#define libpropeller_readpulsewidths_h__
3
#include <propeller.h>
4
5
extern
char
_load_start_pulsewidthreader_cog[];
6
7
namespace
libpropeller
{
8
47
class
PulseWidthReader
{
48
public
:
49
50
PulseWidthReader
() {
51
Cog = 0;
52
}
53
58
void
Start
(
unsigned
int
Inputmask) {
59
volatile
void
* asm_reference = NULL;
60
__asm__
volatile
(
"mov %[asm_reference], #PulseWidthReader_Entry \n\t"
61
: [asm_reference]
"+r"
(asm_reference));
62
Stop
();
63
64
pinTimes[0] = Inputmask;
65
Cog = cognew(_load_start_pulsewidthreader_cog, pinTimes) + 1;
66
}
67
70
void
Stop
(
void
) {
71
if
(Cog != 0) {
72
cogstop(Cog - 1);
73
Cog = 0;
74
}
75
}
76
83
int
getHighTime
(
int
index){
84
return
pinTimes[index * 2];
85
}
86
93
int
getLowTime
(
int
index){
94
return
pinTimes[index * 2 + 1];
95
}
96
97
private
:
98
int
Cog;
99
volatile
int
pinTimes[64];
100
101
102
};
103
104
}
105
106
#endif // libpropeller_readpulsewidths_h__
libpropeller::PulseWidthReader::Stop
void Stop(void)
Definition:
pulse_width_reader.h:70
libpropeller::PulseWidthReader::Start
void Start(unsigned int Inputmask)
Definition:
pulse_width_reader.h:58
libpropeller
Definition:
board_unit_tester.h:4
libpropeller::PulseWidthReader::getHighTime
int getHighTime(int index)
Definition:
pulse_width_reader.h:83
libpropeller::PulseWidthReader::getLowTime
int getLowTime(int index)
Definition:
pulse_width_reader.h:93
libpropeller::PulseWidthReader
Definition:
pulse_width_reader.h:47
Generated on Sat Aug 27 2016 00:58:03 for PropWare by
1.8.12