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
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
29 additions
and
33 deletions
+29
-33
Component.cdef
...erfaces/adc/NoiseSensor/noiseDataComponent/Component.cdef
+0
-0
noiseData.c
...Interfaces/adc/NoiseSensor/noiseDataComponent/noiseData.c
+0
-0
Component.cdef
...pio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
+0
-0
cf3GpioControl.c
...o/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
+4
-6
timerLed.c
...wareInterfaces/gpio/TimerLed/timerLedComponent/timerLed.c
+0
-0
Component.cdef
...rfaces/gpio/TouchSensor/touchDataComponent/Component.cdef
+0
-0
touchData.c
...nterfaces/gpio/TouchSensor/touchDataComponent/touchData.c
+4
-6
batteryReading.adef
...eInterfaces/i2c/BatteryChargerReading/batteryReading.adef
+0
-0
Component.cdef
...teryChargerReading/batteryReadingComponent/Component.cdef
+0
-1
batteryReading.c
...ryChargerReading/batteryReadingComponent/batteryReading.c
+21
-20
No files found.
samples/tutorials/hardwareInterfaces/adc/NoiseSensor/noiseDataComponent/Component.cdef
View file @
09fdd608
samples/tutorials/hardwareInterfaces/adc/NoiseSensor/noiseDataComponent/noiseData.c
View file @
09fdd608
samples/tutorials/hardwareInterfaces/gpio/Cf3GpioControl/cf3GpioControlComponent/Component.cdef
View file @
09fdd608
samples/tutorials/hardwareInterfaces/gpio/Cf3GpioControl/cf3GpioControlComponent/cf3GpioControl.c
View file @
09fdd608
...
...
@@ -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
samples/tutorials/hardwareInterfaces/gpio/TouchSensor/touchDataComponent/Component.cdef
View file @
09fdd608
samples/tutorials/hardwareInterfaces/gpio/TouchSensor/touchDataComponent/touchData.c
View file @
09fdd608
...
...
@@ -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
samples/tutorials/hardwareInterfaces/i2c/BatteryChargerReading/batteryReadingComponent/Component.cdef
View file @
09fdd608
sources:
{
batteryReading.c
...
...
samples/tutorials/hardwareInterfaces/i2c/BatteryChargerReading/batteryReadingComponent/batteryReading.c
View file @
09fdd608
...
...
@@ -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
;
}
...
...
@@ -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
;
}
...
...
@@ -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
);
}
//--------------------------------------------------------------------------------------------------
...
...
@@ -251,7 +252,7 @@ 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