pwm: flatten structure - remove 'interface' 54/260354/7
authorAdrian Szyndela <adrian.s@samsung.com>
Wed, 23 Jun 2021 14:44:13 +0000 (16:44 +0200)
committerAdrian Szyndela <adrian.s@samsung.com>
Fri, 25 Jun 2021 14:55:39 +0000 (16:55 +0200)
Merge src/peripheral_pwm.c with src/interface/peripheral_interface_pwm.c,
with additions from include/interface/peripheral_interface_pwm.h.

Change-Id: Ic5343b93d9bd9ce01d22a7d8841c825a99611d96

CMakeLists.txt
include/interface/peripheral_interface_pwm.h [deleted file]
src/interface/peripheral_interface_pwm.c [deleted file]

index 73645cc..3993e16 100644 (file)
@@ -48,8 +48,7 @@ SET(SOURCES src/peripheral_gpio.c
                        src/peripheral_pwm.c
                        src/peripheral_adc.c
                        src/peripheral_uart.c
-                       src/peripheral_spi.c
-                       src/interface/peripheral_interface_pwm.c)
+                       src/peripheral_spi.c)
 
 ADD_LIBRARY(${fw_name} SHARED ${SOURCES})
 
diff --git a/include/interface/peripheral_interface_pwm.h b/include/interface/peripheral_interface_pwm.h
deleted file mode 100644 (file)
index 2e26223..0000000
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#ifndef __PERIPHERAL_INTERFACE_PWM_H__
-#define __PERIPHERAL_INTERFACE_PWM_H__
-
-#include "peripheral_interface_common.h"
-
-#define PWM_BUF_MAX 16
-
-/**
-* @brief pwm_close() deinit pwm pin.
-*
-* @param[in] chip pwm chip number
-* @param[in] pin pwm pin number
-* @return On success, 0 is returned. On failure, a negative value is returned.
-*/
-void peripheral_interface_pwm_close(peripheral_pwm_h pwm);
-
-/**
-* @brief pwm_set_period() sets the pwm period.
-*
-* @param[in] chip pwm chip number
-* @param[in] pin pwm pin number
-* @param[in] period pwm period
-* @return On success, 0 is returned. On failure, a negative value is returned.
-*/
-int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period);
-
-/**
-* @brief pwm_set_duty_cycle() sets the pwm duty cycle.
-*
-* @param[in] chip pwm chip number
-* @param[in] pin pwm pin number
-* @param[in] duty_cycle pwm duty cycle
-* @return On success, 0 is returned. On failure, a negative value is returned.
-*/
-int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle);
-
-/**
-* @brief pwm_set_polarity() sets the pwm polarity.
-*
-* @param[in] chip pwm chip number
-* @param[in] pin pwm pin number
-* @param[in] polarity pwm polarity
-* @return On success, 0 is returned. On failure, a negative value is returned.
-*/
-int peripheral_interface_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity);
-
-/**
-* @brief pwm_set_enable() sets the pwm state.
-*
-* @param[in] chip pwm chip number
-* @param[in] pin pwm pin number
-* @param[in] enable pwm enable/disabled state value
-* @return On success, 0 is returned. On failure, a negative value is returned.
-*/
-int peripheral_interface_pwm_set_enable(peripheral_pwm_h pwm, bool enable);
-
-#endif /* __PERIPHERAL_INTERFACE_PWM_H__ */
diff --git a/src/interface/peripheral_interface_pwm.c b/src/interface/peripheral_interface_pwm.c
deleted file mode 100644 (file)
index 35fdc69..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * Copyright (c) 2016-2017 Samsung Electronics Co., Ltd.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "peripheral_interface_pwm.h"
-
-void peripheral_interface_pwm_close(peripheral_pwm_h pwm)
-{
-       close(pwm->fd_period);
-       close(pwm->fd_duty_cycle);
-       close(pwm->fd_polarity);
-       close(pwm->fd_enable);
-}
-
-int peripheral_interface_pwm_set_period(peripheral_pwm_h pwm, uint32_t period)
-{
-       int ret;
-       int length;
-       char pwm_buf[PWM_BUF_MAX] = {0};
-
-       length = snprintf(pwm_buf, sizeof(pwm_buf), "%d", period);
-       ret = write(pwm->fd_period, pwm_buf, length);
-       CHECK_ERROR(ret != length);
-
-       return PERIPHERAL_ERROR_NONE;
-}
-
-int peripheral_interface_pwm_set_duty_cycle(peripheral_pwm_h pwm, uint32_t duty_cycle)
-{
-       int ret;
-       int length;
-       char pwm_buf[PWM_BUF_MAX] = {0};
-
-       length = snprintf(pwm_buf, sizeof(pwm_buf), "%d", duty_cycle);
-       ret = write(pwm->fd_duty_cycle, pwm_buf, length);
-       CHECK_ERROR(ret != length);
-
-       return PERIPHERAL_ERROR_NONE;
-}
-
-int peripheral_interface_pwm_set_polarity(peripheral_pwm_h pwm, peripheral_pwm_polarity_e polarity)
-{
-       static predefined_type_s types[2] = {
-               {"normal",   6},
-               {"inversed", 8}
-       };
-
-       int ret = write(pwm->fd_polarity, types[polarity].type, types[polarity].len);
-       CHECK_ERROR(ret != types[polarity].len);
-
-       return PERIPHERAL_ERROR_NONE;
-}
-
-int peripheral_interface_pwm_set_enable(peripheral_pwm_h pwm, bool enable)
-{
-       static predefined_type_s types[2] = {
-               {"0", 1},
-               {"1", 1}
-       };
-
-       int ret = write(pwm->fd_enable, types[enable].type, types[enable].len);
-       CHECK_ERROR(ret != types[enable].len);
-
-       return PERIPHERAL_ERROR_NONE;
-}