File size: 930 Bytes
5eb1bc0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
6fa48c4
5eb1bc0
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/**
 * STS3215 Protocol Constants and Configuration
 * Single source of truth for all STS3215 motor communication
 */

/**
 * STS3215 Protocol Configuration
 * Register addresses, timing, and communication constants
 */
export const STS3215_PROTOCOL = {
  // Register addresses
  PRESENT_POSITION_ADDRESS: 56,
  GOAL_POSITION_ADDRESS: 42,
  HOMING_OFFSET_ADDRESS: 31,
  MIN_POSITION_LIMIT_ADDRESS: 9,
  MAX_POSITION_LIMIT_ADDRESS: 11,
  TORQUE_ENABLE_ADDRESS: 40, // Torque Enable register (0=disable, 1=enable)

  // Protocol constants
  RESOLUTION: 4096, // 12-bit resolution (0-4095)
  SIGN_MAGNITUDE_BIT: 11, // Bit 11 is sign bit for Homing_Offset encoding

  // Data lengths
  HOMING_OFFSET_LENGTH: 2,
  PRESENT_POSITION_LENGTH: 2,
  MIN_POSITION_LIMIT_LENGTH: 2,
  MAX_POSITION_LIMIT_LENGTH: 2,

  // Communication timing
  WRITE_TO_READ_DELAY: 10,
  RETRY_DELAY: 20,
  INTER_MOTOR_DELAY: 10,
  MAX_RETRIES: 3,
} as const;