Private
Public Access
2
0

fixing indentation issues reported by eclipse mraa

Signed-off-by: kathaashok <katha.ashok@adlinktech.com>
This commit is contained in:
kathaashok
2020-01-10 12:02:01 +05:30
committed by Tom Ingleby
parent 276868185d
commit bb736e762b

View File

@@ -1,12 +1,12 @@
/* /*
* Author: Dan O'Donovan <dan@emutex.com> * Author: Dan O'Donovan <dan@emutex.com>
* Author: Santhanakumar A <santhanakumar.a@adlinktech.com> * Author: Santhanakumar A <santhanakumar.a@adlinktech.com>
* Copyright (c) 2019 ADLINK Technology Inc. * Copyright (c) 2019 ADLINK Technology Inc.
* SPDX-License-Identifier: MIT * SPDX-License-Identifier: MIT
*/ */
#include <ctype.h> #include <ctype.h>
@@ -115,51 +115,51 @@ static mraa_result_t pwm_period_replace(mraa_pwm_context dev, int period)
static float pwm_read_replace(mraa_pwm_context dev) static float pwm_read_replace(mraa_pwm_context dev)
{ {
unsigned char rx_tx_buf[3] = {0}; unsigned char rx_tx_buf[3] = {0};
if(dev->pin < 9) if(dev->pin < 9)
{ {
if(_fd == -1) if(_fd == -1)
{ {
return 0; return 0;
} }
rx_tx_buf[0] = regIon[dev->pin]; rx_tx_buf[0] = regIon[dev->pin];
if(write(_fd, &(rx_tx_buf[0]), 1) == 1) if(write(_fd, &(rx_tx_buf[0]), 1) == 1)
{ {
if(read(_fd, &(rx_tx_buf[1]), 1) == 1) if(read(_fd, &(rx_tx_buf[1]), 1) == 1)
{ {
return (rx_tx_buf[1] / 2.55); return (rx_tx_buf[1] / 2.55);
} }
} }
} }
return 0; return 0;
} }
static mraa_result_t pwm_write_replace(mraa_pwm_context dev, float duty) static mraa_result_t pwm_write_replace(mraa_pwm_context dev, float duty)
{ {
unsigned char rx_tx_buf[3] = {0}; unsigned char rx_tx_buf[3] = {0};
IonValue[dev->pin] = ((duty /m_period) * 255); IonValue[dev->pin] = ((duty /m_period) * 255);
if(dev->pin < 9) if(dev->pin < 9)
{ {
if(_fd == -1) if(_fd == -1)
{ {
return MRAA_ERROR_INVALID_RESOURCE; return MRAA_ERROR_INVALID_RESOURCE;
} }
rx_tx_buf[0] = regIon[dev->pin]; rx_tx_buf[0] = regIon[dev->pin];
rx_tx_buf[1] = IonValue[dev->pin]; rx_tx_buf[1] = IonValue[dev->pin];
if(write(_fd, &(rx_tx_buf[0]), 2) != 2) if(write(_fd, &(rx_tx_buf[0]), 2) != 2)
{ {
return MRAA_ERROR_NO_RESOURCES; return MRAA_ERROR_NO_RESOURCES;
} }
return MRAA_SUCCESS; return MRAA_SUCCESS;
} }
return MRAA_ERROR_NO_RESOURCES; return MRAA_ERROR_NO_RESOURCES;
} }
static mraa_result_t pwm_enable_replace(mraa_pwm_context dev, int enable) static mraa_result_t pwm_enable_replace(mraa_pwm_context dev, int enable)
@@ -655,21 +655,21 @@ static int sx150x_init(int bus_num)
{ {
return -1; return -1;
} }
/* /*
// resetting sx1509q // resetting sx1509q
rx_tx_buf[0] = 0x7d; rx_tx_buf[0] = 0x7d;
rx_tx_buf[1] = 0x12; rx_tx_buf[1] = 0x12;
if(write(_fd, &(rx_tx_buf[0]), 2) == 2) if(write(_fd, &(rx_tx_buf[0]), 2) == 2)
{ {
rx_tx_buf[1] = 0x34; rx_tx_buf[1] = 0x34;
if(write(_fd, &(rx_tx_buf[0]), 2) != 2) if(write(_fd, &(rx_tx_buf[0]), 2) != 2)
{ {
return -1; return -1;
}
} }
*/ }
// configuring clock and misc register for PWM feature */
// configuring clock and misc register for PWM feature
rx_tx_buf[0] = 0x1E; rx_tx_buf[0] = 0x1E;
if(write(_fd, &(rx_tx_buf[0]), 1) == 1) if(write(_fd, &(rx_tx_buf[0]), 1) == 1)
{ {