Compound Eye Driver for XRCU. More...
#include <CompoI.h>
Public Member Functions | |
| CompoI (const uint32_t init_port) | |
| Creates a CompoI object. | |
| void | begin (const uint8_t init_i2c_address=DEFAULT_I2C_ADDRESS) |
| Activates this compound eye module. | |
| bool | test_comm () |
| Checks whether communication is established. | |
| uint16_t | get_product_code () |
| Gets the JM9 product number of the connected module. | |
| uint8_t | get_channel_val (const uint8_t channel) |
| Reads the IR intensity of a specific channel. | |
| uint8_t | get_max_idx () |
| Gets the channel number that reads the strongest IR intensity. | |
| uint8_t | get_max_val () |
| Gets the strongest IR intensity reading among all channels. | |
| uint8_t | get_min_idx () |
| Gets the channel number that reads the weakest IR intensity. | |
| uint8_t | get_min_val () |
| Gets the weakest IR intensity reading among all channels. | |
| uint8_t | get_avg_val () |
| Gets the mean average IR intensity reading of all channels. | |
| void | set_filter_on () |
| Turns on the signal filter to see IR balls only. | |
| void | set_filter_off () |
| Turns off the signal filter to see fire flames and sunlight only. | |
| bool | is_filter_on () |
| Checks whether the signal filter is turned on or not. | |
| void | calibrate () |
| Initializes the hardware. | |
| void | set_addr_0x01 () |
| Sets I2C address of the module to 0x01. | |
| void | set_addr_0x02 () |
| Sets I2C address of the module to 0x02. | |
| void | disable_vectors () |
| Disables the vector algorithm. | |
| void | enable_vectors () |
| Enables the vector algorithm. | |
| void | turn_off_leds () |
| Turns off LEDs. | |
| void | turn_on_leds () |
| Turns on LEDs. | |
| bool | are_leds_on () |
| Checks whether the LEDs are turned on or not. | |
| uint8_t | get_ball_angle () |
| Gets the ball angle. | |
| uint32_t | read_eeprom () |
| Gets the EEPROM values. | |
| void | reset () |
| Software resets the module. | |
| int16_t | get_ball_angle_360 () |
| Gets the ball angle from the entire circle. | |
| int16_t | get_ball_vector_mag () |
| Gets the ball strength calculated from vector algorithm. | |
| int16_t | get_max_val_360 () |
| Gets the strongest IR intensity reading among all channels. | |
| int16_t | get_avg_val_360 () |
| Gets the mean average IR intensity reading of all channels. | |
| void | set_resistance (const int16_t r) |
| Sets the resistance in series to photodiode. | |
| int16_t | get_resistance () |
| Gets the resistance in series to photodiode. | |
| int16_t | get_channel_val_360 (const uint8_t channel) |
| Reads the IR intensity of a specific channel. | |
Additional Inherited Members | |
| Protected Member Functions inherited from Supported_sensor | |
| Supported_sensor () | |
| Creates an object of a supported sensor. | |
| Protected Member Functions inherited from Supported_module | |
| Supported_module () | |
| Creates an object of a supported module. | |
Compound Eye Driver for XRCU.
| CompoI::CompoI | ( | const uint32_t | init_port | ) |
Creates a CompoI object.
| init_port | the I2C port connected to this compound eye module |
| bool CompoI::are_leds_on | ( | ) |
Checks whether the LEDs are turned on or not.
| void CompoI::begin | ( | const uint8_t | init_i2c_address = DEFAULT_I2C_ADDRESS | ) |
Activates this compound eye module.
YOU MUST CALL ME IN void setup () FUNCTION TO USE THIS OBJECT PROPERLY. Configures the settings of the I2C bus and the chip.
| init_i2c_address | the 7-bit I2C address of this compound eye module |
| void CompoI::calibrate | ( | ) |
Initializes the hardware.
This is already completed at the factory. There is no need for the user to call this method.
| void CompoI::disable_vectors | ( | ) |
Disables the vector algorithm.
The ball angle and strength calculations could be either HSL-like or vector-sum. Only one algorithm is used at a time to do the calculations.
This setting is saved and re-applied immediately, no need to reset or power-off-power-on.
| void CompoI::enable_vectors | ( | ) |
Enables the vector algorithm.
The ball angle and strength calculations could be either HSL-like or vector-sum. Only one algorithm is used at a time to do the calculations.
Vector algorithm treats each sensor reading as a vector pointing along the sensor direction, and finds the sum of all the available vectors. The direction of the sum vector is the direction of the ball, while the magnitude of the sum vector is (proportional to) the intensity of the ball.
This setting is saved and re-applied immediately, no need to reset or power-off-power-on.
| uint8_t CompoI::get_avg_val | ( | ) |
Gets the mean average IR intensity reading of all channels.
| int16_t CompoI::get_avg_val_360 | ( | ) |
Gets the mean average IR intensity reading of all channels.
Connect 2 sensors to form a 360-degree detection circle. The detection range of [90 : 270] degrees requires stable connection with the paired sensor.
| uint8_t CompoI::get_ball_angle | ( | ) |
Gets the ball angle.
This value starts with 0 degrees at the West (i.e. leftmost sensor), and increases clockwise.
| int16_t CompoI::get_ball_angle_360 | ( | ) |
Gets the ball angle from the entire circle.
This value starts with 0 degrees at the North (i.e. front sensor) and increases clockwise. 0 degrees is defined as the North of the connected sensor.
Connect 2 sensors to form a 360-degree detection circle. The detection range of [90 : 270] degrees requires stable connection with the paired sensor.
| int16_t CompoI::get_ball_vector_mag | ( | ) |
Gets the ball strength calculated from vector algorithm.
Connect 2 sensors to form a 360-degree detection circle. The detection range of [90 : 270] degrees requires stable connection with the paired sensor.
| uint8_t CompoI::get_channel_val | ( | const uint8_t | channel | ) |
Reads the IR intensity of a specific channel.
| channel | the channel number of compound-eye to read its value [1 : 7] |
| int16_t CompoI::get_channel_val_360 | ( | const uint8_t | channel | ) |
Reads the IR intensity of a specific channel.
The channel starts with 0 at the North (i.e. front sensor) and increases clockwise. 0 degrees is defined as the North of the connected sensor.
Connect 2 sensors to form a 360-degree detection circle. The detection range of [90 : 270] degrees requires stable connection with the paired sensor.
| channel | the channel number of compound-eye to read its value [0 : 11] |
| uint8_t CompoI::get_max_idx | ( | ) |
Gets the channel number that reads the strongest IR intensity.
| uint8_t CompoI::get_max_val | ( | ) |
Gets the strongest IR intensity reading among all channels.
| int16_t CompoI::get_max_val_360 | ( | ) |
Gets the strongest IR intensity reading among all channels.
Connect 2 sensors to form a 360-degree detection circle. The detection range of [90 : 270] degrees requires stable connection with the paired sensor.
| uint8_t CompoI::get_min_idx | ( | ) |
Gets the channel number that reads the weakest IR intensity.
| uint8_t CompoI::get_min_val | ( | ) |
Gets the weakest IR intensity reading among all channels.
| uint16_t CompoI::get_product_code | ( | ) |
Gets the JM9 product number of the connected module.
| int16_t CompoI::get_resistance | ( | ) |
Gets the resistance in series to photodiode.
| bool CompoI::is_filter_on | ( | ) |
Checks whether the signal filter is turned on or not.
| uint32_t CompoI::read_eeprom | ( | ) |
Gets the EEPROM values.
This method is for internal use such as menu use only. The returned values do not provide a guaranteed meaning and are subject to change without notice.
| void CompoI::set_addr_0x01 | ( | ) |
Sets I2C address of the module to 0x01.
This setting is saved and re-applied if the module is reset or power-off-power-on.
| void CompoI::set_addr_0x02 | ( | ) |
Sets I2C address of the module to 0x02.
This setting is saved and re-applied if the module is reset or power-off-power-on.
| void CompoI::set_filter_off | ( | ) |
Turns off the signal filter to see fire flames and sunlight only.
Only constant IR light sources are reflected in the readings. Signal ripples (such as IR balls) are removed from the readings.
| void CompoI::set_filter_on | ( | ) |
Turns on the signal filter to see IR balls only.
Only oscillating IR light sources are reflected in the readings. Background sunlight interference are removed from the readings.
| void CompoI::set_resistance | ( | const int16_t | r | ) |
Sets the resistance in series to photodiode.
Adjusts the sensitivity of the photodiodes. This setting is saved and re-applied immediately, no need to reset or power-off-power-on.
| r | the resistance [2000 : 10470] in ohms |
| bool CompoI::test_comm | ( | ) |
Checks whether communication is established.
| void CompoI::turn_off_leds | ( | ) |
Turns off LEDs.
This setting is saved and re-applied immediately, no need to reset or power-off-power-on.
| void CompoI::turn_on_leds | ( | ) |
Turns on LEDs.
This setting is saved and re-applied immediately, no need to reset or power-off-power-on.