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
09fdd608
Commit
09fdd608
authored
Oct 14, 2016
by
David Frey
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor formatting cleanup of tutorials
parent
5685a272
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
55 additions
and
57 deletions
+55
-57
Component.cdef
...erfaces/adc/NoiseSensor/noiseDataComponent/Component.cdef
+3
-2
noiseData.c
...Interfaces/adc/NoiseSensor/noiseDataComponent/noiseData.c
+2
-2
Component.cdef
...pio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
+3
-3
cf3GpioControl.c
...o/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
+5
-7
timerLed.c
...wareInterfaces/gpio/TimerLed/timerLedComponent/timerLed.c
+1
-1
Component.cdef
...rfaces/gpio/TouchSensor/touchDataComponent/Component.cdef
+3
-3
touchData.c
...nterfaces/gpio/TouchSensor/touchDataComponent/touchData.c
+5
-7
batteryReading.adef
...eInterfaces/i2c/BatteryChargerReading/batteryReading.adef
+6
-5
Component.cdef
...teryChargerReading/batteryReadingComponent/Component.cdef
+1
-2
batteryReading.c
...ryChargerReading/batteryReadingComponent/batteryReading.c
+26
-25
No files found.
samples/tutorials/hardwareInterfaces/adc/NoiseSensor/noiseDataComponent/Component.cdef
View file @
09fdd608
...
...
@@ -8,5 +8,5 @@ requires:
sources:
{
noiseData.c
}
noiseData.c
}
\ No newline at end of file
samples/tutorials/hardwareInterfaces/adc/NoiseSensor/noiseDataComponent/noiseData.c
View file @
09fdd608
//--------------------------------------------------------------------------------------------------
/**
* This app reads the current adc reading every 1 seconds
/**
* This app reads the current adc reading every 1 seconds
*/
//--------------------------------------------------------------------------------------------------
#include "legato.h"
...
...
samples/tutorials/hardwareInterfaces/gpio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
View file @
09fdd608
...
...
@@ -2,12 +2,12 @@ requires:
{
api:
{
le_sensorGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
le_sensorGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
}
}
sources:
{
cf3GpioControl.c
cf3GpioControl.c
}
samples/tutorials/hardwareInterfaces/gpio/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
View file @
09fdd608
//--------------------------------------------------------------------------------------------------
/**
/**
* 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
...
...
@@ -20,7 +20,6 @@ static void ConfigureLed
)
{
// 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"
);
}
...
...
@@ -36,8 +35,7 @@ static void ConfigureSensorGpio
)
{
// Configure IoT1_GPIO1 as input and set its initial value as high
LE_FATAL_IF
(
le_sensorGpio_SetInput
(
LE_SENSORGPIO_ACTIVE_HIGH
)
!=
LE_OK
,
LE_FATAL_IF
(
le_sensorGpio_SetInput
(
LE_SENSORGPIO_ACTIVE_HIGH
)
!=
LE_OK
,
"Couldn't configure cf3 gpio as default input high"
);
}
...
...
@@ -48,7 +46,8 @@ static void ConfigureSensorGpio
//--------------------------------------------------------------------------------------------------
static
void
touch_ledGpio_ChangeHandler
(
bool
state
,
void
*
ctx
bool
state
,
void
*
ctx
)
{
// set call back for change in state of GPIO
...
...
@@ -69,8 +68,7 @@ static void touch_ledGpio_ChangeHandler
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"===============CF3 gpio application has started"
);
LE_INFO
(
"=============== CF3 gpio application has started"
);
ConfigureLed
();
ConfigureSensorGpio
();
...
...
samples/tutorials/hardwareInterfaces/gpio/TimerLed/timerLedComponent/timerLed.c
View file @
09fdd608
...
...
@@ -28,7 +28,7 @@ static void ConfigureLed
//--------------------------------------------------------------------------------------------------
/**
* LED D750 changes state as defined by LED_SAMPLE_INTERVAL_IN_SECONDS
* LED D750 changes state as defined by LED_SAMPLE_INTERVAL_IN_SECONDS
*/
//--------------------------------------------------------------------------------------------------
static
void
ledTimer
...
...
samples/tutorials/hardwareInterfaces/gpio/TouchSensor/touchDataComponent/Component.cdef
View file @
09fdd608
...
...
@@ -2,12 +2,12 @@ requires:
{
api:
{
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_pushButton = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_ledGpio = ${LEGATO_ROOT}/interfaces/le_gpio.api
mangoh_pushButton = ${LEGATO_ROOT}/interfaces/le_gpio.api
}
}
sources:
{
touchData.c
touchData.c
}
samples/tutorials/hardwareInterfaces/gpio/TouchSensor/touchDataComponent/touchData.c
View file @
09fdd608
//--------------------------------------------------------------------------------------------------
/**
/**
* 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
...
...
@@ -22,7 +22,6 @@ static void ConfigureLed
)
{
// 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"
);
}
...
...
@@ -38,8 +37,7 @@ static void ConfigurePushButton
)
{
// Configure Push Button as input and set its initial value as high
LE_FATAL_IF
(
mangoh_pushButton_SetInput
(
MANGOH_PUSHBUTTON_ACTIVE_HIGH
)
!=
LE_OK
,
LE_FATAL_IF
(
mangoh_pushButton_SetInput
(
MANGOH_PUSHBUTTON_ACTIVE_HIGH
)
!=
LE_OK
,
"Couldn't configure touch sensor as default input high"
);
}
...
...
@@ -50,7 +48,8 @@ static void ConfigurePushButton
//--------------------------------------------------------------------------------------------------
static
void
touch_ledGpio_ChangeHandler
(
bool
state
,
void
*
ctx
bool
state
,
void
*
ctx
)
{
// set call back for change in state of GPIO
...
...
@@ -71,8 +70,7 @@ static void touch_ledGpio_ChangeHandler
//--------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"===============touchsensor application has started"
);
LE_INFO
(
"=============== touchsensor application has started"
);
ConfigureLed
();
ConfigurePushButton
();
...
...
samples/tutorials/hardwareInterfaces/i2c/BatteryChargerReading/batteryReading.adef
View file @
09fdd608
...
...
@@ -23,8 +23,8 @@ processes:
requires:
{
device:
{
[rw] /dev/i2c-0 /dev/i2c-0
}
}
device:
{
[rw] /dev/i2c-0 /dev/i2c-0
}
}
\ No newline at end of file
samples/tutorials/hardwareInterfaces/i2c/BatteryChargerReading/batteryReadingComponent/Component.cdef
View file @
09fdd608
sources:
{
batteryReading.c
batteryReading.c
}
samples/tutorials/hardwareInterfaces/i2c/BatteryChargerReading/batteryReadingComponent/batteryReading.c
View file @
09fdd608
//--------------------------------------------------------------------------------------------------
/**
/**
* This app reads all the Register on BQ24196 or BQ24296 Battery Chargers
* It also writes output voltage for battery charger to 3.7V
*/
...
...
@@ -11,6 +11,7 @@
//-------------------------------------------------------------------------------------------------
//* Static functions
//--------------------------------------------------------------------------------------------------
/**
* Get the file handle for the given I2C bus and configure it for access to the given I2C address.
*
...
...
@@ -44,14 +45,14 @@ static int I2cAccessBusAddr
if
(
errno
==
ENOENT
)
{
LE_ERROR
(
"Could not open file /dev/i2c-%d or /dev/i2c/%d: %s
\n
"
,
"Could not open file /dev/i2c-%d or /dev/i2c/%d: %s"
,
i2cBus
,
i2cBus
,
strerror
(
ENOENT
));
}
else
{
LE_ERROR
(
"Could not open file %s': %s
\n
"
,
filename
,
strerror
(
errno
));
LE_ERROR
(
"Could not open file %s': %s"
,
filename
,
strerror
(
errno
));
}
return
LE_FAULT
;
...
...
@@ -59,7 +60,7 @@ static int I2cAccessBusAddr
if
(
ioctl
(
fd
,
I2C_SLAVE_FORCE
,
i2cAddr
)
<
0
)
{
LE_ERROR
(
"Could not set address to 0x%02x: %s
\n
"
,
i2cAddr
,
strerror
(
errno
));
LE_ERROR
(
"Could not set address to 0x%02x: %s"
,
i2cAddr
,
strerror
(
errno
));
return
LE_FAULT
;
}
...
...
@@ -79,7 +80,7 @@ static le_result_t SmbusReadReg
(
uint8_t
i2cBus
,
///< [IN] I2C bus to perform the read on
uint8_t
i2cAddr
,
///< [IN] I2C address to read from
uint8_t
reg
,
///< [IN] Register within the I2C device to read
uint8_t
reg
,
///< [IN] Register within the I2C device to read
uint8_t
*
data
///< [OUT] Value stored within the register. This value is only valid if the
/// function returned LE_OK.
)
...
...
@@ -87,7 +88,7 @@ static le_result_t SmbusReadReg
int
i2cFd
=
I2cAccessBusAddr
(
i2cBus
,
i2cAddr
);
if
(
i2cFd
<
0
)
{
LE_ERROR
(
"failed to open i2c bus %d for access to address %d
\n
"
,
i2cBus
,
i2cAddr
);
LE_ERROR
(
"failed to open i2c bus %d for access to address %d"
,
i2cBus
,
i2cAddr
);
return
LE_FAULT
;
}
...
...
@@ -124,7 +125,7 @@ static le_result_t SmbusReadReg
static
le_result_t
SmbusWriteReg
(
uint8_t
i2cBus
,
////< I2C bus to perform the write on
uint8_t
i2cAddr
,
////< I2C device address
uint8_t
i2cAddr
,
////< I2C device address
uint8_t
reg
,
////< Register within the I2C device to write to
uint8_t
data
////< Data to write to the given register
)
...
...
@@ -133,7 +134,7 @@ int i2cFd = I2cAccessBusAddr(i2cBus, i2cAddr);
if
(
i2cFd
==
LE_FAULT
)
{
LE_ERROR
(
"failed to open i2c bus %d for access to address %d
\n
"
,
i2cBus
,
i2cAddr
);
LE_ERROR
(
"failed to open i2c bus %d for access to address %d"
,
i2cBus
,
i2cAddr
);
return
LE_FAULT
;
}
...
...
@@ -170,7 +171,7 @@ static void EnableI2cBus
LE_DEBUG
(
"Enabling TCA9546A I2C switch..."
);
const
int
i2cBus
=
0
;
const
int
i2cdev_fd
=
I2cAccessBusAddr
(
i2cBus
,
0x71
);
LE_FATAL_IF
(
i2cdev_fd
==
LE_FAULT
,
"failed to open i2cbus %d
\n
"
,
i2cBus
);
LE_FATAL_IF
(
i2cdev_fd
==
LE_FAULT
,
"failed to open i2cbus %d"
,
i2cBus
);
const
uint8_t
enableAllPorts
=
0xff
;
LE_FATAL_IF
(
i2c_smbus_write_byte
(
i2cdev_fd
,
enableAllPorts
)
==
-
1
,
"failed to write i2c data"
);
...
...
@@ -191,37 +192,37 @@ static void ReadBatteryChargerRegister
uint8_t
RegisterReading
;
SmbusReadReg
(
0
,
0x6B
,
0x00
,
&
RegisterReading
);
LE_DEBUG
(
"Input Source Control value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Input Source Control value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x01
,
&
RegisterReading
);
LE_DEBUG
(
"Power-On Configuration Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Power-On Configuration Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x02
,
&
RegisterReading
);
LE_DEBUG
(
"Charge Current Control Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Charge Current Control Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x03
,
&
RegisterReading
);
LE_DEBUG
(
" Pre-Charge/Termination Current Control Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
" Pre-Charge/Termination Current Control Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x04
,
&
RegisterReading
);
LE_DEBUG
(
"Charge Voltage Control Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Charge Voltage Control Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x05
,
&
RegisterReading
);
LE_DEBUG
(
"Charge Termination/Timer Control Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Charge Termination/Timer Control Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x06
,
&
RegisterReading
);
LE_DEBUG
(
"Thermal Regulation Control Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Thermal Regulation Control Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x07
,
&
RegisterReading
);
LE_DEBUG
(
"Misc Operation Control Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Misc Operation Control Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x08
,
&
RegisterReading
);
LE_DEBUG
(
"System Status Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"System Status Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x09
,
&
RegisterReading
);
LE_DEBUG
(
"Fault Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Fault Register value is %d
"
,
RegisterReading
);
SmbusReadReg
(
0
,
0x6B
,
0x0A
,
&
RegisterReading
);
LE_DEBUG
(
"Vend
er / Part / Revision Status Register value is %d
\n
"
,
RegisterReading
);
LE_DEBUG
(
"Vend
or / Part / Revision Status Register value is %d"
,
RegisterReading
);
}
//--------------------------------------------------------------------------------------------------
...
...
@@ -236,10 +237,10 @@ static void OutputBatteryChargerVoltage
)
{
uint8_t
OutputVoltage
;
SmbusWriteReg
(
0
,
0x6B
,
0x04
,
0xBA
);
SmbusWriteReg
(
0
,
0x6B
,
0x04
,
0xBA
);
SmbusReadReg
(
0
,
0x6B
,
0x04
,
&
OutputVoltage
);
LE_DEBUG
(
"Output voltage is set to %d
\n
"
,
OutputVoltage
);
LE_DEBUG
(
"Output voltage is set to %d
"
,
OutputVoltage
);
}
//--------------------------------------------------------------------------------------------------
...
...
@@ -250,8 +251,8 @@ static void OutputBatteryChargerVoltage
//-------------------------------------------------------------------------------------------------
COMPONENT_INIT
{
LE_INFO
(
"===============I2C Reading & Writing application has started"
);
LE_INFO
(
"===============
I2C Reading & Writing application has started"
);
EnableI2cBus
();
ReadBatteryChargerRegister
();
OutputBatteryChargerVoltage
();
...
...
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