Subversion Repositories Projects

Rev

Rev 211 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
211 dhylands 1
/****************************************************************************
2
*
3
*   Copyright (c) 2009 Dave Hylands     <dhylands@gmail.com>
4
*
5
*   This program is free software; you can redistribute it and/or modify
6
*   it under the terms of the GNU General Public License version 2 as
7
*   published by the Free Software Foundation.
8
*
9
*   Alternatively, this software may be distributed under the terms of BSD
10
*   license.
11
*
12
*   See README and COPYING for more details.
13
*
14
****************************************************************************/
15
/**
16
*
17
*   @file   Bioloid.h
18
*
19
*   @brief  Contains some constants which are used by various bioloid classes.
20
*
21
****************************************************************************/
22
 
23
#if !defined( BIOLOID_H )
24
#define BIOLOID_H       /**< Include Guard                             */
25
 
26
// ---- Include Files -------------------------------------------------------
27
 
28
#include <stdint.h>
29
 
30
namespace Bioloid
31
{
32
    typedef uint8_t ID_t;
33
 
34
    enum
35
    {
36
        BROADCAST_ID    = 0xFE,
37
        INVALID_ID      = 0xFF,
38
    };
39
 
40
    enum Command
41
    {
42
        CMD_PING        = 0x01, // Used to obatin a status packet
43
        CMD_READ        = 0x02, // Read values from the control table
44
        CMD_WRITE       = 0x03, // Write values to control table
45
        CMD_REG_WRITE   = 0x04, // Prime values to write when ACTION sent
46
        CMD_ACTION      = 0x05, // Triggers REG_WRITE
47
        CMD_RESET       = 0x06, // Changes control values back to factory defaults
48
 
49
        CMD_SYNC_WRITE  = 0x83  // Writes values to many devices
50
    };
51
 
52
    enum Error
53
    {
54
        ERROR_RESERVED      = 0x80, ///< Reserved - set to zero
55
        ERROR_INSTRUCTION   = 0x40, ///< Undefined instruction
56
        ERROR_OVERLOAD      = 0x20, ///< Max torque can't control applied load
57
        ERROR_CHECKSUM      = 0x10, ///< Checksum of instruction packet incorrect
58
        ERROR_RANGE         = 0x08, ///< Instruction is out of range
59
        ERROR_OVERHEATING   = 0x04, ///< Internal temperature is too high
60
        ERROR_ANGLE_LIMIT   = 0x02, ///< Goal position is outside of limit range
61
        ERROR_INPUT_VOLTAGE = 0x01, ///< Input voltage out of range
62
        ERROR_NONE          = 0x00, ///< No Error
213 dhylands 63
 
64
        ERROR_NOT_DONE      = 0x100,///< Special error code used by BioloidPacket::ProcessChar
65
        ERROR_TIMEOUT       = 0x101,///< Indicates that a timeout occurred whilw waiting for a reply
66
        ERROR_TOO_MUCH_DATA = 0x102,///< Packet storage isn't big enough
211 dhylands 67
    };
68
};
69
 
70
#endif  // BIOLOID_H