Changeset 429

Show
Ignore:
Timestamp:
02/17/07 22:50:23 (2 years ago)
Author:
goodea
Message:

get servo

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/hal/lpc2106-cmucam3/servo.c

    r421 r429  
    4949  servo_val[servo] = pos; 
    5050  return true; 
     51} 
     52 
     53uint8_t cc3_gpio_get_servo_position (uint8_t servo) 
     54{ 
     55  if (servo >= MAX_SERVOS) { 
     56    return 0; 
     57  } 
     58  return servo_val[servo]; 
    5159} 
    5260 
  • trunk/hal/virtual-cam/gpio.c

    r420 r429  
    3030} 
    3131 
     32void cc3_gpio_set_value (uint8_t pin, bool value) 
     33{ 
     34 
     35} 
  • trunk/hal/virtual-cam/servo.c

    r420 r429  
    5151    servo_val[servo] = pos; 
    5252    return true; 
     53} 
     54 
     55uint8_t cc3_gpio_get_servo_position (uint8_t servo) 
     56{ 
     57    if (servo >= MAX_SERVOS) 
     58        return 0; 
     59    return servo_val[servo]; 
    5360} 
    5461 
  • trunk/include/cc3.h

    r420 r429  
    440440 
    441441/** 
     442 * Get a the position of a servo. 
     443 * 
     444 * @param[in] pin The pin to query. 
     445 * @return The servo position value. 
     446 */ 
     447uint8_t cc3_gpio_get_servo_position (uint8_t pin); 
     448 
     449/** 
    442450 * Configure a GPIO pin as input, output, or servo. 
    443451 * 
  • trunk/projects/cmucam2/cmucam2.c

    r428 r429  
    5656  TRACK_INVERT, 
    5757  SERVO_OUTPUT, 
     58  GET_SERVO, 
    5859  CMUCAM2_CMD_END               // Must be last entry so array sizes are correct 
    5960} cmucam2_command_t; 
     
    8586  cmucam2_cmds[SET_SERVO] = "SV"; 
    8687  //  SP servo parameters 
    87   //  GP get servo position 
     88  cmucam2_cmds[GET_SERVO] = "GS"; 
    8889  //  SM servo mask 
    8990  cmucam2_cmds[SERVO_OUTPUT] = "SO"; 
     
    625626        break; 
    626627 
     628      case GET_SERVO: 
     629        if (n != 1) { 
     630          error = true; 
     631          break; 
     632        } 
     633 
     634        print_ACK (); 
     635        printf("%d\r", cc3_gpio_get_servo_position(arg_list[0])); 
     636        break; 
     637 
    627638      case SERVO_OUTPUT: 
    628639        if (n != 2) {