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
890df657
Commit
890df657
authored
Jan 24, 2017
by
Mirac Chen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Port noise sensor tutorial to Red
parent
eb78f134
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
103 additions
and
0 deletions
+103
-0
noiseData.adef
samples/tutorials/mangOH_Red/adc/NoiseSensor/noiseData.adef
+28
-0
Component.cdef
...gOH_Red/adc/NoiseSensor/noiseDataComponent/Component.cdef
+12
-0
noiseData.c
...mangOH_Red/adc/NoiseSensor/noiseDataComponent/noiseData.c
+63
-0
No files found.
samples/tutorials/mangOH_Red/adc/NoiseSensor/noiseData.adef
0 → 100644
View file @
890df657
sandboxed: true
version: 1.0.0
maxFileSystemBytes: 512K
start: manual
executables:
{
noiseData = ( noiseDataComponent )
}
processes:
{
envVars:
{
LE_LOG_LEVEL = DEBUG
}
run:
{
( noiseData )
}
faultAction: restart
}
bindings:
{
noiseData.noiseDataComponent.le_adc -> modemService.le_adc
}
samples/tutorials/mangOH_Red/adc/NoiseSensor/noiseDataComponent/Component.cdef
0 → 100644
View file @
890df657
requires:
{
api:
{
${LEGATO_ROOT}/interfaces/modemServices/le_adc.api
}
}
sources:
{
noiseData.c
}
samples/tutorials/mangOH_Red/adc/NoiseSensor/noiseDataComponent/noiseData.c
0 → 100644
View file @
890df657
/**
* @file
*
* This app reads the current adc reading every 1 seconds
*
* <HR>
*
* Copyright (C) Sierra Wireless, Inc. Use of this work is subject to license.
*/
#include "legato.h"
#include "interfaces.h"
//--------------------------------------------------------------------------------------------------
/**
* The time between publishing ADC location readings
*
* @note Please change this timeout value as needed.
*/
//--------------------------------------------------------------------------------------------------
#define ADC_SAMPLE_INTERVAL_IN_MILLISECONDS (1000)
//--------------------------------------------------------------------------------------------------
/**
* Timer handler will publish the current ADC reading.
*/
//--------------------------------------------------------------------------------------------------
static
void
adcTimer
(
le_timer_Ref_t
adcTimerRef
)
{
int32_t
value
;
const
le_result_t
result
=
le_adc_ReadValue
(
"EXT_ADC0"
,
&
value
);
if
(
result
==
LE_OK
)
{
LE_INFO
(
"EXT_ADC0 value is: %d"
,
value
);
}
else
{
LE_INFO
(
"Couldn't get ADC value"
);
}
}
//--------------------------------------------------------------------------------------------------
/**
* Main program starts here
*/
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"---------------------- ADC Reading started"
);
le_timer_Ref_t
adcTimerRef
=
le_timer_Create
(
"ADC Timer"
);
le_timer_SetMsInterval
(
adcTimerRef
,
ADC_SAMPLE_INTERVAL_IN_MILLISECONDS
);
le_timer_SetRepeat
(
adcTimerRef
,
0
);
le_timer_SetHandler
(
adcTimerRef
,
adcTimer
);
le_timer_Start
(
adcTimerRef
);
}
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