adafruit_ble_adafruit.accelerometer_service¶
BLE access to accelerometer data.
- Author(s): Dan Halbert
adafruit_ble_adafruit.adafruit_service¶
Access to sensors and hardware on or connected to BLE-capable boards.
- Author(s): Dan Halbert
Implementation Notes¶
Hardware:
Software and Dependencies:
- Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
- 
class adafruit_ble_adafruit.adafruit_service.AdafruitServerAdvertisement(*, entry=None)¶
- Advertise the Adafruit company ID and the board USB PID. - 
pid¶
- The USB PID (product id) for this board. 
 
- 
- 
class adafruit_ble_adafruit.adafruit_service.AdafruitService(*, service=None, secondary=False, **initial_values)¶
- Common superclass for all Adafruit board services. - 
static adafruit_service_uuid(n)¶
- Generate a VendorUUID which fills in a 16-bit value in the standard Adafruit Service UUID: ADAFnnnn-C332-42A8-93BD-25E905756CB8. 
 - 
classmethod measurement_period_charac(msecs=1000)¶
- Create a measurement_period Characteristic for use by a subclass. 
 - 
classmethod service_version_charac(version=1)¶
- Create a service_version Characteristic for use by a subclass. 
 
- 
static 
adafruit_ble_adafruit.addressable_pixel_service¶
BLE control of addressable pixels, such as NeoPixels or DotStars.
- Author(s): Dan Halbert
- 
class adafruit_ble_adafruit.addressable_pixel_service.AddressablePixelService(service=None)¶
- Control of NeoPixels, DotStars, etc. - 
pixel_buffer_size¶
- 0 = WS2812 (NeoPixel), 800kHz 1 = SPI (APA102: DotStar) 
 - 
pixel_pin¶
- Send data out on this pin. 
 - 
values¶
- Return a tuple (start, write_now, data) corresponding to the different parts of - _pixel_packet.
 
- 
- 
class adafruit_ble_adafruit.addressable_pixel_service.PixelValues(start, write_now, data)¶
- Namedtuple for pixel data and instructions. - start - start writing data into buffer at this byte number (byte, not pixel) 
- write_now - Trueif data should be written to pixels now.- Falseif write should not happen immediately.
- data - sequence of bytes of data for all pixels, in proper color order for type of pixel 
 - 
data¶
- Alias for field number 2 
 - 
start¶
- Alias for field number 0 
 - 
write_now¶
- Alias for field number 1 
 
adafruit_ble_adafruit.barometric_pressure_service¶
BLE access to barometric pressure data.
- Author(s): Dan Halbert
adafruit_ble_adafruit.button_service¶
BLE access to buttons and switches.
- Author(s): Dan Halbert
- Status of buttons and switches on the board. - Truewhen Button A is pressed.
 - Truewhen Button B is pressed.
 - send notification only on changes. -1 means stop reading. - Type: - Initially 0 
 - slide switch: 1 for left; 0 for right bit 1: 1 if button A is pressed bit 2: 1 if button B is pressed other bits are available for future buttons and switches - Type: - bit 0 
 - Update the pressed value all at once. 
 - Truewhen the slide switch is set to the left;- Falsewhen to the right.
 
adafruit_ble_adafruit.gesture_service¶
BLE access to gesture detector.
- Author(s): Dan Halbert
- 
class adafruit_ble_adafruit.gesture_service.GestureService(*, service=None, secondary=False, **initial_values)¶
- Gesture sensor. - 
DOWN= 2¶
- swipe down 
 - 
LEFT= 3¶
- swipe left 
 - 
RIGHT= 4¶
- swipe right 
 - 
UP= 1¶
- swipe up 
 - 
gesture¶
- no gesture 1: swipe up ( - UP) 2: swipe down (- DOWN) 3: swipe left (- LEFT) 4: swipe right (- RIGHT)- Type: - 0 
 - 
measurement_period¶
- send notification only on changes. -1 means stop reading. - Type: - Initially 0 
 
- 
adafruit_ble_adafruit.microphone_service¶
BLE access to microphone data.
- Author(s): Dan Halbert
- 
class adafruit_ble_adafruit.microphone_service.MicrophoneService(*, service=None, secondary=False, **initial_values)¶
- Digital microphone data. - 
measurement_period¶
- Initially 1000ms. 
 - 
number_of_channels¶
- 1 for mono, 2 for stereo (left and right) 
 - 
sound_samples¶
- Array of 16-bit sound samples, varying based on period. If num_channel == 2, the samples alternate left and right channels. 
 
- 
adafruit_ble_adafruit.proximity_service¶
BLE access to proximity sensor.
- Author(s): Dan Halbert
- 
class adafruit_ble_adafruit.proximity_service.ProximityService(*, service=None, secondary=False, **initial_values)¶
- Status of buttons and switches on the board. - 
measurement_period¶
- send notification only on changes. -1 means stop reading. - Type: - Initially 0 
 - 
proximity¶
- A higher number indicates a closer distance to the sensor. The value is unit-less. 
 
- 
adafruit_ble_adafruit.quaternion_service¶
BLE access to quaternion data.
- Author(s): Dan Halbert
- 
class adafruit_ble_adafruit.quaternion_service.QuaternionService(*, service=None, secondary=False, **initial_values)¶
- Quaternion values. - 
calibration_in¶
- acceleration x, y, z, # in m/s^2 gyro x, y, z, # in rad/s magnetic x, y, z, # in microteslas - Type: - 9-tuple of floats sent to client for calibration calculation 
 - 
calibration_out¶
- acceleration_zerog x, y, z, # in m/s^2 gyro_zerorate x, y, z, # in rad/s magnetic_hardiron x, y, z, # in microteslas magnetic_field f, # in microteslas magnetic_softiron v1, v2, v3, v4, v5, v6, v7, v8, v9, # unitless - Type: - 19-tuple of floats sent back to server after calibration calculation 
 - 
measurement_period¶
- Initially 1000ms. 
 - 
quaternion¶
- Tuple (qw, qx, qy, qz) of float quaternion values. 
 
- 
adafruit_ble_adafruit.tone_service¶
BLE access to play tones.
- Author(s): Dan Halbert
- 
class adafruit_ble_adafruit.tone_service.ToneService(service=None)¶
- Play tones. - 
play(frequency, duration)¶
- Frequency is in Hz. If frequency == 0, a tone being played is turned off. Duration is in seconds. If duration == 0, play indefinitely. 
 - 
tone¶
- Return (frequency, duration), or None if no value available 
 
-