From 612f566c99ff39c3725e7968ac29ebaaa275f728 Mon Sep 17 00:00:00 2001 From: Brendan Le Foll Date: Mon, 7 Mar 2016 15:26:55 +0000 Subject: [PATCH] firmata: remove servo stuff Signed-off-by: Brendan Le Foll --- include/firmata/servo.h | 35 ------------------------ src/firmata/CMakeLists.txt | 1 - src/firmata/servo.c | 55 -------------------------------------- 3 files changed, 91 deletions(-) delete mode 100644 include/firmata/servo.h delete mode 100644 src/firmata/servo.c diff --git a/include/firmata/servo.h b/include/firmata/servo.h deleted file mode 100644 index 5f11681..0000000 --- a/include/firmata/servo.h +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (c) 2016 Intel Corporation - * Copyright (c) 2015 Jules Dourlens (jdourlens@gmail.com) - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#pragma once - -#include "firmata.h" - -typedef struct s_servo { - t_firmata* firmata; - int pin; -} t_servo; - -t_servo* servo_attach(t_firmata* firmata, int pin); -int servo_write(t_servo* servo, int value); diff --git a/src/firmata/CMakeLists.txt b/src/firmata/CMakeLists.txt index 91c4b69..8d6c9ab 100644 --- a/src/firmata/CMakeLists.txt +++ b/src/firmata/CMakeLists.txt @@ -2,7 +2,6 @@ if (FIRMATA) message (STATUS "INFO - Adding firmata backend support") set (mraa_LIB_PLAT_SRCS_NOAUTO ${mraa_LIB_PLAT_SRCS_NOAUTO} ${PROJECT_SOURCE_DIR}/src/firmata/firmata.c - ${PROJECT_SOURCE_DIR}/src/firmata/servo.c ${PROJECT_SOURCE_DIR}/src/firmata/firmata_mraa.c PARENT_SCOPE ) diff --git a/src/firmata/servo.c b/src/firmata/servo.c deleted file mode 100644 index 5ec54b6..0000000 --- a/src/firmata/servo.c +++ /dev/null @@ -1,55 +0,0 @@ -/* - * Copyright (c) 2016 Intel Corporation - * Copyright (c) 2015 Jules Dourlens (jdourlens@gmail.com) - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject to - * the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE - * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION - * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION - * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - */ - -#include "firmata/servo.h" - -#include -#include - -t_servo* -servo_attach(t_firmata* firmata, int pin) -{ - t_servo* res; - - if (!firmata || !firmata->isReady) { - perror("servo_new::Firmata is not ready"); - return (NULL); - } - res = malloc(sizeof(t_servo)); - if (!res) { - perror("servo_new::malloc failed"); - return (NULL); - } - res->firmata = firmata; - res->pin = pin; - firmata_pinMode(res->firmata, pin, MODE_SERVO); - - return res; -} - -int -servo_write(t_servo* servo, int value) -{ - return (firmata_analogWrite(servo->firmata, servo->pin, value)); -}