Skip to content

Commit cf2d150

Browse files
committed
Philosophy change: remove most classes and use bleio instead.
1 parent fa7b8bc commit cf2d150

File tree

6 files changed

+11
-364
lines changed

6 files changed

+11
-364
lines changed

adafruit_ble/__init__.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,6 @@
3131
Implementation Notes
3232
--------------------
3333
34-
The Python classes here wrap rather than subclass the native `bleio` classes, due to limitations of
35-
native subclassing in the current MicroPython language core.
36-
3734
**Hardware:**
3835
3936
inline format: "* `Adafruit Feather nRF52840 Express <https://www.adafruit.com/product/4062>`_"

adafruit_ble/characteristic.py

Lines changed: 0 additions & 110 deletions
This file was deleted.

adafruit_ble/peripheral_server.py

Lines changed: 0 additions & 76 deletions
This file was deleted.

adafruit_ble/service.py

Lines changed: 0 additions & 63 deletions
This file was deleted.

adafruit_ble/uart.py

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,25 @@
2020
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
2121
# THE SOFTWARE.
2222
"""
23-
`adafruit_ble.uuid`
23+
`adafruit_ble.uart`
2424
====================================================
2525
2626
UART-style communication.
2727
2828
* Author(s): Dan Halbert for Adafruit Industries
2929
3030
"""
31+
from bleio import UUID, Characteristic, Service, Peripheral, CharacteristicBuffer
3132

32-
import bleio
33-
34-
from .uuid import UUID
35-
from .characteristic import Characteristic
36-
from .service import Service
37-
from .peripheral_server import PeripheralServer
3833

3934
class UARTService:
40-
"""Provide UART-like functionality via the Nordic NUS service."""
35+
"""Provide UART-like functionality via the Nordic NUS service.
36+
37+
Example::
38+
39+
from adafruit_ble.uart import UARTService()
40+
uart = UARTService() # Starts advertising immediately.
41+
"""
4142

4243
NUS_SERVICE_UUID = UUID("6E400001-B5A3-F393-E0A9-E50E24DCCA9E")
4344
NUS_RX_CHAR_UUID = UUID("6E400002-B5A3-F393-E0A9-E50E24DCCA9E")
@@ -51,8 +52,8 @@ def __init__(self):
5152

5253
nus_uart_service = Service(self.NUS_SERVICE_UUID, (self._nus_tx_char, self._nus_rx_char))
5354

54-
self._periph = PeripheralServer((nus_uart_service,))
55-
self._rx_buffer = bleio.CharacteristicBuffer(self._nus_rx_char.bleio_characteristic, 64)
55+
self._periph = Peripheral((nus_uart_service,))
56+
self._rx_buffer = CharacteristicBuffer(self._nus_rx_char, 64)
5657

5758
self._periph.start_advertising()
5859

0 commit comments

Comments
 (0)