Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
adsis8300bcm
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Juliano Murari
adsis8300bcm
Commits
dda30215
Commit
dda30215
authored
3 years ago
by
Juliano Murari
Browse files
Options
Downloads
Patches
Plain Diff
Change leaky coefficient to use Qmn function conversion
parent
cd7cdf62
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Pipeline
#105007
failed
3 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
vendor/ess/lib/sis8300drvbcm.c
+12
-5
12 additions, 5 deletions
vendor/ess/lib/sis8300drvbcm.c
with
12 additions
and
5 deletions
vendor/ess/lib/sis8300drvbcm.c
+
12
−
5
View file @
dda30215
...
...
@@ -50,6 +50,8 @@ const sis8300drv_Qmn sis8300drvbcm_Qmn_diff_fast_window_width =
{
.
int_bits_m
=
1
,
.
frac_bits_n
=
15
,
.
is_signed
=
1
};
const
sis8300drv_Qmn
sis8300drvbcm_Qmn_diff_medium_window_width
=
{
.
int_bits_m
=
1
,
.
frac_bits_n
=
23
,
.
is_signed
=
1
};
const
sis8300drv_Qmn
sis8300drvbcm_Qmn_leaky_coefficient
=
{
.
int_bits_m
=
9
,
.
frac_bits_n
=
23
,
.
is_signed
=
1
};
// default sampling frequency
...
...
@@ -1769,13 +1771,18 @@ int sis8300drvbcm_get_calibration_sample(sis8300drv_usr *sisuser, unsigned int c
int
sis8300drvbcm_set_channel_leaky_coefficient
(
sis8300drv_usr
*
sisuser
,
unsigned
int
channel
,
double
leaky_coefficient
)
{
double
error
;
unsigned
int
value
;
int
ret
=
sis8300drv_double_2_Qmn
(
leaky_coefficient
,
sis8300drvbcm_Qmn_leaky_coefficient
,
&
value
,
&
error
);
if
(
ret
)
{
return
ret
;
}
unsigned
int
reg
=
SIS8300BCM_CHANNEL_BLOCK_BASE
+
\
(
SIS8300BCM_CHANNEL_BLOCK_SIZE
*
channel
)
+
\
SIS8300BCM_ACCT_BANK_OFF
+
\
SIS8300BCM_ACCT_X_ADC_LEAKY_COFF_REG
;
// register takes 32-bit value (Q9.23 format 2^23 = 8388608)
int
value
=
(
int
)(
leaky_coefficient
*
8388608
.
0
);
int
ret
=
sis8300drv_reg_write
(
sisuser
,
reg
,
(
unsigned
)
value
);
// register takes Q9.23 value
ret
=
sis8300drv_reg_write
(
sisuser
,
reg
,
(
unsigned
)
value
);
return
ret
;
}
...
...
@@ -1785,13 +1792,13 @@ int sis8300drvbcm_get_channel_leaky_coefficient(sis8300drv_usr *sisuser, unsigne
(
SIS8300BCM_CHANNEL_BLOCK_SIZE
*
channel
)
+
\
SIS8300BCM_ACCT_BANK_OFF
+
\
SIS8300BCM_ACCT_X_ADC_LEAKY_COFF_REG
;
// register takes
32-bit value (Q9.23 format 2^23 = 8388608)
// register takes
Q9.23 value
int
value
;
int
ret
=
sis8300drv_reg_read
(
sisuser
,
reg
,
(
unsigned
*
)
&
value
);
if
(
ret
)
{
return
ret
;
}
*
leaky_coefficient
=
(
double
)
value
/
8388608
.
0
;
ret
=
sis8300drv_Qmn_2_double
(
value
,
sis8300drvbcm_Qmn_leaky_coefficient
,
leaky_coefficient
)
;
return
ret
;
}
...
...
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