stmhal, servo: Rename calibrate method to calibration.
It should be a noun, since it supports getting and setting depending on the number of arguments given.
This commit is contained in:
parent
6691c9e655
commit
af797f476f
|
@ -191,7 +191,7 @@ Q(CIRCULAR)
|
||||||
// for Servo object
|
// for Servo object
|
||||||
Q(Servo)
|
Q(Servo)
|
||||||
Q(pulse_width)
|
Q(pulse_width)
|
||||||
Q(calibrate)
|
Q(calibration)
|
||||||
Q(angle)
|
Q(angle)
|
||||||
Q(speed)
|
Q(speed)
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,7 @@ STATIC mp_obj_t pyb_servo_pulse_width(uint n_args, const mp_obj_t *args) {
|
||||||
|
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_pulse_width_obj, 1, 2, pyb_servo_pulse_width);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_pulse_width_obj, 1, 2, pyb_servo_pulse_width);
|
||||||
|
|
||||||
STATIC mp_obj_t pyb_servo_calibrate(uint n_args, const mp_obj_t *args) {
|
STATIC mp_obj_t pyb_servo_calibration(uint n_args, const mp_obj_t *args) {
|
||||||
pyb_servo_obj_t *self = args[0];
|
pyb_servo_obj_t *self = args[0];
|
||||||
if (n_args == 1) {
|
if (n_args == 1) {
|
||||||
// get calibration values
|
// get calibration values
|
||||||
|
@ -219,10 +219,10 @@ STATIC mp_obj_t pyb_servo_calibrate(uint n_args, const mp_obj_t *args) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// bad number of arguments
|
// bad number of arguments
|
||||||
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "calibrate expecting 1, 4 or 6 arguments, got %d", n_args));
|
nlr_raise(mp_obj_new_exception_msg_varg(&mp_type_TypeError, "calibration expecting 1, 4 or 6 arguments, got %d", n_args));
|
||||||
}
|
}
|
||||||
|
|
||||||
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_calibrate_obj, 1, 6, pyb_servo_calibrate);
|
STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_calibration_obj, 1, 6, pyb_servo_calibration);
|
||||||
|
|
||||||
STATIC mp_obj_t pyb_servo_angle(uint n_args, const mp_obj_t *args) {
|
STATIC mp_obj_t pyb_servo_angle(uint n_args, const mp_obj_t *args) {
|
||||||
pyb_servo_obj_t *self = args[0];
|
pyb_servo_obj_t *self = args[0];
|
||||||
|
@ -278,7 +278,7 @@ STATIC MP_DEFINE_CONST_FUN_OBJ_VAR_BETWEEN(pyb_servo_speed_obj, 1, 3, pyb_servo_
|
||||||
|
|
||||||
STATIC const mp_map_elem_t pyb_servo_locals_dict_table[] = {
|
STATIC const mp_map_elem_t pyb_servo_locals_dict_table[] = {
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulse_width), (mp_obj_t)&pyb_servo_pulse_width_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_pulse_width), (mp_obj_t)&pyb_servo_pulse_width_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_calibrate), (mp_obj_t)&pyb_servo_calibrate_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_calibration), (mp_obj_t)&pyb_servo_calibration_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_angle), (mp_obj_t)&pyb_servo_angle_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_angle), (mp_obj_t)&pyb_servo_angle_obj },
|
||||||
{ MP_OBJ_NEW_QSTR(MP_QSTR_speed), (mp_obj_t)&pyb_servo_speed_obj },
|
{ MP_OBJ_NEW_QSTR(MP_QSTR_speed), (mp_obj_t)&pyb_servo_speed_obj },
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue