Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(base_peripheral): make BasePeripheral a template on size of register address #151

Merged
merged 13 commits into from
Feb 13, 2024

Conversation

finger563
Copy link
Contributor

@finger563 finger563 commented Feb 12, 2024

Description

  • Update base peripheral component to be a template class whith template argument being the type for the register address (default uint8_t)
  • Updated all subclasses to include the required <> for using the default type of uint8_t
  • Refactored gt911 and st25dv classes to specialize with uint16_t as the RegisterAddressType
  • Added bool BasePeripheral::probe(std::error_code&) as public function
  • Added void BasePeripheral::set_address(uint8_t) as public function
  • Added void BasePeripheral::set_probe(...) as public function
  • Added void BasePeripheral::set_write(...) as public function
  • Added void BasePeripheral::set_read(...) as public function
  • Added void BasePeripheral::set_read_register(...) as public function
  • Added void BasePeripheral::set_write_then_read(...) as public function
  • Added void BasePeripheral::set_config(...) as public function
  • Fix bug in st25dv from Feature/base peripheral #150 which read IT_STS register from SYST address space instead of DATA address space

Motivation and Context

Improves the applicability and reuse of the base peripheral component to support peripherals which have 16 bit register addresses (such as the st25dv and gt911 components)

How has this been tested?

  • Building and running the gt911 example
  • Building and running the st25dv example

Screenshots (if appropriate, e.g. schematic, board, console logs, lab pictures):

Gt911:
CleanShot 2024-02-12 at 20 39 55

St25dv:
CleanShot 2024-02-12 at 20 41 58
image
Testing new i2c logging:
CleanShot 2024-02-13 at 08 30 24
CleanShot 2024-02-13 at 08 50 19

Types of changes

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update
  • Hardware (schematic, board, system design) change
  • Software change

Checklist:

  • My change requires a change to the documentation.
  • I have added / updated the documentation related to this change via either README or WIKI

Software

  • I have added tests to cover my changes.
  • I have updated the .github/workflows/build.yml file to add my new test to the automated cloud build github action.
  • All new and existing tests passed.
  • My code follows the code style of this project.

…ster addresses

* Update base peripheral component to be a template class whith template argument being the type for the register address (default uint8_t)
* Updated all subclasses to include the required <> for using the default type of uint8_t
@finger563 finger563 marked this pull request as draft February 12, 2024 19:38
Copy link

✅Static analysis result - no issues found! ✅

@finger563 finger563 added enhancement New feature or request base peripheral labels Feb 12, 2024
* Update how multi-byte registers are handled in base_peripheral and add additional logging for help debugging
* Update gt911 and st25dv to subclass with register size 16 bit
@finger563 finger563 marked this pull request as ready for review February 13, 2024 02:36
@finger563 finger563 self-assigned this Feb 13, 2024
@finger563 finger563 added st25dv gt911 touch driver labels Feb 13, 2024
* IT_STS is in DATA address space not SYST address space
* Change IT_STS from class to bitfield struct so that we can use it when returning the interrupt status
* Added priting and comparison for IT_STS
* Update example to decrease logging in ST25, use new IT_STS logging, and update clock speed to 1MHz
* Added methods for updating specific members of the config or the config as a whole
@finger563 finger563 merged commit b4e301f into main Feb 13, 2024
33 checks passed
@finger563 finger563 deleted the feature/base-peripheral-template branch February 13, 2024 15:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
base peripheral enhancement New feature or request gt911 touch driver st25dv
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant