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
71f90a58
There was a problem fetching the pipeline summary.
Commit
71f90a58
authored
Jan 30, 2017
by
Kevin Lyda
Browse files
Options
Downloads
Patches
Plain Diff
Further.
parent
da2b152e
No related branches found
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
+19
-17
19 additions, 17 deletions
devices/geiger/gqgmc.go
with
19 additions
and
17 deletions
devices/geiger/gqgmc.go
+
19
−
17
View file @
71f90a58
...
@@ -106,13 +106,13 @@ const (
...
@@ -106,13 +106,13 @@ const (
cmdGetSerial
=
"<GETSERIAL>>"
cmdGetSerial
=
"<GETSERIAL>>"
cmdGetVersion
=
"<GETVER>>"
cmdGetVersion
=
"<GETVER>>"
cmdGetVoltage
=
"<GETVOLT>>"
cmdGetVoltage
=
"<GETVOLT>>"
cmdGetC
pm
=
"<GETCPM>>"
cmdGetC
PM
=
"<GETCPM>>"
cmdGetC
ps
=
"<GETCPS>>"
cmdGetC
PS
=
"<GETCPS>>"
cmdGetCfg
=
"<GETCFG>>"
cmdGetCfg
=
"<GETCFG>>"
cmdEraseCfg
=
"<ECFG>>"
cmdEraseCfg
=
"<ECFG>>"
cmdUpdateCfg
=
"<CFGUPDATE>>"
cmdUpdateCfg
=
"<CFGUPDATE>>"
cmdTurnOnC
ps
=
"<HEARTBEAT1>>"
cmdTurnOnC
PS
=
"<HEARTBEAT1>>"
cmdTurnOffC
ps
=
"<HEARTBEAT0>>"
cmdTurnOffC
PS
=
"<HEARTBEAT0>>"
cmdTurnOffPwr
=
"<POWEROFF>>"
cmdTurnOffPwr
=
"<POWEROFF>>"
)
)
...
@@ -192,14 +192,13 @@ func (gc *GQGMCCounter) SerialNum() (string, error) {
...
@@ -192,14 +192,13 @@ func (gc *GQGMCCounter) SerialNum() (string, error) {
// GetCPM returns CPM
// GetCPM returns CPM
func
(
gc
*
GQGMCCounter
)
GetCPM
()
(
uint16
,
error
)
{
func
(
gc
*
GQGMCCounter
)
GetCPM
()
(
uint16
,
error
)
{
//uint32_t cpmsize = 2; // 2 bytes of returned data
buf
,
err
:=
gc
.
communicate
([]
byte
(
cmdGetCPM
),
2
)
//communicate(get_cpm_cmd, cpm_char, cpmsize);
if
err
!=
nil
{
// 1st byte is MSB, but note that upper two bits are reserved bits.
return
0
,
err
// Note that shifting and bitmasking performed in uP register, so
}
// endianess is irrevelant.
cpm
:=
((
uint16
(
buf
[
0
])
<<
8
)
&
0x3f00
)
//cpm_int |= ((uint16_t(cpm_char[0]) << 8) & 0x3f00);
cpm
|=
(
uint16
(
buf
[
1
])
&
0x00ff
)
//cpm_int |= (uint16_t(cpm_char[1]) & 0x00ff);
return
cpm
,
nil
return
0
,
nil
}
}
// GetCPS returns CPS
// GetCPS returns CPS
...
@@ -344,19 +343,22 @@ func (gc *GQGMCCounter) SetTime(time string) {
...
@@ -344,19 +343,22 @@ func (gc *GQGMCCounter) SetTime(time string) {
}
}
func
(
gc
*
GQGMCCounter
)
communicate
(
cmd
[]
byte
,
length
uint32
)
([]
byte
,
error
)
{
func
(
gc
*
GQGMCCounter
)
communicate
(
cmd
[]
byte
,
length
uint32
)
([]
byte
,
error
)
{
//clearUSB();
gc
.
Clear
()
//if (cmd.size() > 0) sendCmd(cmd);
if
len
(
cmd
)
>
0
{
//if (retbytes > 0) readCmdReturn(retdata, retbytes);
gc
.
sendCmd
(
cmd
)
}
if
length
!=
0
{
return
gc
.
readCmd
(
length
)
}
return
nil
,
nil
return
nil
,
nil
}
}
func
(
gc
*
GQGMCCounter
)
sendCmd
(
cmd
[]
byte
)
{
func
(
gc
*
GQGMCCounter
)
sendCmd
(
cmd
[]
byte
)
{
// The port write thing
gc
.
port
.
Write
(
cmd
)
gc
.
port
.
Write
(
cmd
)
return
return
}
}
func
(
gc
*
GQGMCCounter
)
readCmd
Return
(
length
uint32
)
([]
byte
,
error
)
{
func
(
gc
*
GQGMCCounter
)
readCmd
(
length
uint32
)
([]
byte
,
error
)
{
buf
:=
make
([]
byte
,
length
)
buf
:=
make
([]
byte
,
length
)
n
,
err
:=
gc
.
port
.
Read
(
buf
)
n
,
err
:=
gc
.
port
.
Read
(
buf
)
if
err
!=
nil
{
if
err
!=
nil
{
...
...
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