Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gqgmc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Kevin Lyda
gqgmc
Commits
81b412a4
There was a problem fetching the pipeline summary.
Commit
81b412a4
authored
Jan 30, 2017
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Implement GetCPS.
parent
71f90a58
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#
Changes
1
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
devices/geiger/gqgmc.go
+11
-14
11 additions, 14 deletions
devices/geiger/gqgmc.go
with
11 additions
and
14 deletions
devices/geiger/gqgmc.go
+
11
−
14
View file @
81b412a4
...
@@ -190,27 +190,24 @@ func (gc *GQGMCCounter) SerialNum() (string, error) {
...
@@ -190,27 +190,24 @@ func (gc *GQGMCCounter) SerialNum() (string, error) {
return
""
,
nil
return
""
,
nil
}
}
// GetCPM returns CPM
func
(
gc
*
GQGMCCounter
)
getReading
(
what
string
)
(
uint16
,
error
)
{
func
(
gc
*
GQGMCCounter
)
GetCPM
()
(
uint16
,
error
)
{
buf
,
err
:=
gc
.
communicate
([]
byte
(
what
),
2
)
buf
,
err
:=
gc
.
communicate
([]
byte
(
cmdGetCPM
),
2
)
if
err
!=
nil
{
if
err
!=
nil
{
return
0
,
err
return
0
,
err
}
}
cpm
:=
((
uint16
(
buf
[
0
])
<<
8
)
&
0x3f00
)
reading
:=
((
uint16
(
buf
[
0
])
<<
8
)
&
0x3f00
)
cpm
|=
(
uint16
(
buf
[
1
])
&
0x00ff
)
reading
|=
(
uint16
(
buf
[
1
])
&
0x00ff
)
return
cpm
,
nil
return
reading
,
nil
}
// GetCPM returns CPM
func
(
gc
*
GQGMCCounter
)
GetCPM
()
(
uint16
,
error
)
{
return
gc
.
getReading
(
cmdGetCPM
)
}
}
// GetCPS returns CPS
// GetCPS returns CPS
func
(
gc
*
GQGMCCounter
)
GetCPS
()
(
uint16
,
error
)
{
func
(
gc
*
GQGMCCounter
)
GetCPS
()
(
uint16
,
error
)
{
//uint32_t cpssize = 2; // 2 bytes of returned data
return
gc
.
getReading
(
cmdGetCPM
)
//communicate(get_cps_cmd, cps_char, cpssize);
// 1st byte is MSB, but note that upper two bits are reserved bits.
// Note that shifting and bitmasking performed in uP register, so
// endianess is irrevelant.
//cps_int |= ((uint16_t(cps_char[0]) << 8) & 0x3f00);
//cps_int |= (uint16_t(cps_char[1]) & 0x00ff);
return
0
,
nil
}
}
// GetVoltage returns current battery voltage
// GetVoltage returns current battery voltage
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment