Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revisionNext revisionBoth sides next revision | ||
code:sub2r-lib [2022/08/30 18:42] – [byte_span] Igor Yefmov | code:sub2r-lib [2022/08/30 18:48] – [UFix_8_8] Igor Yefmov | ||
---|---|---|---|
Line 357: | Line 357: | ||
| <code c++> | | <code c++> | ||
| <code c++> | | <code c++> | ||
- | |||
- | |||
- | ==== UFix_8_8 ==== | ||
- | {{ : | ||
- | |||
- | A helper class for working with a 2-byte floating number format used to specify fractional parameters for the FX3. More details are available in [[code: | ||
- | |||
- | ^ Method ^ Signature ^ Functionality ^ | ||
- | | '' | ||
- | UFix_8_8( | ||
- | uint8_t _i | ||
- | , uint8_t _f = 0 | ||
- | ) noexcept</ | ||
- | | '' | ||
- | UFix_8_8(double _d) | ||
- | noexcept;</ | ||
- | | '' | ||
- | gsl:: | ||
- | ) noexcept;</ | ||
- | | '' | ||
- | operator double() const | ||
- | noexcept;</ | ||
- | | '' | ||
- | operator uint16_t() const | ||
- | noexcept;</ | ||
- | uint8_t valI{1}, valF{128}; | ||
- | auto val{S2R:: | ||
- | S2R::I2C dev; | ||
- | // a port to set the image adjustment auto- | ||
- | // functions' | ||
- | constexpr uint8_t port{0xDF}; | ||
- | dev.vrCmd(port, | ||
- | </ | ||
Line 408: | Line 375: | ||
using namespace S2R; | using namespace S2R; | ||
- | cout << " | + | cout << " |
- | | + | const auto numDevs{ImgSensor:: |
- | | + | cout << " |
- | cout << " | + | ImgSensor dev(false); |
- | for(uint8_t i = 0; i < numDevs; ++i){ | + | for(uint8_t i{}; i < numDevs; ++i){ |
- | auto GAIN_R | + | auto GAIN_R{IImgSensorChip:: |
cout << " | cout << " | ||
if(dev.open(i)){ | if(dev.open(i)){ | ||
- | wcout << L" | + | wcout << L" |
- | cout << " | + | cout << " |
- | cout << "FX3 version info: " << string(dev.fx3Version()) << | + | cout << "FX3 version info: " << string(dev.fx3Version()) << |
- | cout << "FPGA version info: " << string(dev.fpgaVersion()) << | + | cout << "FPGA version info: " << string(dev.fpgaVersion()) << |
- | auto & ov = *dev.sensor(); | + | |
- | if(dev){ | + | |
- | cout << " | + | cout << " |
- | auto gainR = ov[GAIN_R]; | + | auto gainR{ov[GAIN_R]}; |
gainR = gainR + 1; // increment the red gain by one and update the sensor with the new value | gainR = gainR + 1; // increment the red gain by one and update the sensor with the new value | ||
- | cout << "after increasing red channel gain by 1 it is now: " << gainR << | + | cout << "after increasing red channel gain by 1 it is now: " << gainR << |
ov[GAIN_R] -= 1; | ov[GAIN_R] -= 1; | ||
- | cout << "and back to the previous value of: " << gainR << | + | cout << "and back to the previous value of: " << gainR << |
ov[GAIN_R] *= 1.0; | ov[GAIN_R] *= 1.0; | ||
} | } | ||
Line 434: | Line 401: | ||
dev.close(); | dev.close(); | ||
if(dev){ | if(dev){ | ||
- | cout << " | + | cout << " |
}else{ | }else{ | ||
- | cout << "the device is now closed and cannot be accessed without re-opening it" | + | cout << "the device is now closed and cannot be accessed without re-opening it\n"; |
- | cout << "For example the red channel gain is now: " << | + | cout << "For example the red channel gain is now: " << |
- | cout << "But some info is still available, like the sensor chipset: " << dev-> | + | cout << "But some info is still available, like the sensor chipset: " << dev-> |
- | cout << "Or the information about the limit of red channel gain: " << dev-> | + | cout << "Or the information about the limit of red channel gain: " << dev-> |
} | } | ||
}else{ | }else{ | ||
- | cout << " | + | cout << " |
if(dev.isValid()){ | if(dev.isValid()){ | ||
- | wcout << L"But the FX3 part is still functional, so we can get info like the device' | + | wcout << L"But the FX3 part is still functional, so we can get info like the device' |
} | } | ||
} | } | ||
- | cout << | + | cout << |
} | } | ||
return 0; | return 0; |