adafruit / Adafruit_CircuitPython_BLE_Adafruit

Support for the BLE Adafruit Service, which provides access to on-board sensors and components
MIT License
9 stars 6 forks source link

example needs updating for CP 7.x #14

Closed jepler closed 2 years ago

jepler commented 2 years ago
libraries/helpers/ble_adafruit/examples/ble_adafruit_feather_bluefruit_sense.py
90:mic_samples = ulab.zeros(MIC_NUM_SAMPLES, dtype=ulab.uint16)

libraries/helpers/ble_adafruit/examples/ble_adafruit_clue.py
64:mic_samples = ulab.zeros(MIC_NUM_SAMPLES, dtype=ulab.uint16)

these need to be updated to use ulab.numpy

jmangum commented 2 years ago

Regarding @jepler comment, I have tested this using: import ulab .numpy as np and mic_samples = np.zeros(MIC_NUM_SAMPLES, dtype=np.uint16)

Also tested it using a perhaps cleaner: import ulab and mic_samples = ulab.numpy.zeros(MIC_NUM_SAMPLES, dtype=ulab.numpy.uint16) (which is, I believe, @jepler suggested change).

rsbohn commented 2 years ago

Seems like we're only using ulab.numpy to get an array of 16 bit values. Could probably use array.array instead.

dhalbert commented 2 years ago

Seems like we're only using ulab.numpy to get an array of 16 bit values. Could probably use array.array instead.

We do

            mic_svc.sound_samples = mic_samples - 32768

which relies on ulab.numpy operations.

rsbohn commented 2 years ago

Ah, I see.

Looks like we're working on the same issue, you're just ahead of me.