Skip to content

Commit

Permalink
doc update pass 2
Browse files Browse the repository at this point in the history
  • Loading branch information
MichaelYKersey committed Jan 4, 2025
1 parent 8f8f4d1 commit bea3799
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 41 deletions.
60 changes: 23 additions & 37 deletions include/libhal-expander/tla2528.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -47,98 +47,84 @@ class tla2528
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
* @throws hal::resource_unavailable_try_again - if adapters are made for a
* pin an exception may be thrown to prevent invalid behavior
* @throws hal::no_such_device - no device responded on i2c bus
*/
void set_pin_mode(pin_mode p_mode, hal::byte p_channel);

/**
* @brief set digital output level pin
*
* @param p_channel pin to set output
* @param p_high the output level of the pin, true is high, false is low.
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
* @throws hal::no_such_device - no device responded on i2c bus
*
* The device will write to a register that caches the desired output state.
* When a pin is in a digital output mode it will reference the desired state
* cache. If the pin is not set to digital output it will just be stored.
*
* @param p_channel pin to set output
* @param p_high the output level of the pin, true is high, false is low.
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
*/
void set_digital_out(hal::byte p_channel, bool p_high);
/**
* @brief set digital output levels on all pins
*
* @param p_values The byte is used as a bit field of bool values to set the
* pin outputs. i.e the 0th bit in the byte will set the 0 pin. If a bit is
* 1 it is high. If the bit is 0 it is low.
*
* @throws hal::no_such_device - no device responded on i2c bus
*
* The device will write to a register that caches the desired output state.
* When a pin is in a digital output mode it will reference the desired state
* cache. If the pin is not set to digital output it will just be stored.
*
* @param p_values The byte is used as a bit field of bool values to set the
* pin outputs. i.e the 0th bit in the byte will set the 0 pin. If a bit is
* 1 it is high. If the bit is 0 it is low.
*/
void set_digital_bus_out(hal::byte p_values);
/**
* @brief read digital output state register of an output pin
*
* @param p_channel pin you would like to get the ouput value
*
* @return if the pin's output value register is high
*
* @return if the pin's output value register is high If a pin is not set to
* output pin the returned state will be used once it changes to an output
* pin.
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
*
* @throws hal::no_such_device - no device responded on i2c bus
*
* If a pin is not set to output pin the returned state will be used once it
* changes to an output pin.
*/
bool get_digital_out(hal::byte p_channel);
/**
* @brief read digital output state register of all output pins
*
* @return The byte is used as a bit field of bool values to give the pins'
* register. i.e the 0th bit in the byte will be the 0 pin's stored value. If
* a bit is 1 it is high. If the bit is 0 it is low.
* @throws hal::no_such_device - no device responded on i2c bus
* If the pin is not set to output pin the returned state will be used once it
* changes to an output pin.
* a bit is 1 it is high. If the bit is 0 it is low. If the pin is not set to
* output pin the returned state will be used once it changes to an output
* pin.
*/
hal::byte get_digital_bus_out();

/**
* @brief read the digital level of a pins
*
* @return if the pin's digital read value is high.
* @return if the pin's digital read value is high. If a pin is not set to
* digital input or output the returned value may not correlate with the true
* value.
* @throws hal::argument_out_of_domain - if p_channel out of range. (>7)
* @throws hal::no_such_device - no device responded on i2c bus
*
* If a pin is not set to digital input or output the returned value may not
* correlate with the true value.
*/
bool get_digital_in(hal::byte p_channel);
/**
* @brief read the digital levels of all pins
*
* @return The byte is used as a bit field of bool values to give the pins'
* digital read values. i.e the 0th bit in the byte will be the 0 pin's stored
* value. If a bit is 1 it is high. If the bit is 0 it is low.
* @throws hal::no_such_device - no device responded on i2c bus
* value. If a bit is 1 it is high. If the bit is 0 it is low. If the pin is
* not set to digital input or output the returned value may not correlate
* with the true value.
*
* If the pin is not set to digital input or output the returned value may not
* correlate with the true value.
*/
hal::byte get_digital_bus_in();

/**
* @brief read the analog input of a pin.
*
* @param p_channel if out of range (>7) an exception will be thrown
* @return adc reading as a float between 0 and 1 inclusive
* @return adc reading as a float between 0 and 1 inclusive. If the pin is not
* set to analog input the returned value may not correlate with the true
* value.
* @throws hal::argument_out_of_domain - if p_channel out of range. (>7)
* @throws hal::no_such_device - no device responded on i2c bus
*
* If the pin is not set to analog input the returned value may not correlate
* with the true value.
*/
float get_analog_in(hal::byte p_channel);

Expand Down
5 changes: 2 additions & 3 deletions include/libhal-expander/tla2528_adapters.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class tla2528_output_pin : public hal::output_pin
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
* @throws hal::resource_unavailable_try_again - if an adapter has already been
* been made for the pin
* @throws hal::no_such_device - no device responded on i2c bus
* @throws hal::operation_not_supported - if the settings could not be achieved.
*/
tla2528_output_pin make_output_pin(
tla2528& p_tla2528,
Expand Down Expand Up @@ -67,7 +67,7 @@ class tla2528_input_pin : public hal::input_pin
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
* @throws hal::resource_unavailable_try_again - if an adapter has already been
* been made for the pin
* @throws hal::no_such_device - no device responded on i2c bus
* @throws hal::operation_not_supported - if the settings could not be achieved.
*/
tla2528_input_pin make_input_pin(tla2528& p_tla2528,
hal::byte p_channel,
Expand All @@ -93,7 +93,6 @@ class tla2528_adc : public hal::adc
* @throws hal::argument_out_of_domain - if p_channel out of range (>7)
* @throws hal::resource_unavailable_try_again - if an adapter has already been
* been made for the pin
* @throws hal::no_such_device - no device responded on i2c bus
*/
tla2528_adc make_adc(tla2528& p_tla2528, hal::byte p_channel);

Expand Down
3 changes: 2 additions & 1 deletion src/tla2528.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ tla2528::tla2528(hal::i2c& p_i2c, hal::byte p_i2c_address)
reset();
}

void tla2528::reset() {
void tla2528::reset()
{
// TODO(#9): implement reset command
}

Expand Down

0 comments on commit bea3799

Please sign in to comment.