Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
F
firmware
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
External wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Adrian
firmware
Commits
88ae77eb
Commit
88ae77eb
authored
5 years ago
by
Adrian Schneider
Browse files
Options
Downloads
Patches
Plain Diff
chore(light_sensor) make error codes negative, use more precise error number
parent
f3cf813e
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#1329
passed
5 years ago
Stage: build
Changes
2
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
epicardium/modules/light_sensor.c
+3
-3
3 additions, 3 deletions
epicardium/modules/light_sensor.c
pycardium/modules/light_sensor.c
+1
-1
1 addition, 1 deletion
pycardium/modules/light_sensor.c
with
4 additions
and
4 deletions
epicardium/modules/light_sensor.c
+
3
−
3
View file @
88ae77eb
...
@@ -15,7 +15,7 @@ static TaskHandle_t poll_task;
...
@@ -15,7 +15,7 @@ static TaskHandle_t poll_task;
{
{
const
sys_cfg_adc_t
sys_adc_cfg
=
NULL
;
/* No system specific configuration needed. */
const
sys_cfg_adc_t
sys_adc_cfg
=
NULL
;
/* No system specific configuration needed. */
if
(
ADC_Init
(
0x9
,
&
sys_adc_cfg
)
!=
E_NO_ERROR
)
{
if
(
ADC_Init
(
0x9
,
&
sys_adc_cfg
)
!=
E_NO_ERROR
)
{
return
EINVAL
;
return
-
EINVAL
;
}
}
GPIO_Config
(
&
gpio_cfg_adc7
);
GPIO_Config
(
&
gpio_cfg_adc7
);
return
0
;
return
0
;
...
@@ -71,7 +71,7 @@ int epic_light_sensor_get(uint16_t* value)
...
@@ -71,7 +71,7 @@ int epic_light_sensor_get(uint16_t* value)
{
{
if
(
!
poll_task
)
if
(
!
poll_task
)
{
{
return
EINVAL
;
return
-
ENODATA
;
}
}
*
value
=
last_value
;
*
value
=
last_value
;
return
0
;
return
0
;
...
...
This diff is collapsed.
Click to expand it.
pycardium/modules/light_sensor.c
+
1
−
1
View file @
88ae77eb
...
@@ -14,7 +14,7 @@ STATIC mp_obj_t mp_light_sensor_get_reading()
...
@@ -14,7 +14,7 @@ STATIC mp_obj_t mp_light_sensor_get_reading()
{
{
uint16_t
last
;
uint16_t
last
;
int
status
=
epic_light_sensor_get
(
&
last
);
int
status
=
epic_light_sensor_get
(
&
last
);
if
(
status
==
EINVAL
)
if
(
status
==
-
ENODATA
)
{
{
mp_raise_ValueError
(
"sensor not running"
);
mp_raise_ValueError
(
"sensor not running"
);
return
mp_const_none
;
return
mp_const_none
;
...
...
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