Code Monkey home page Code Monkey logo

uble's Introduction

uble

Lightweight Bluetooth Low Energy driver written in pure python for micropython.

WARNING: this project is in beta stage and is subject to changes of the code-base, including project-wide name changes and API changes.

Features

  • Parsing and Building of HCI packets
  • Allows PyBoard to control BLE chips using HCI packets

Usage

  • Parsing of HCI packets:

      MicroPython v1.8.7-79-g221f88d-dirty on 2017-01-26; PYBv1.1 with STM32F405RG
      Type "help()" for more information.
      >>> from bluetooth_low_energy.protocols.hci import (cmd, uart)
      >>> buf = b'\x01\x03\x0c\x00'
      >>> hci_uart = uart.HCI_UART.from_buffer(buf)
      >>> print(hci_uart)
      <HCI_UART pkt_type=COMMAND(0x01) data=030c00>
      >>> hci_cmd = cmd.HCI_COMMAND.from_buffer(hci_uart.data)
      >>> print(hci_cmd)
      <HCI_COMMAND opcode=0x0c03 ogf=HOST_CTL(0x03) ocf=RESET(0x03) request_data= response_data=>
      >>> hci_cmd.to_buffer()
      b'\x03\x0c\x00'        
      >>>
    
  • Building of HCI Packets:

      MicroPython v1.8.7-79-g221f88d-dirty on 2017-01-26; PYBv1.1 with STM32F405RG
      Type "help()" for more information.
      >>> from bluetooth_low_energy.protocols.hci import cmd
      >>> hci_cmd = cmd.HCI_COMMAND(ogf=cmd.OGF_LE_CTL, ocf=cmd.OCF_LE_RAND)
      >>> print(hci_cmd)
      <HCI_COMMAND opcode=0x2018 ogf=LE_CTL(0x08) ocf=LE_RAND(0x18) request_data= response_data=>
      >>> hci_cmd.to_buffer()
      b'\x18 \x00'
      >>>
    
  • Control BLE chips see 'examples'

Software

Currently implemented full HCI commands from STSW-BLUENRG-DK 2.0.2

User manual BlueNRG-MS Bluetooth® LE stack application command interface

Programming manual BlueNRG, BlueNRG-MS stacks programming guidelines

Hardware

Currently supported module STMicroelectronics SPBTLE-RF

Availabe breakout board:

MicroPython_SPBTLERF_Breakout_v01_mod_TOP MicroPython_SPBTLERF_Breakout_v01_mod_BOTTOM Order from OSH Park

Fritzing for breakout: MicroPython_SPBTLERF_Breakout_v01_mod.fzz

Gerber for breakout: MicroPython_SPBTLERF_Breakout_v01_mod.zip

If have interest into preassembled breakout board contact me at [email protected]

External dependencies

Only for examples: 'logging' already available into folder 'micropython-lib' of this repository

Install 'bluetooth_low_energy' into the pyboard

To enable the functionality you need to freeze the package 'bluetooth_low_energy', to do this, copy the package 'bluetooth_low_energy' into 'micropython-lib'.

Navigate to the folder containing the repository micropython:

    $ cd stmhal
    $ make FROZEN_MPY_DIR="~/uble/micropython-lib"

Examples

    basic: print BlueNRG FW versions
    bluest_protocol: implements the BlueST protocol usable for test with 'ST BlueMS' app
    sensor_demo: usable for test with 'BlueNRG' app
    firmware_update: update SPBTLE-RF firmware (see README)

uble's People

Contributors

dmazzella avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.