JM9 XRCU Board 0.1.3a
Libraries API Reference
Loading...
Searching...
No Matches
CompoI Class Reference

Compound Eye Driver for XRCU. More...

#include <CompoI.h>

Inheritance diagram for CompoI:
Supported_sensor Supported_module

Public Member Functions

 CompoI (const uint32_t init_port)
 Creates a CompoI object.
 
void begin (const uint8_t init_i2c_address=0x02)
 Activates this compound eye module.
 
bool test_comm ()
 Checks whether communication is established.
 
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.
 
uint8_t set_filter_on ()
 Turns on the signal filter.
 
uint8_t set_filter_off ()
 Turns off the signal filter.
 
uint8_t calibrate ()
 Initializes the hardware.
 
uint8_t set_addr_0x01 ()
 Sets I2C address of the module to 0x01.
 
uint8_t set_addr_0x02 ()
 Sets I2C address of the module to 0x02.
 
uint8_t turn_off_leds ()
 Turns off LEDs.
 
uint8_t turn_on_leds ()
 Turns on LEDs.
 
uint8_t get_ball_angle ()
 Gets the ball angle.
 
uint32_t read_eeprom ()
 Gets the EEPROM values.
 
uint8_t reset ()
 Software resets the module.
 

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.
 

Detailed Description

Compound Eye Driver for XRCU.

Author
YH Choi @ JM9

Constructor & Destructor Documentation

◆ CompoI()

CompoI::CompoI ( const uint32_t init_port)

Creates a CompoI object.

Parameters
init_portthe I2C port connected to this compound eye module

Member Function Documentation

◆ begin()

void CompoI::begin ( const uint8_t init_i2c_address = 0x02)

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.

Parameters
init_i2c_addressthe 7-bit I2C address of this compound eye module

◆ calibrate()

uint8_t CompoI::calibrate ( )

Initializes the hardware.

This is already completed at the factory. There is no need for the user to call this method.

Returns
undefined

◆ get_avg_val()

uint8_t CompoI::get_avg_val ( )

Gets the mean average IR intensity reading of all channels.

Returns
the mean average IR intensity reading of all channels [0 : <= 255]
Note
The actual maximum reading might vary under different lighting conditions.

◆ get_ball_angle()

uint8_t CompoI::get_ball_angle ( )

Gets the ball angle.

Returns
the ball angle [0 : 180] (in degrees)

◆ get_channel_val()

uint8_t CompoI::get_channel_val ( const uint8_t channel)

Reads the IR intensity of a specific channel.

Parameters
channelthe channel number of compound-eye to read its value [1 : 7]
Returns
the IR intensity read by the photodiodes of the selected channel [0 : <= 255]
Note
The actual maximum reading might vary under different lighting conditions.

◆ get_max_idx()

uint8_t CompoI::get_max_idx ( )

Gets the channel number that reads the strongest IR intensity.

Returns
the channel number that reads the strongest IR intensity [1 : 7]

◆ get_max_val()

uint8_t CompoI::get_max_val ( )

Gets the strongest IR intensity reading among all channels.

Returns
the strongest IR intensity reading among all channels [0 : <= 255]
Note
The actual maximum reading might vary under different lighting conditions.

◆ get_min_idx()

uint8_t CompoI::get_min_idx ( )

Gets the channel number that reads the weakest IR intensity.

Returns
the channel number that reads the weakest IR intensity [1 : 7]

◆ get_min_val()

uint8_t CompoI::get_min_val ( )

Gets the weakest IR intensity reading among all channels.

Returns
the weakest IR intensity reading among all channels [0 : <= 255]
Note
The actual maximum reading might vary under different lighting conditions.

◆ read_eeprom()

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.

Returns
EEPROM values [0x04, 0x03, 0x02, 0x01]

◆ reset()

uint8_t CompoI::reset ( )

Software resets the module.

Returns
undefined

◆ set_addr_0x01()

uint8_t 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.

Returns
undefined

◆ set_addr_0x02()

uint8_t 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.

Returns
undefined

◆ set_filter_off()

uint8_t CompoI::set_filter_off ( )

Turns off the signal filter.

Disables smoothing of signal ripples. This setting is saved and re-applied if the module is reset or power-off-power-on.

Returns
undefined

◆ set_filter_on()

uint8_t CompoI::set_filter_on ( )

Turns on the signal filter.

Enables smoothing of signal ripples. This setting is saved and re-applied if the module is reset or power-off-power-on.

Returns
undefined

◆ test_comm()

bool CompoI::test_comm ( )

Checks whether communication is established.

Returns
true if communication with the module is established, false otherwise

◆ turn_off_leds()

uint8_t CompoI::turn_off_leds ( )

Turns off LEDs.

This setting is saved and re-applied if the module is reset or power-off-power-on.

Returns
undefined

◆ turn_on_leds()

uint8_t CompoI::turn_on_leds ( )

Turns on LEDs.

This setting is saved and re-applied if the module is reset or power-off-power-on.

Returns
undefined

The documentation for this class was generated from the following files: