Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
F
fwatch
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
8
Issues
8
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
fwatch
Commits
8e94b3ef
Commit
8e94b3ef
authored
Dec 09, 2014
by
Projects
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
light sensor: Interrupts cause events.
parent
98f36877
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
18 additions
and
6 deletions
+18
-6
light_sensor.c
sw/common/drivers/light_sensor.c
+13
-0
event.h
sw/common/event.h
+1
-1
irq_dispatcher.c
sw/freewatch/src/irq_dispatcher.c
+4
-5
No files found.
sw/common/drivers/light_sensor.c
View file @
8e94b3ef
...
...
@@ -28,6 +28,12 @@
#include "light_sensor.h"
#include "i2cdrv.h"
#include <em_gpio.h>
// Interrupt pin (active low)
#define LS_INT_PORT gpioPortA
#define LS_INT_PIN 4
// Writes a register
static
uint8_t
max44009_write_reg
(
uint8_t
reg_add
,
uint8_t
value
)
{
...
...
@@ -151,3 +157,10 @@ uint8_t light_sensor_set_thres_timer(uint8_t timer)
{
return 0;
}*/
void
light_sensor_init
(
void
)
{
GPIO_PinModeSet
(
LS_INT_PORT
,
LS_INT_PIN
,
gpioModeInputPull
,
1
);
GPIO_IntConfig
(
LS_INT_PORT
,
LS_INT_PORT
,
false
,
true
,
true
);
}
sw/common/event.h
View file @
8e94b3ef
...
...
@@ -67,7 +67,7 @@ enum charger_state {
* Sensor interrupts.
*/
enum
sensor_type
{
// LIGHT, // disabled for the time being
LIGHT
,
MAGNETOMETER
,
ACCELEROMETER
};
...
...
sw/freewatch/src/irq_dispatcher.c
View file @
8e94b3ef
...
...
@@ -78,11 +78,10 @@ static portBASE_TYPE gpio_irq_dispatcher(uint32_t flags)
break
;
// Sensors
// There is a conflict with the bottom-left button interrupt
// case (1 << 6): // PA6
// evt.type = SENSOR_INT;
// evt.data.sensor = LIGHT;
// break;
case
(
1
<<
4
):
// PA4
evt
.
type
=
SENSOR_INT
;
evt
.
data
.
sensor
=
LIGHT
;
break
;
case
(
1
<<
10
):
// PA10
evt
.
type
=
SENSOR_INT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment