BigW Consortium Gitlab

Commit 09fdd608 by David Frey

Minor formatting cleanup of tutorials

parent 5685a272
......@@ -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();
......
......@@ -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();
......
......@@ -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("Vender / Part / Revision Status Register value is %d\n",RegisterReading);
LE_DEBUG("Vendor / 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();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment