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
89414340
Commit
89414340
authored
Mar 11, 2019
by
Ashish Syal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added LED controls
parent
596c750d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
183 additions
and
0 deletions
+183
-0
actuator.adef
apps/YellowOnBoardActuators/actuator.adef
+36
-0
Component.cdef
apps/YellowOnBoardActuators/actuatorComponent/Component.cdef
+20
-0
actuator.c
apps/YellowOnBoardActuators/actuatorComponent/actuator.c
+127
-0
No files found.
apps/YellowOnBoardActuators/actuator.adef
0 → 100644
View file @
89414340
sandboxed: false
start: auto
version: 0.1
executables:
{
actuatorYellow = (
components/led/generic
components/led/triRed
components/led/triGreen
components/led/triBlue
)
}
processes:
{
run:
{
( actuatorYellow )
}
envVars:
{
LE_LOG_LEVEL = DEBUG
}
faultAction: stopApp
}
bindings:
{
actuatorYellow.generic.dhubIO -> dataHub.io
actuatorYellow.triRed.dhubIO -> dataHub.io
actuatorYellow.triGreen.dhubIO -> dataHub.io
actuatorYellow.triBlue.dhubIO -> dataHub.io
}
apps/YellowOnBoardActuators/actuatorComponent/Component.cdef
0 → 100644
View file @
89414340
//--------------------------------------------------------------------------------------------------
/**
* Component definition file for the mangOH Yellow on board actuator component.
*/
//--------------------------------------------------------------------------------------------------
requires:
{
api:
{
dhubIO = io.api
}
}
sources:
{
actuator.c
}
apps/YellowOnBoardActuators/actuatorComponent/actuator.c
0 → 100644
View file @
89414340
/**
*
* This file provides the implementation of @ref c_led
*
*
* <hr>
*
* Copyright (C) Sierra Wireless Inc.
*/
#include "legato.h"
#include "interfaces.h"
static
const
char
GenericLedPath
[]
=
"/sys/devices/platform/expander.0/generic_led"
;
typedef
struct
{
char
*
name
;
le_result_t
(
*
activate
)(
void
);
le_result_t
(
*
deactivate
)(
void
);
}
actuator_gpio_t
;
static
actuator_gpio_t
gpio
[]
=
{
{
"Generic_Led"
,
generic_led_Activate
,
generic_led__Deactivate
},
};
typedef
struct
{
const
char
*
path
;
io_DataType_t
dataType
;
const
char
*
units
;
io_BooleanPushHandlerRef_t
ref
;
}
actuator_DhOut_t
;
static
actuator_DhOut_t
dhubResources
[]
=
{
GenericLedPath
,
DHUBIO_DATA_TYPE_BOOLEAN
,
""
,
NULL
},
};
static
void
actuator_DhOutputHandler
(
double
timestamp
,
bool
value
,
void
*
context
)
{
actuator_gpio_t
*
output
=
(
actuator_gpio_t
*
)
context
;
if
(
output
)
{
le_result_t
result
=
(
true
==
value
)
?
output
->
activate
()
:
output
->
deactivate
();
LE_INFO
(
"%s : %s (ts: %lf) result: %d"
,
output
->
name
,
true
==
value
?
"set"
:
"clr"
,
timestamp
,
result
);
}
}
static
le_result_t
actuator_DhRegister
(
void
)
{
le_result_t
result
=
LE_OK
;
for
(
int
i
=
0
;
i
<
ARRAY_SIZE
(
dhubResources
);
i
++
)
{
result
=
io_CreateOutput
(
dhubResources
[
i
].
path
,
dhubResources
[
i
].
dataType
,
dhubResources
[
i
].
units
);
if
(
LE_OK
!=
result
)
{
LE_ERROR
(
"Failed to create output resource %s"
,
dhubResources
[
i
].
path
);
break
;
}
dhubResources
[
i
].
ref
=
io_AddBooleanPushHandler
(
dhubResources
[
i
].
path
,
actuator_DhOutputHandler
,
(
void
*
)
&
gpio
[
i
]);
if
(
NULL
==
dhubResources
[
i
].
ref
)
{
LE_ERROR
(
"Failed to add handler for output resource %s"
,
dhubResources
[
i
].
path
);
result
=
LE_FAULT
;
break
;
}
}
return
result
;
}
//--------------------------------------------------------------------------------------------------
/**
* SIGTERM handler to cleanly shutdown
*/
//--------------------------------------------------------------------------------------------------
static
void
ioServ_SigTermHandler
(
int
pSigNum
)
{
(
void
)
pSigNum
;
LE_INFO
(
"Remove LED resource"
);
io_DeleteResource
(
GenericLedPath
);
}
//--------------------------------------------------------------------------------------------------
/**
* Main program
*/
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
///< Catch application termination and shutdown cleanly
le_sig_Block
(
SIGTERM
);
le_sig_SetEventHandler
(
SIGTERM
,
ioServ_SigTermHandler
);
actuator_DhRegister
();
}
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