|
| 1 | +# SC-Series Servo |
| 2 | + |
| 3 | +> SC-Series Servo library for Arduino and ESP32 |
| 4 | +
|
| 5 | +## Table of Contents |
| 6 | + |
| 7 | +<!-- TOC --> |
| 8 | +* [SC-Series Servo](#sc-series-servo) |
| 9 | + * [Table of Contents](#table-of-contents) |
| 10 | + * [Requirements](#requirements) |
| 11 | + * [Usage](#usage) |
| 12 | + * [Installation via Arduino IDE](#installation-via-arduino-ide) |
| 13 | + * [Installation via Arduino CLI](#installation-via-arduino-cli) |
| 14 | + * [Installation of development versions](#installation-of-development-versions) |
| 15 | + * [Notes](#notes) |
| 16 | + * [Upstream Compatibility](#upstream-compatibility) |
| 17 | + * [Upstream Notes](#upstream-notes) |
| 18 | + * [Contributors](#contributors) |
| 19 | + * [License](#license) |
| 20 | +<!-- TOC --> |
| 21 | + |
| 22 | +## Requirements |
| 23 | + |
| 24 | +* `arduino-lint` `1.2.0` or [newer](https://arduino.github.io/arduino-lint/) |
| 25 | +* `cpplint` `1.6.0` or [newer](https://github.com/cpplint/cpplint) |
| 26 | +* `clang-format` `18.1.0` or [newer](https://clang.llvm.org/docs/ClangFormat.html) |
| 27 | + |
| 28 | +## Usage |
| 29 | + |
| 30 | +For usage examples, see the [examples](./examples) directory. |
| 31 | + |
| 32 | +### Installation via Arduino IDE |
| 33 | + |
| 34 | +For installation via the Arduino IDE, see [docs.arduino.cc](https://docs.arduino.cc/software/ide-v2/tutorials/ide-v2-installing-a-library/). |
| 35 | + |
| 36 | +### Installation via Arduino CLI |
| 37 | + |
| 38 | +To install the latest version using `arduino-cli`, use the following command: |
| 39 | + |
| 40 | +```shell |
| 41 | +arduino-cli lib install SCServo |
| 42 | +``` |
| 43 | + |
| 44 | +To install a specific version, use the following command: |
| 45 | + |
| 46 | +```shell |
| 47 | +arduino-cli lib install [email protected] |
| 48 | +``` |
| 49 | + |
| 50 | +### Installation of development versions |
| 51 | + |
| 52 | +To install an in-development or unreleased version, installation of _unsafe_ libraries must be enabled. |
| 53 | + |
| 54 | +To enable the installation of unsafe libraries, use the following command: |
| 55 | + |
| 56 | +```shell |
| 57 | +arduino-cli config set library.enable_unsafe_install true |
| 58 | +``` |
| 59 | + |
| 60 | +See [docs.arduino.cc](https://arduino.github.io/arduino-cli/1.0/configuration/#configuration-methods) for more information on the implications. |
| 61 | + |
| 62 | +Once the installation of unsafe libraries is enabled, the `SCServo` library may be installed by running the following command: |
| 63 | + |
| 64 | +```shell |
| 65 | +arduino-cli lib install --git-url "https://github.com/workloads/scservo.git" |
| 66 | + |
| 67 | + |
| 68 | +## Development |
| 69 | + |
| 70 | +This repository provides a [Makefile](./Makefile)-based workflow to aid in development. |
| 71 | + |
| 72 | +Running `make` without commands will print out the following help information: |
| 73 | + |
| 74 | +```text |
| 75 | +📚 SCSERVO LIBRARY |
| 76 | +
|
| 77 | +Target Description Usage |
| 78 | +lint-arduino lint Arduino code using arduino-lint `make lint-arduino` |
| 79 | +lint-cpp lint C++ code using cpplint and clang-format `make lint-cpp` |
| 80 | +help display a list of Make Targets `make help` |
| 81 | +_listincludes list all included Makefiles and *.mk files `make _listincludes` |
| 82 | +_selfcheck lint Makefile `make _selfcheck` |
| 83 | +vale lint prose with Vale `make vale` |
| 84 | +vale-sync sync Vale dependencies `make vale-sync` |
| 85 | +``` |
| 86 | + |
| 87 | +## Notes |
| 88 | + |
| 89 | +### Upstream Compatibility |
| 90 | + |
| 91 | +The initial version of this library (`1.0.1`) represents a direct fork of [@waveshareteam/ugv_base_general](https://github.com/waveshareteam/ugv_base_general/tree/main/SCServo). |
| 92 | + |
| 93 | +The fork is based on commit [91e5871](https://github.com/workloads/scservo/commit/91e58712176c6d98a9476a74c7a1712f3d631114) and extracts the `SCServo` directory from the original repository to allow for easier downstream consumption via the Arduino CLI and IDE. |
| 94 | + |
| 95 | +While the intent of this fork is to remain compatible with the upstream repository, no guarantees are made regarding the stability or compatibility of this library with the original repository. |
| 96 | + |
| 97 | +### Upstream Notes |
| 98 | + |
| 99 | +The code for the `SCServo` library is divided into the following |
| 100 | +parts: |
| 101 | + |
| 102 | +* communication layer: [src/SCS.cpp](src/SCS.cpp) |
| 103 | +* hardware interface layer: [src/SCSerial.cpp](src/SCSerial.cpp) |
| 104 | +* application layer: |
| 105 | + * corresponds to the three series of FIT servos |
| 106 | + * `SCSCL` application layer program: [src/SCSCL.h](src/SCSCL.h) and |
| 107 | + [src/SCSCL.cpp](src/SCSCL.cpp) |
| 108 | + * `SMSBL`, `SMSCL`, and `STSCL` application layer program: |
| 109 | + [src/SMS_STS.h](src/SMS_STS.h) and [src/SMS_STS.cpp](src/SMS_STS.cpp) |
| 110 | +* instruction definition header file: [src/INST.h](src/INST.h) |
| 111 | +* communication layer program: [src/SCS.h](src/SCS.h) and |
| 112 | + [src/SCS.cpp](src/SCS.cpp) |
| 113 | +* hardware interface program: [src/SCSerial.h](src/SCSerial.h) and |
| 114 | + [src/SCSerial.cpp](src/SCSerial.cpp) |
| 115 | + |
| 116 | +Note that there are differences in the memory table definitions of different series of servos. |
| 117 | + |
| 118 | +## Contributors |
| 119 | + |
| 120 | +For a list of current (and past) contributors to this repository, see [GitHub](https://github.com/workloads/scservo/graphs/contributors). |
| 121 | + |
| 122 | +## License |
| 123 | + |
| 124 | +Licensed under the General Public License, Version 3.0 (the "License"). |
| 125 | + |
| 126 | +You may download a copy of the License at [gnu.org/licenses/gpl-3.0.txt](https://www.gnu.org/licenses/gpl-3.0.txt). |
| 127 | + |
| 128 | +See the License for the specific language governing permissions and limitations under the License. |
0 commit comments