Provides an interface to an AX-12A servo. Requires the Dynamixel bus protocol library/

Fork of AX-12A by Jonathan Pickett

Revision:
12:f66c779ca018
Parent:
11:8de493bd8922
Child:
13:2e6eb60163f6
--- a/AX12.cpp	Tue Jan 19 19:48:59 2016 +0000
+++ b/AX12.cpp	Sat Jan 23 00:08:04 2016 +0000
@@ -1,5 +1,22 @@
-/* mbed AX-12+ Servo Library - External hardware version */
-
+/* Copyright (c) 2012 Martin Smith, MIT License
+ * Copyright (C) 2016 Schakra Inc, MIT License
+ *
+ * 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 "AX12.h"
 #include "mbed.h"
 #include <Terminal.h>
@@ -13,21 +30,18 @@
     _HasReadCache = false;
 }
 
-/*****/
 
 void AX12::ClearCache()
 {
     _HasReadCache = false;
 }
 
-/*****/
 
 StatusCode AX12::Ping()
 {
     return _pbus->Ping(_ID);
 }
 
-/*****/
 
 StatusCode AX12::SetServoId(char newId)
 {
@@ -42,7 +56,6 @@
     return s;
 }
 
-/*****/
 
 StatusCode AX12::SetGoal(float degrees)
 {
@@ -58,7 +71,6 @@
     return _pbus->Write(_ID, offset, data); 
 }
 
-/*****/
 
 StatusCode AX12::SetReplyDelay(int us)
 {
@@ -75,7 +87,6 @@
     return _pbus->Write(_ID, offset, data); 
 }
 
-/*****/
 
 bool AX12::IsMoving(void)
 {
@@ -91,7 +102,6 @@
     return _ReadCache[cctMoving] == 1;
 }
 
-/*****/
 
 float AX12::GetPosition()
 {
@@ -109,7 +119,6 @@
     return degrees;
 }
 
-/*****/
 
 int AX12::GetTemperature(void)
 {
@@ -125,7 +134,6 @@
     return (int)_ReadCache[cctPresentTemperature];
 }
 
-/*****/
 
 float AX12::GetSupplyVoltage(void)
 {
@@ -141,7 +149,6 @@
     return (float)_ReadCache[cctPresentVoltage] / 10.0f;
 }
 
-/*****/
 
 float AX12::GetLoad(void)
 {
@@ -158,7 +165,6 @@
     return (float)(value & 0x03ff);
 }
 
-/*****/
 
 StatusCode AX12::TorqueEnable(bool enable)
 {
@@ -170,21 +176,18 @@
     return _pbus->Write(_ID, offset, data); 
 }
 
-/*****/
 
 int AX12::GetLastError()
 {
     return _LastError;
 }
 
-/*****/
 
 bool AX12::HasError()
 {
     return _LastError != statusValid;
 }
 
-/*****/
 
 StatusCode AX12::LoadReadCache(void)
 {