feat(*): add iic address setting api for s210a

This commit is contained in:
kalman 2019-03-23 16:58:54 +08:00
parent 415cf31a36
commit f25685153b
10 changed files with 44 additions and 5 deletions

View File

@ -259,6 +259,14 @@ enum class Option : std::uint8_t {
*/
GYROSCOPE_LOW_PASS_FILTER,
/**
* The setting of IIC address
* <p>
* range: [0,65535], default: 0
* </p>
*/
IIC_ADDRESS_SETTING,
/** Zero drift calibration */
ZERO_DRIFT_CALIBRATION,
/** Erase chip */

View File

@ -80,6 +80,9 @@ int XuCamCtrlId(Option option) {
case Option::GYROSCOPE_LOW_PASS_FILTER:
return 12;
break;
case Option::IIC_ADDRESS_SETTING:
return 13;
break;
default:
LOG(FATAL) << "No cam ctrl id for " << option;
}
@ -148,7 +151,8 @@ void Channels::UpdateControlInfos() {
Option::DESIRED_BRIGHTNESS, Option::IR_CONTROL,
Option::HDR_MODE, Option::ACCELEROMETER_RANGE,
Option::GYROSCOPE_RANGE, Option::ACCELEROMETER_LOW_PASS_FILTER,
Option::GYROSCOPE_LOW_PASS_FILTER}) {
Option::GYROSCOPE_LOW_PASS_FILTER,
Option::IIC_ADDRESS_SETTING}) {
if (supports.find(option) != supports.end())
control_infos_[option] = XuControlInfo(option);
}
@ -196,6 +200,7 @@ std::int32_t Channels::GetControlValue(const Option &option) const {
case Option::GYROSCOPE_RANGE:
case Option::ACCELEROMETER_LOW_PASS_FILTER:
case Option::GYROSCOPE_LOW_PASS_FILTER:
case Option::IIC_ADDRESS_SETTING:
return XuCamCtrlGet(option);
case Option::ZERO_DRIFT_CALIBRATION:
case Option::ERASE_CHIP:
@ -277,7 +282,8 @@ void Channels::SetControlValue(const Option &option, std::int32_t value) {
case Option::DESIRED_BRIGHTNESS:
case Option::IR_CONTROL:
case Option::HDR_MODE:
case Option::MIN_EXPOSURE_TIME: {
case Option::MIN_EXPOSURE_TIME:
case Option::IIC_ADDRESS_SETTING: {
if (!in_range())
break;
XuCamCtrlSet(option, value);
@ -313,6 +319,7 @@ bool Channels::RunControlAction(const Option &option) const {
case Option::GYROSCOPE_RANGE:
case Option::ACCELEROMETER_LOW_PASS_FILTER:
case Option::GYROSCOPE_LOW_PASS_FILTER:
case Option::IIC_ADDRESS_SETTING:
LOG(WARNING) << option << " run action useless";
return false;
default:

View File

@ -53,7 +53,7 @@ const std::map<Model, OptionSupports> option_supports_map = {
Option::MIN_EXPOSURE_TIME, Option::DESIRED_BRIGHTNESS,
Option::ACCELEROMETER_RANGE, Option::GYROSCOPE_RANGE,
Option::ACCELEROMETER_LOW_PASS_FILTER, Option::GYROSCOPE_LOW_PASS_FILTER,
Option::ERASE_CHIP}
Option::IIC_ADDRESS_SETTING, Option::ERASE_CHIP}
}
};

View File

@ -122,6 +122,7 @@ const char *to_string(const Option &value) {
CASE(GYROSCOPE_RANGE)
CASE(ACCELEROMETER_LOW_PASS_FILTER)
CASE(GYROSCOPE_LOW_PASS_FILTER)
CASE(IIC_ADDRESS_SETTING)
CASE(ZERO_DRIFT_CALIBRATION)
CASE(ERASE_CHIP)
default:

View File

@ -95,6 +95,11 @@ enum class Option : int {
* values: {23,64}, default: 64
*/
GYROSCOPE_LOW_PASS_FILTER,
/**
* The setting of IIC address
* range: [0,65535], default: 0
*/
IIC_ADDRESS_SETTING,
/** Zero drift calibration */
ZERO_DRIFT_CALIBRATION,
/** Erase chip */

View File

@ -277,6 +277,8 @@ RawOption from_jni(const JniOption& Option) {
return RawOption::ACCELEROMETER_LOW_PASS_FILTER;
case JniOption::GYROSCOPE_LOW_PASS_FILTER:
return RawOption::GYROSCOPE_LOW_PASS_FILTER;
case JniOption::IIC_ADDRESS_SETTING:
return RawOption::IIC_ADDRESS_SETTING;
case JniOption::ZERO_DRIFT_CALIBRATION:
return RawOption::ZERO_DRIFT_CALIBRATION;
case JniOption::ERASE_CHIP:
@ -321,6 +323,8 @@ JniOption to_jni(const RawOption& Option) {
return JniOption::ACCELEROMETER_LOW_PASS_FILTER;
case RawOption::GYROSCOPE_LOW_PASS_FILTER:
return JniOption::GYROSCOPE_LOW_PASS_FILTER;
case JniOption::IIC_ADDRESS_SETTING:
return RawOption::IIC_ADDRESS_SETTING;
case RawOption::ZERO_DRIFT_CALIBRATION:
return JniOption::ZERO_DRIFT_CALIBRATION;
case RawOption::ERASE_CHIP:

View File

@ -95,6 +95,11 @@ public enum Option {
* values: {23,64}, default: 64
*/
GYROSCOPE_LOW_PASS_FILTER,
/**
* The setting of IIC address
* range: [0,65535], default: 0
*/
IIC_ADDRESS_SETTING,
/** Zero drift calibration */
ZERO_DRIFT_CALIBRATION,
/** Erase chip */

View File

@ -178,6 +178,10 @@ option = enum {
# values: {23,64}, default: 64
gyroscope_low_pass_filter;
iic_address_setting;
# The setting of IIC address
# range: [0,65535], default: 0
# Zero drift calibration
zero_drift_calibration;
# Erase chip

View File

@ -105,4 +105,8 @@ standard210a/accel_low_filter: -1
# standard210a/gyro_low_filter range: [23,64]
standard210a/gyro_low_filter: -1
# standard210a/gyro_low_filter: 64
# standard210a/gyro_low_filter: 64
# standard210a/iic_address_setting range: [0,65535]
standard210a/iic_address_setting: -1
# standard210a/iic_address_setting: 0

View File

@ -250,7 +250,8 @@ class ROSWrapperNodelet : public nodelet::Nodelet {
{Option::GYROSCOPE_RANGE, "standard210a/gyro_range"},
{Option::ACCELEROMETER_LOW_PASS_FILTER,
"standard210a/accel_low_filter"},
{Option::GYROSCOPE_LOW_PASS_FILTER, "standard210a/gyro_low_filter"}};
{Option::GYROSCOPE_LOW_PASS_FILTER, "standard210a/gyro_low_filter"}
{Option::IIC_ADDRESS_SETTING, "standard2/iic_address_setting"}};
}
// device options of standard2