Skip to content

Refactor to add support for Circuit Playground Bluefruit #74

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

Merged
merged 6 commits into from
Nov 22, 2019

Conversation

kattni
Copy link
Contributor

@kattni kattni commented Nov 22, 2019

This is a complete refactor to include support for Circuit Playground Bluefruit. I have created a new bluefruit.py for the CPB and circuit_playground_base.py for all the common code. As well, I have included two new features into the bluefruit module: sound_level and loud_sound. These were desired features for the express module but were never included due to memory constraints on the CPX, an issue not currently present on the CPB.

There is no plan for this to be included in 4.x. There is no change to how the express module works which is what is included in 4.x, and therefore there is no reason to update the build.

Once the BLE/CPB-specific CircuitPython code is finalised, I will look into what features should be added here. This refactor was done with that intent in mind.

Change log:

  • Removed 3.x CircuitPython checks
  • Fixed typos
  • Created bluefruit.py for CPB
  • Moved all common code to CircuitPlaygroundBase class
  • Refactored audio code to work in the base class
  • Changed touch_A7 to touch_TX in the base class to match the Bluefruit silk (No pad A7), and added alias to express (CPX has both TX and A7 on the silk) so all current code continues to function the same. You can call touch_A7 or touch_TX using the express module.
  • Added sound_level and loud_sound features to bluefruit module
  • Documented all features for CPX and CPB in base class
  • Sphinx updates.

Example use on Bluefruit:

from adafruit_circuitplayground.bluefruit import cpb

cpb.pixels.fill((0, 255, 0))

Express usage has not changed.

I have attached a 5.x Circuit Playground Express CircuitPython build with this library frozen in - the bluefruit module is not included as it will not be included when this refactor is released. To test, double-tap the reset button on your Circuit Playground Express to enter the bootloader, and drag the CPX_refactor_build.uf2 to the CPLAYBOOT drive.

CPX_refactor_build.uf2.zip

@kattni kattni requested a review from a team November 22, 2019 16:16
@ladyada
Copy link
Member

ladyada commented Nov 22, 2019

@dhalbert please review

@jepler
Copy link
Contributor

jepler commented Nov 22, 2019

I didn't test anything but the audiopwmio part makes sense to me.

Copy link
Contributor

@dhalbert dhalbert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! Compared Base class with previous version of library. Comparison looks good. I know you tested in real life.

Next step (I will do) is to handle the dummy version of bluefruit.py and freeze that version into CPX.

@dhalbert dhalbert merged commit 59850fb into adafruit:master Nov 22, 2019
adafruit-adabot added a commit to adafruit/Adafruit_CircuitPython_Bundle that referenced this pull request Dec 3, 2019
Updating https://github.com/adafruit/Adafruit_CircuitPython_CircuitPlayground to 3.0.0 from 2.1.5:
  > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#75 from kattni/remove-simpleio
  > Merge pull request adafruit/Adafruit_CircuitPython_CircuitPlayground#74 from kattni/bluefruit

Updating https://github.com/adafruit/Adafruit_CircuitPython_Bundle/circuitpython_library_list.md to NA from NA:
  > Added the following libraries: Adafruit_CircuitPython_RPLIDAR, Adafruit_CircuitPython_Logging
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants