BigW Consortium Gitlab
Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mangoh-drivers
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Forest Godfrey
mangoh-drivers
Commits
6acee2f2
Commit
6acee2f2
authored
Jan 12, 2017
by
Mirac Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Provide GPIO tutorials for mangOH Red
parent
1b0e71d9
Hide whitespace changes
Inline
Side-by-side
Showing
26 changed files
with
376 additions
and
0 deletions
+376
-0
.gitmodules
.gitmodules
+3
-0
GpioExpanderRed
apps/GpioExpanderRed
+1
-0
noiseData.adef
...les/tutorials/mangOH_Green/adc/NoiseSensor/noiseData.adef
+0
-0
Component.cdef
...H_Green/adc/NoiseSensor/noiseDataComponent/Component.cdef
+0
-0
noiseData.c
...ngOH_Green/adc/NoiseSensor/noiseDataComponent/noiseData.c
+0
-0
cf3GpioControl.adef
...ials/mangOH_Green/gpio/Cf3GpioControl/cf3GpioControl.adef
+0
-0
Component.cdef
...pio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
+0
-0
cf3GpioControl.c
...o/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
+0
-0
timerLed.adef
samples/tutorials/mangOH_Green/gpio/TimerLed/timerLed.adef
+0
-0
Component.cdef
...ngOH_Green/gpio/TimerLed/timerLedComponent/Component.cdef
+0
-0
timerLed.c
...s/mangOH_Green/gpio/TimerLed/timerLedComponent/timerLed.c
+0
-0
touchData.adef
...es/tutorials/mangOH_Green/gpio/TouchSensor/touchData.adef
+0
-0
Component.cdef
..._Green/gpio/TouchSensor/touchDataComponent/Component.cdef
+0
-0
touchData.c
...gOH_Green/gpio/TouchSensor/touchDataComponent/touchData.c
+0
-0
batteryReading.adef
...angOH_Green/i2c/BatteryChargerReading/batteryReading.adef
+0
-0
Component.cdef
...teryChargerReading/batteryReadingComponent/Component.cdef
+0
-0
batteryReading.c
...ryChargerReading/batteryReadingComponent/batteryReading.c
+0
-0
cf3GpioControl.adef
...orials/mangOH_Red/gpio/Cf3GpioControl/cf3GpioControl.adef
+30
-0
Component.cdef
...pio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
+14
-0
cf3GpioControl.c
...o/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
+83
-0
timerLed.adef
samples/tutorials/mangOH_Red/gpio/TimerLed/timerLed.adef
+29
-0
Component.cdef
...mangOH_Red/gpio/TimerLed/timerLedComponent/Component.cdef
+13
-0
timerLed.c
...als/mangOH_Red/gpio/TimerLed/timerLedComponent/timerLed.c
+74
-0
touchData.adef
samples/tutorials/mangOH_Red/gpio/TouchSensor/touchData.adef
+30
-0
Component.cdef
...OH_Red/gpio/TouchSensor/touchDataComponent/Component.cdef
+14
-0
touchData.c
...angOH_Red/gpio/TouchSensor/touchDataComponent/touchData.c
+85
-0
No files found.
.gitmodules
View file @
6acee2f2
...
...
@@ -25,3 +25,6 @@
[submodule "samples/Demos"]
path = samples/Demos
url = git://github.com/mangOH/Demos
[submodule "apps/GpioExpanderRed"]
path = apps/GpioExpanderRed
url = git://github.com/mangOH/GpioExpanderRed
GpioExpanderRed
@
489a3ca9
Subproject commit 489a3ca992169d29fdbc9478c7349ba10a4b89da
samples/tutorials/
hardwareInterfaces
/adc/NoiseSensor/noiseData.adef
→
samples/tutorials/
mangOH_Green
/adc/NoiseSensor/noiseData.adef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/adc/NoiseSensor/noiseDataComponent/Component.cdef
→
samples/tutorials/
mangOH_Green
/adc/NoiseSensor/noiseDataComponent/Component.cdef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/adc/NoiseSensor/noiseDataComponent/noiseData.c
→
samples/tutorials/
mangOH_Green
/adc/NoiseSensor/noiseDataComponent/noiseData.c
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/Cf3GpioControl/cf3GpioControl.adef
→
samples/tutorials/
mangOH_Green
/gpio/Cf3GpioControl/cf3GpioControl.adef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
→
samples/tutorials/
mangOH_Green
/gpio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
→
samples/tutorials/
mangOH_Green
/gpio/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/TimerLed/timerLed.adef
→
samples/tutorials/
mangOH_Green
/gpio/TimerLed/timerLed.adef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/TimerLed/timerLedComponent/Component.cdef
→
samples/tutorials/
mangOH_Green
/gpio/TimerLed/timerLedComponent/Component.cdef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/TimerLed/timerLedComponent/timerLed.c
→
samples/tutorials/
mangOH_Green
/gpio/TimerLed/timerLedComponent/timerLed.c
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/TouchSensor/touchData.adef
→
samples/tutorials/
mangOH_Green
/gpio/TouchSensor/touchData.adef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/TouchSensor/touchDataComponent/Component.cdef
→
samples/tutorials/
mangOH_Green
/gpio/TouchSensor/touchDataComponent/Component.cdef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/gpio/TouchSensor/touchDataComponent/touchData.c
→
samples/tutorials/
mangOH_Green
/gpio/TouchSensor/touchDataComponent/touchData.c
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/i2c/BatteryChargerReading/batteryReading.adef
→
samples/tutorials/
mangOH_Green
/i2c/BatteryChargerReading/batteryReading.adef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/i2c/BatteryChargerReading/batteryReadingComponent/Component.cdef
→
samples/tutorials/
mangOH_Green
/i2c/BatteryChargerReading/batteryReadingComponent/Component.cdef
View file @
6acee2f2
File moved
samples/tutorials/
hardwareInterfaces
/i2c/BatteryChargerReading/batteryReadingComponent/batteryReading.c
→
samples/tutorials/
mangOH_Green
/i2c/BatteryChargerReading/batteryReadingComponent/batteryReading.c
View file @
6acee2f2
File moved
samples/tutorials/mangOH_Red/gpio/Cf3GpioControl/cf3GpioControl.adef
0 → 100644
View file @
6acee2f2
sandboxed: true
version: 1.0.0
maxFileSystemBytes: 512K
start: manual
executables:
{
cf3GpioControl = ( cf3GpioControlComponent )
}
processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}
run:
{
( cf3GpioControl )
}
faultAction: restart
}
bindings:
{
cf3GpioControl.cf3GpioControlComponent.le_sensorGpio -> <root>.le_gpioPin7
cf3GpioControl.cf3GpioControlComponent.mangoh_ledGpio -> gpioExpanderService.mangoh_gpioExp1Pin4
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
0 → 100644
View file @
6acee2f2
requires:
{
api:
{
le_sensorGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
}
}
sources:
{
cf3GpioControl.c
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
0 → 100644
View file @
6acee2f2
/**
* @file
*
* This sample app reads state of IoT1_GPIO1 (gpio25). If state change is detected, it makes
* corresponding change in state of LED D750. Use this sample to understand how to configure a gpio
* as an input or output and use call back function.
*
* <HR>
*
* Copyright (C) Sierra Wireless, Inc. Use of this work is subject to license.
*/
#include "legato.h"
#include "interfaces.h"
//--------------------------------------------------------------------------------------------------
/**
* Sets default configuration LED D750 as on
*/
//--------------------------------------------------------------------------------------------------
static
void
ConfigureLed
(
void
)
{
// Configure initial value as LED on
LE_FATAL_IF
(
mangoh_ledGpio_SetPushPullOutput
(
MANGOH_LEDGPIO_ACTIVE_HIGH
,
true
)
!=
LE_OK
,
"Couldn't configure LED PLAY as a push pull output"
);
}
//--------------------------------------------------------------------------------------------------
/**
* Performs initial configuration of the CF3 gpio (IoT1_GPIO1)
*/
//--------------------------------------------------------------------------------------------------
static
void
ConfigureSensorGpio
(
void
)
{
// Configure IoT1_GPIO1 as input and set its initial value as high
LE_FATAL_IF
(
le_sensorGpio_SetInput
(
LE_SENSORGPIO_ACTIVE_HIGH
)
!=
LE_OK
,
"Couldn't configure cf3 gpio as default input high"
);
}
//--------------------------------------------------------------------------------------------------
/**
* LED D750 changes state when IoT1_GPIO1 changes state
*/
//--------------------------------------------------------------------------------------------------
static
void
touch_ledGpio_ChangeHandler
(
bool
state
,
void
*
ctx
)
{
if
(
state
)
{
mangoh_ledGpio_Activate
();
}
else
{
mangoh_ledGpio_Deactivate
();
}
}
//--------------------------------------------------------------------------------------------------
/**
* Main program starts here
*/
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"=============== CF3 gpio application has started"
);
ConfigureLed
();
ConfigureSensorGpio
();
le_sensorGpio_AddChangeEventHandler
(
LE_SENSORGPIO_EDGE_BOTH
,
touch_ledGpio_ChangeHandler
,
NULL
,
0
);
}
samples/tutorials/mangOH_Red/gpio/TimerLed/timerLed.adef
0 → 100644
View file @
6acee2f2
sandboxed: true
version: 1.0.0
maxFileSystemBytes: 512K
start: manual
executables:
{
timerLed = ( timerLedComponent )
}
processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}
run:
{
( timerLed )
}
faultAction: restart
}
bindings:
{
timerLed.timerLedComponent.mangoh_ledGpio -> gpioExpanderService.mangoh_gpioExp1Pin4
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/TimerLed/timerLedComponent/Component.cdef
0 → 100644
View file @
6acee2f2
requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
}
}
sources:
{
timerLed.c
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/TimerLed/timerLedComponent/timerLed.c
0 → 100644
View file @
6acee2f2
/**
* @file
*
* This sample app is a blinking LED at 1 second interval
*
* <HR>
*
* Copyright (C) Sierra Wireless, Inc. Use of this work is subject to license.
*/
#include "legato.h"
#include "interfaces.h"
#define LED_SAMPLE_INTERVAL_IN_MILLISECONDS (1000)
static
int8_t
state
=
0
;
//--------------------------------------------------------------------------------------------------
/**
* Sets default configuration LED D750 as on
*/
//--------------------------------------------------------------------------------------------------
static
void
ConfigureLed
(
void
)
{
// Configure initial value as LED off
LE_FATAL_IF
(
mangoh_ledGpio_SetPushPullOutput
(
MANGOH_LEDGPIO_ACTIVE_HIGH
,
true
)
!=
LE_OK
,
"Couldn't configure LED PLAY as a push pull output"
);
}
//--------------------------------------------------------------------------------------------------
/**
* LED D750 changes state as defined by LED_SAMPLE_INTERVAL_IN_SECONDS
*/
//--------------------------------------------------------------------------------------------------
static
void
ledTimer
(
le_timer_Ref_t
ledTimerRef
)
{
mangoh_ledGpio_SetEdgeSense
(
MANGOH_LEDGPIO_EDGE_BOTH
);
if
(
state
)
{
mangoh_ledGpio_Activate
();
state
=
false
;
}
else
{
mangoh_ledGpio_Deactivate
();
state
=
true
;
}
}
//--------------------------------------------------------------------------------------------------
/**
* Main program starts here
*/
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"===============blinking LED application has started"
);
ConfigureLed
();
le_timer_Ref_t
ledTimerRef
=
le_timer_Create
(
"LED Timer"
);
le_timer_SetMsInterval
(
ledTimerRef
,
LED_SAMPLE_INTERVAL_IN_MILLISECONDS
);
le_timer_SetRepeat
(
ledTimerRef
,
0
);
le_timer_SetHandler
(
ledTimerRef
,
ledTimer
);
le_timer_Start
(
ledTimerRef
);
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/TouchSensor/touchData.adef
0 → 100644
View file @
6acee2f2
sandboxed: true
version: 1.0.0
maxFileSystemBytes: 512K
start: manual
executables:
{
touchData = ( touchDataComponent )
}
processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}
run:
{
( touchData )
}
faultAction: restart
}
bindings:
{
touchData.touchDataComponent.mangoh_pushButton -> gpioExpanderService.mangoh_gpioExp1Pin3
touchData.touchDataComponent.mangoh_ledGpio -> gpioExpanderService.mangoh_gpioExp1Pin4
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/TouchSensor/touchDataComponent/Component.cdef
0 → 100644
View file @
6acee2f2
requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_pushButton = ${LEGATO_ROOT}/interfaces/le_gpio.api
}
}
sources:
{
touchData.c
}
\ No newline at end of file
samples/tutorials/mangOH_Red/gpio/TouchSensor/touchDataComponent/touchData.c
0 → 100644
View file @
6acee2f2
/**
* @file
*
* This sample app reads state of IoT1_GPIO1 (gpio25) or Push Button SW200. If state change is
* detected, it makes corresponding change in state of LED D750. Use this sample to understand how
* to configure a gpio as an input or output and use call back function.
*
* <HR>
*
* Copyright (C) Sierra Wireless, Inc. Use of this work is subject to license.
*/
#include "legato.h"
#include "interfaces.h"
//--------------------------------------------------------------------------------------------------
/**
* Sets default configuration LED D750 as on
*/
//--------------------------------------------------------------------------------------------------
static
void
ConfigureLed
(
void
)
{
// Configure initial value as LED on
LE_FATAL_IF
(
mangoh_ledGpio_SetPushPullOutput
(
MANGOH_LEDGPIO_ACTIVE_HIGH
,
true
)
!=
LE_OK
,
"Couldn't configure LED PLAY as a push pull output"
);
}
//--------------------------------------------------------------------------------------------------
/**
* Performs initial configuration of the push button (SW200)
*/
//--------------------------------------------------------------------------------------------------
static
void
ConfigurePushButton
(
void
)
{
// Configure Push Button as input and set its initial value as high
LE_FATAL_IF
(
mangoh_pushButton_SetInput
(
MANGOH_PUSHBUTTON_ACTIVE_HIGH
)
!=
LE_OK
,
"Couldn't configure touch sensor as default input high"
);
}
//--------------------------------------------------------------------------------------------------
/**
* LED D750 changes state when Push Button changes state
*/
//--------------------------------------------------------------------------------------------------
static
void
touch_ledGpio_ChangeHandler
(
bool
state
,
void
*
ctx
)
{
if
(
state
)
{
mangoh_ledGpio_Activate
();
}
else
{
mangoh_ledGpio_Deactivate
();
}
}
//--------------------------------------------------------------------------------------------------
/**
* Main program starts here
*/
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"=============== touchsensor application has started"
);
ConfigureLed
();
ConfigurePushButton
();
mangoh_pushButton_AddChangeEventHandler
(
MANGOH_PUSHBUTTON_EDGE_BOTH
,
touch_ledGpio_ChangeHandler
,
NULL
,
0
);
}
\ No newline at end of file
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