Commit Graph

704 Commits

Author SHA1 Message Date
Glenn Ruben Bakke 5f645b6c8e nrf5/modules/ubluepy: Adding compile guard for UBLUEPY_CENTRAL around the char_read() call to ble_drv_attr_c_read(). 2017-04-02 00:31:28 +02:00
Glenn Ruben Bakke 84e5b828ea nrf5/bluetooth: Moving central code inside central bluetooth stack defines to make peripheral only code compile again. 2017-04-02 00:30:16 +02:00
Glenn Ruben Bakke 460f6dee50 nrf5/examples: Updating ubluepy scan example to use constant value from ubluepy instead of hardcoded value. 2017-04-01 22:50:37 +02:00
Glenn Ruben Bakke 9568e07159 nrf5/examples: Adding example on how to use the ubluepy Scanner object in order to scan for a device name and find the address of the device. This can subsequently be used to perform a Central role connect() using the Peripheral object. 2017-04-01 22:45:11 +02:00
Glenn Ruben Bakke 33b1028b50 nrf5/modules/ubluepy: Turn all attributes (addr, addr_type and rssi) to method calls instead of using common .attr callback. Adding getScanData implementation, which parses the advertisment data and returns a list of tuples containing (ad_type, desc, value). Description is generated by peeking into the ad_types local dicts map table, and do a reverse lookup on the value to find the QSTR. 2017-04-01 22:43:54 +02:00
Glenn Ruben Bakke bb196a2b09 nrf5/modules/ubluepy: Adding ad_types constants in new object. Linking in ad_types object into the ubluepy.constants local dict. 2017-04-01 22:37:39 +02:00
Glenn Ruben Bakke 0887b95bb9 nrf5/modules/ubluepy: Expose ubluepy constant objects as externs in modubluepy.h to be able to get access to the local dict tables in order to do a reverse lookup on value to resolve QSTR from external modules in c. 2017-04-01 22:34:51 +02:00
Glenn Ruben Bakke 706bc97c92 nrf5/modules/ubluepy: Upon advertisment event, also store the advertisment data. 2017-04-01 22:32:55 +02:00
Glenn Ruben Bakke 276073b494 nrf5/modules/ubluepy: Adding callback function to handle read response if gatt client has issued a read request. Also adding method for returning the uuid instance from the object. 2017-04-01 16:39:51 +02:00
Glenn Ruben Bakke 5a7ab4686c nrf5/modules/ubluepy: Adding value data member to the characteristic object. This can hold the value data when gatt client perform a read and value has to be transferred between interrupt and main thread. 2017-04-01 16:36:15 +02:00
Glenn Ruben Bakke c88358d84b nrf5/bluetooth: Updating bluetooth driver to support GATT client read of a characteristic value. Data passed to caller in interrupt context, and copy has to be performed. The function call is itself blocking. 2017-04-01 16:34:26 +02:00
Glenn Ruben Bakke bb7130a813 nrf5/modules/ubluepy: Adding uuid() function to service object to return UUID instance of the service. 2017-03-31 21:52:59 +02:00
Glenn Ruben Bakke f9a351d527 nrf5/modules/ubluepy: Adding binVal() function to the ubluepy UUID object. For now returning the uint16_t value of the UUID as a small integer. 2017-03-31 21:51:57 +02:00
Glenn Ruben Bakke 7c6f041b8c nrf5/modules/ubluepy: Adding dummy function call to ble_drv_attr_c_read. 2017-03-30 23:44:00 +02:00
Glenn Ruben Bakke d24809a2aa nrf5/bluetooth: Adding new api for reading attribute as gatt client. Renaming old ble_drv_attr_read function to ble_drv_attr_s_read to indicate the server role. 2017-03-30 23:43:44 +02:00
Glenn Ruben Bakke 93b76a66d3 nrf5/bluetooth: Adding event handling cases for gatt client read, write and hvx events. 2017-03-30 23:18:49 +02:00
Glenn Ruben Bakke ebb7925a16 nrf5/modules/ubluepy: Tab-fix 2017-03-30 22:53:25 +02:00
Glenn Ruben Bakke bd2981681f nrf5/modules/ubluepy: Updating peripheral object to handle characteristic discovery (central mode). 2017-03-30 22:47:14 +02:00
Glenn Ruben Bakke 31a71517ab nrf5/modules/ubluepy: Adding start and end handle to service object. 2017-03-30 22:42:08 +02:00
Glenn Ruben Bakke 2200c4c084 nrf5/bluetooth: Adding support for central characteristic service discovery. Updating primary service discovery to block until all services has been created in the peripheral object before returning from the bluetooth driver. This pattern is also applied to the characteristic discovery. 2017-03-30 22:41:19 +02:00
Glenn Ruben Bakke 75148ee6ca nrf5/modules/ubluepy: Updating ubluepy peripheral object to new bluetooth driver API. Starting to populate service objects and uuid objects. Also adding the service to the peripheral object throught the regular static function for adding services. Handle value for the primary service is assuming that it is the first element in the handle range; start_handle reported by the service discovery. 2017-03-29 23:37:32 +02:00
Glenn Ruben Bakke 5b778790ae nrf5/bluetooth: Updating bluetooth driver to do service discovery, doing callbacks to ubluepy upon each individual primary service discovered. Using intermediate structure defined by the driver, to abstract bluetooth stack specific data in ubluepy. 2017-03-29 23:34:33 +02:00
Glenn Ruben Bakke a139d5e8f7 nrf5/modules/ubluepy: Adding some work in progress on service discovery. 2017-03-28 23:40:28 +02:00
Glenn Ruben Bakke 8966c68b92 nrf5/bluetooth: Adding implementation to the discover service function. Adding handler for gatt client primary service discovery response events, and passing this to the ubluepy upon reception. 2017-03-28 23:37:19 +02:00
Glenn Ruben Bakke 61b825d75e nrf5/bluetooth: Adding function parameters and return type to service and characteristic discovery template functions. 2017-03-28 21:20:20 +02:00
Glenn Ruben Bakke 06af64a78a nrf5/bluetooth: Adding template functions for service discovery in bluetooth driver. 2017-03-26 22:59:30 +02:00
Glenn Ruben Bakke 0914b34193 nrf5/bluetooth: Adding function to register gattc event handler (central). 2017-03-26 22:57:07 +02:00
Glenn Ruben Bakke 025f07dbab nrf5/bluetooth: Adding intermediate gattc callback function type in bluetooth driver. 2017-03-26 22:51:10 +02:00
Glenn Ruben Bakke 49cce723a9 nrf5/bluetooth: Turning off debug logging in bluetooth driver, which does not work well with bluetooth REPL mode. 2017-03-26 21:06:17 +02:00
Glenn Ruben Bakke 2f2e67e9bd nrf5/bluetooth: Fixing some smaller tab errors in the bluetooth driver. 2017-03-26 21:05:06 +02:00
Glenn Ruben Bakke cd2149a47f nrf5/bluetooth: Updating bluetooth le driver to handle GAP conn param update request. Also updating minor syntax in previous switch case. 2017-03-26 21:02:25 +02:00
Glenn Ruben Bakke fb983c7692 nrf5/boards: Inrease heap size in the nrf52832 w/s132 bluetooth stack linker script. 2017-03-26 20:46:23 +02:00
Glenn Ruben Bakke c230bc021a nrf5/modules/ubluepy: Update connect method to parse dev_addr parameter and pass it to the bluetooth driver, going through a allocated heap buffer. Adding call to the bluetooth driver to issue a connect. Hardcoding address type for now. 2017-03-26 20:45:21 +02:00
Glenn Ruben Bakke bcf4631e0a nrf5/bluetooth: Updating connect function in the bluetooth driver to do a successful connect to a peripheral device. 2017-03-26 20:43:43 +02:00
Glenn Ruben Bakke 4d147beedb nrf5/modules/ubluepy: Adding template function for central connect() in peripheral object. 2017-03-25 17:51:52 +01:00
Glenn Ruben Bakke 098e64b122 nrf5/modules/ubluepy: Adding locals dict to Scan Entry introducing function to retreive Scan Data. Not working as expected together with .attr. It looks like locals dict functions are treated to be attributes and cannot be resolved. 2017-03-25 17:39:44 +01:00
Glenn Ruben Bakke f38b0ba037 nrf5/bluetooth: Adding function for connecting to a device (in central role). Not yet tested. 2017-03-23 21:03:40 +01:00
Glenn Ruben Bakke 8a884de7b9 nrf5/modules/ubluepy: Return BLE peer address as string instead of bytearray. Updated struct in modubluepy.h to use a mp_obj_t to hold a string instead of a fixed 6-byte array. Stripped down ScanEntry print out to only contain class name, peer address available through addr attribute. 2017-03-22 23:18:41 +01:00
Glenn Ruben Bakke 327754a953 nrf5/bluetooth: capture address type in addition to advertisment type in bluetooth advertisment reports. 2017-03-16 22:46:26 +01:00
Glenn Ruben Bakke 3468972299 nrf5/modules/ubluepy: Correcting rssi member in scan_entry object to be int instead of uint. 2017-03-14 23:18:51 +01:00
Glenn Ruben Bakke 442e46f4be nrf5/modules/ubluepy: Adding attribute to ScanEntry object for getting address (returning bytearray), type (returning int) and rssi (returning int). 2017-03-14 23:14:55 +01:00
Glenn Ruben Bakke 609a174f8d nrf5/modules/ubluepy: Copy address type and rssi to the ScanEntry object upon reception of an advertisment report callback. 2017-03-14 23:13:13 +01:00
Glenn Ruben Bakke cbfba08ae7 nrf5/bluetooth: Adding address type to bluetooth stack driver advertisment structure, and fill the member when advertisment report is received. 2017-03-14 23:12:24 +01:00
Glenn Ruben Bakke 445b45ee13 nrf5/modules/ubluepy: Swapping address bytes when copying bluetooth address over to ScanEntry object during advertisment scan report event. 2017-03-14 22:14:05 +01:00
Glenn Ruben Bakke 08883c619a nrf5/modules/ubluepy: Extending print of ScanEntry object to also include the bluetooth le address. 2017-03-14 22:12:33 +01:00
Glenn Ruben Bakke a444390115 nrf5/modules/ubluepy: Create new adv report list for each individual scan. Create a new ScanEntry object instance on each advertisment event recieved and append this to the current adv_report list. 2017-03-14 21:28:42 +01:00
Glenn Ruben Bakke 9a20d9ca91 nrf5/modules/ubluepy: Adding print function to scan_entry object. 2017-03-14 21:27:29 +01:00
Glenn Ruben Bakke 4a97cfe3ea nrf5/modules/ubluepy: Populating ubluepy_scan_entry_obj_t with members that are interesting to keep for the ScanEntry object. 2017-03-14 08:20:28 +01:00
Glenn Ruben Bakke c066344a14 nrf5/bluetooth: Moving callback definitions to bluetooth driver header. Refactoring bluetooth driver, setting new names on callback functions and updating api to use new callback function name prefix. 2017-03-14 08:13:32 +01:00
Glenn Ruben Bakke e028eda0bc nrf5/modules/ubluepy: Extracting advertisment reports and adding some data to list before returning it in scan() method. 2017-03-14 08:05:54 +01:00
Glenn Ruben Bakke 9b0d893b4d nrf5/bluetooth: Adding handling of advertisment reports in bluetooth driver and issue callback to ubluepy. A bit ugly implmentation and has to be re-worked. 2017-03-14 08:04:24 +01:00
Glenn Ruben Bakke 6fc806b313 nrf5/bluetooth: adding adv report data structure to pass to ubluepy upon adv report event. Adding new api for setting callack where to handle advertisment events in ubluepy. 2017-03-14 07:59:29 +01:00
Glenn Ruben Bakke ada69c40c6 nrf5/modules/ubluepy: Adding adv_reports member to scanner object, to hold the result of scan. 2017-03-14 07:57:20 +01:00
Glenn Ruben Bakke 5fc6a9d9a2 nrf5/modules/machine: Cleaning up uart a bit more. Removing unused any() method, and aligning print and local dict names to use machine_uart prefix. 2017-03-13 17:56:39 +01:00
Glenn Ruben Bakke 51c739f64a nrf5/bluetooth: Turn off bluetooth printf logging. 2017-03-12 23:32:33 +01:00
Glenn Ruben Bakke c8127ef337 nrf5: Add back ublupy scanner and scan entry source files in Makefile. 2017-03-12 23:24:37 +01:00
Glenn Ruben Bakke 6ea3f3c69b nrf5/bluetooth: Enable implementation in scan start function in the bluetooth stack driver. 2017-03-12 23:23:37 +01:00
Glenn Ruben Bakke a01a3734f8 nrf5/boards: Adjust heap end after increased .data usage in nrf52832 s132 linker script. 2017-03-12 23:20:53 +01:00
Glenn Ruben Bakke 5580ac8200 nrf5/bluetooth: Adding more implementation in scan start function. However, commented out for time beeing, as there is some memory issues when activating central. 2017-03-12 22:46:40 +01:00
Glenn Ruben Bakke 9aa3df7955 nrf5: Removing ubluepy scanner and scan entry from Makefile source list until nrf52 central issues has been resolved. 2017-03-12 22:45:02 +01:00
Glenn Ruben Bakke caf242a5ae nrf5/bluetooth: Correcting indention. 2017-03-12 20:20:15 +01:00
Glenn Ruben Bakke 739bf3a740 nrf5/bluetooth: Adding some implementation to scan_start function. 2017-03-12 20:18:37 +01:00
Glenn Ruben Bakke 89095f861f nrf5/modules/ubluepy: Adding scan method to the Scanner object. Adding locals dict table. 2017-03-12 19:52:12 +01:00
Glenn Ruben Bakke 471d6a05da nrf5/bluetooth: Adding empty scan_start and scan_stop function to the bluetooth driver. 2017-03-12 19:50:38 +01:00
Glenn Ruben Bakke ee5ecac7cc nrf5/modules/ubluepy: Adding constructor function to scanner object. 2017-03-12 14:40:56 +01:00
Glenn Ruben Bakke 7ea966d844 nrf5/modules/ubluepy: Adding print function to Scanner object. 2017-03-12 14:28:11 +01:00
Glenn Ruben Bakke 851705fc3a nrf5/modules/ubluepy: Disable all functions central related functions in the Peripheral object for now, even if MICROPY_PY_UBLUEPY_CENTRAL is enabled. 2017-03-12 14:27:09 +01:00
Glenn Ruben Bakke 242b40e917 nrf5/modules/ubluepy: Activate Scanner and ScanEntry objects if MICROPY_PY_UBLUPY_CENTRAL is set. 2017-03-12 14:25:49 +01:00
Glenn Ruben Bakke 90e88b2c43 nrf5/bluetooth: Adding new configuration flag for s132 bluetooth stack, to enable/disable ubluepy central. Disabled by default. 2017-03-12 14:24:12 +01:00
Glenn Ruben Bakke 2f9fda1367 nrf5: Adding ubluepy_scanner.c and ubluepy_scan_entry.c to Makefile source list. 2017-03-12 14:21:27 +01:00
Glenn Ruben Bakke 11c40892ac nrf5/modules/ubluepy: Adding template object typedefs for scanner and scan entry, and extern definition for scanner and scan_entry object type in modubluepy.h 2017-03-12 14:20:41 +01:00
Glenn Ruben Bakke 91652882a9 nrf5/modules/ubluepy: Adding templates for central role Scanner and ScanEntry objects. 2017-03-12 12:34:11 +01:00
Glenn Ruben Bakke 1aecf560da nrf5/uart: Moving UART from pyb to machine module. 2017-03-10 22:48:43 +01:00
Glenn Ruben Bakke 611b829138 nrf5/uart: Refactoring UART module and HAL driver
Facilitating for adding second HW uart. Moving pyb_uart into
machine_uart. Adding return error codes from hal_uart functions,
if the hardware detects an error.
2017-03-10 22:21:19 +01:00
Glenn Ruben Bakke f8d1ea80ae nrf5/modules: Updating uart object to allow baudrate configuration. 2017-03-07 23:18:03 +01:00
Glenn Ruben Bakke 99f5ecdfad nrf5/bluetooth: Moving bluetooth_conf.h to port root folder to make it more exposed. 2017-03-07 23:15:59 +01:00
Glenn Ruben Bakke 3b2ca64738 nrf5/boards: Remove define of machine PWM module configuration in nrf51 targets, as the device does not have a HW PWM peripheral. 2017-03-07 18:05:38 +01:00
Glenn Ruben Bakke 5f9b070f6d nrf5: Disable machine PWM module by default if board does not define it. 2017-03-07 18:04:54 +01:00
Glenn Ruben Bakke 9689aae45b nrf5/boards: Disable all display modules in pca10028 board config. 2017-03-07 18:01:13 +01:00
Glenn Ruben Bakke 9d2a2d227c nrf5: Updated after merge with master. Updating nlr_jump_fail to call __fatal_error in order to provide a non-returning function call. 2017-03-07 17:53:10 +01:00
Glenn Ruben Bakke 5f705adae0 nrf5/boards: Adding more heap memory to the nrf51 256k/32k s110 linker script. Leaving 2k for stack. 2017-03-07 17:41:46 +01:00
Glenn Ruben Bakke 2e1335b051 nrf5/modules/machine: Adding __WFI() on machine.deepsleep() 2017-03-06 23:36:36 +01:00
Glenn Ruben Bakke 4e1b9aca79 nrf5/modules/machine: Adding __WFE() on machine.sleep() 2017-03-06 23:35:32 +01:00
Glenn Ruben Bakke 4afa41ac36 nrf5/modules/machine: Adding enable_irq() and disable_irq() method to the machine module. No implementation yet for the case where bluetooth stack is used. 2017-03-06 23:30:56 +01:00
Glenn Ruben Bakke 5acba015ef nrf5/modules/rtc: Adding support for stopping and restarting rtc (if periodic) for all the instances of RTC. 2017-03-06 23:05:03 +01:00
Glenn Ruben Bakke 7c50cd26a2 nrf5/modules: Updating RTC kwarg from type to mode to set ONESHOT or PERIODIC mode. 2017-03-06 22:59:43 +01:00
Glenn Ruben Bakke 3debb43e83 nrf5/modules: Adding support for periodic RTC callback. 2017-03-06 21:33:29 +01:00
Glenn Ruben Bakke c301cca2a4 nrf5/hal: hal_rtc update. Adding current counter value to period value before setting it in the compare register. 2017-03-06 20:52:09 +01:00
Glenn Ruben Bakke f50a56dbb5 nrf5/modules: Updating rtc module with non-const machine object list in order to allow setting callback function in constructor. 2017-03-06 20:09:04 +01:00
Glenn Ruben Bakke 87e1616488 nrf5/hal: Adding initialization of LFCLK if not already enabled in hal_rtc. 2017-03-06 20:06:47 +01:00
Glenn Ruben Bakke 7000e0a2a0 nrf5/modules: Moving irq priority settings in RTC object to rtc_init0 when initializing the hardware instances. Also modifying comments a bit. Adding simple example in comment above make_new function on how the object is intended to work. 2017-03-06 01:13:19 +01:00
Glenn Ruben Bakke 49b1607bed nrf5: Updating main.c to initialize the rtc module if enabled. 2017-03-06 00:57:33 +01:00
Glenn Ruben Bakke 1ef7c732e8 nrf5/modules: Added RTC into the machine module globals dict. 2017-03-06 00:56:58 +01:00
Glenn Ruben Bakke 7144696e17 nrf5/modules: Updating rtc module. Not working yet. Updated to align with new hal_rtc interface. Added start and stop methods. Allowing callback function set from init. This should be moved to start function, not set in main. 2017-03-06 00:56:18 +01:00
Glenn Ruben Bakke ff7541599a nrf5/hal: Updating hal RTC implementation. 2017-03-06 00:53:21 +01:00
Glenn Ruben Bakke 852aaba58b nrf5/hal: Adding hal_irq.h which defines a set of static inline functions to do nvic irq operations. 2017-03-06 00:50:00 +01:00
Glenn Ruben Bakke 9ddd62e73e nrf5/modules: Updating machine uart module to use new hal uart interface name. 2017-03-05 22:37:52 +01:00
Glenn Ruben Bakke 0489153094 nrf5/hal: Renaming uart hal function to use hal_uart prefix. 2017-03-05 22:37:07 +01:00
Glenn Ruben Bakke ee5884bfe9 nrf5/modules: Updating readfrom function in machine i2c module to use the new hal function which has been implemented. 2017-03-04 21:44:23 +01:00
Glenn Ruben Bakke 2c61b7f596 nrf5/hal: Adding untested implementation of twi read. Lacking sensors to test with :) 2017-03-04 21:42:36 +01:00
Glenn Ruben Bakke 4a631a0d47 nrf5/boards: Renaming linker script for all nrf51 and nrf52 into more logical names. Updating all boards with new names. 2017-03-04 19:13:59 +01:00
Glenn Ruben Bakke ab0d9756f1 nrf5/bluetooth: Updating header guard in bluetooth_conf.h to reflect new filename. 2017-03-04 18:05:51 +01:00
Glenn Ruben Bakke 56d106507a nrf5/bluetooth: Updating old references to 'sdk' to use the new folder name 'bluetooth' in makefiles. 2017-03-04 17:58:31 +01:00
Glenn Ruben Bakke 9e36242259 nrf5: Renaming sdk folder to bluetooth. 2017-03-04 17:54:15 +01:00
Glenn Ruben Bakke 5e89a27ba1 nrf5: Merging sdk makefiles into bluetooth_common.mk. s1xx_iot is still left out of this refactoring. 2017-03-04 17:52:20 +01:00
Glenn Ruben Bakke ec35861938 nrf5: Renaming nrf5_sdk_conf.h to bluetooth_conf.h 2017-03-04 17:19:29 +01:00
Glenn Ruben Bakke 309ae12346 nrf5: Starting process of renaming files in sdk folder to facilitate renaming of the folder and make it more logical. Transition will be from sdk to bluetooth. 2017-03-04 15:06:08 +01:00
Glenn Ruben Bakke 80c9c2e3c0 nrf5/boards: Adding support for SPI, I2C, ADC, and Temp in machine modules in micro:bit target. Also activating hal drivers for the peripherals. 2017-03-04 02:14:50 +01:00
Glenn Ruben Bakke f2a7e198d2 nrf5/sdk: Updating low frequency clock calibration from 4 seconds to 250 ms for stack enable when BLUETOOTH_LFCLK_RC is enabled. 2017-03-04 01:36:06 +01:00
Glenn Ruben Bakke ef6d583ec3 nrf5/boards: Updating nrf51822_aa_s110.ld to be more generic, leaving all RAM not used for stack, .bss and .data to the heap. 2017-03-04 01:29:05 +01:00
Glenn Ruben Bakke 1aeb74a426 nrf51: Removing stack section from startup file as it got added to the final hex file. Thanks dhylands for helping out. 2017-03-04 01:24:10 +01:00
Glenn Ruben Bakke 2af06bd3fa nrf5/boards: Adding BLUETOOTH_LFCLK_RC to CFLAGS in microbit s110 makefile. 2017-03-03 23:21:47 +01:00
Glenn Ruben Bakke e95ec1a285 nrf5/sdk: Adding support for initializing the bluetooth stack using RC oscillator instead of crystal. If BLUETOOTH_LFCLK_RC is set in CFLAGS, this variant of softdevice enable will be activated. 2017-03-03 23:20:38 +01:00
Glenn Ruben Bakke c300e3f196 nrf5: Initialize repl_display_debugging_info in pyexec.c for cortex-m0 targets. 2017-03-03 00:40:44 +01:00
Glenn Ruben Bakke 235c0edacb nrf5/sdk: Updating ringbuffer.h to use volatile variables for start and end. 2017-03-03 00:11:42 +01:00
Glenn Ruben Bakke d057a93675 nrf5/sdk: Rename cccd_enable variable to m_cccd_enable in bluetooth le UART driver. Also made the variable volatile. 2017-03-03 00:06:51 +01:00
Glenn Ruben Bakke df31508d6f nrf5/modules: Updating example in ubluepy header to use handle instead of data length upon reception of an event. 2017-03-03 00:05:09 +01:00
Glenn Ruben Bakke db3dd8bc8b nrf5/modules: Updating ubluepy peripheral to pass handle value to python event handler instead of data length. Data length can be derived from the bytearray structure. 2017-03-03 00:04:13 +01:00
Glenn Ruben Bakke 22f66e274d nrf5/sdk: Updating bluetooth le driver to handle SEC PARAM REQUEST by replying that pairing is not supported. Moving initialization of adv and tx in progress state variables to stack enable function. 2017-03-02 22:48:04 +01:00
Glenn Ruben Bakke 4efedb67b6 nrf5/modules: Enable ubluepy constants for CONNECT and DISCONNECT for other bluetooth stacks than s132. 2017-03-02 22:43:06 +01:00
Glenn Ruben Bakke e60fa9b3e1 nrf5/sdk: Fixing unaligned access issues for nrf51 (cortex-m0) in bluetooth le driver 2017-03-02 21:25:51 +01:00
Glenn Ruben Bakke 44c9888511 nrf5/sdk: Removing SDK dependant BLE UART Service implementation
The sdk_12.1.0 nrf52_ble.c implementation was dependent on SDK components.
This has been replaced with the ble_uart.c implementation using a standalone
bluetooth driver implementation without need of SDK components.

Also, sdk.mk has been updated to not use a special linker script.
2017-03-01 00:05:04 +01:00
Glenn Ruben Bakke 58cc59cfbe nrf5/sdk: Removing ble_repl_linux.py
Script does not really work very well with blocking char read and
async ble notifications printing data when terminal stdout is blocked
by readchar. Bluetooth UART profile implemented in ble_uart.c is
now working with tralamazza's nus_console nodejs script.

Ref: https://github.com/tralamazza/nus_console
2017-02-28 23:40:46 +01:00
Glenn Ruben Bakke ac677efb8b nrf5: Add default config for MICROPY_PY_BLE_NUS (0)
Disable Bluetooth UART to be used for REPL by default. Can be overridden
in nrf5_sdk_conf.h. It is defined in  mpconfigport.h as it is connected to
mphalport.c, where the config is used to determine whether default print
functions should be using HW UART or Bluetooth UART.
2017-02-28 23:33:54 +01:00
Glenn Ruben Bakke e8761682b7 nrf5/sdk: Add ble_uart.c to source list
ble_uart.c implements UART Bluetooth service on top of the
bluetooth stack driver api calls. Can be enabled to be compiled
in by defining MICROPY_PY_BLE_NUS = 1 in nrf5_sdk_conf.h.
2017-02-28 23:30:36 +01:00
Glenn Ruben Bakke 84313b0261 nrf5/sdk: Removing include of sdk_12.1.0's build.mk
As no sources are needed from the SDK this build makefile
can be deleted.
2017-02-28 23:28:09 +01:00
Glenn Ruben Bakke 9472196ee7 nrf5: Force implementation of tx_str_cooked function if BLE NUS enabled.
If BLE UART service has been enabled, the mp_hal_stdout_tx_strn_cooked
is not defined by default anymore, and has to be implemented by the
UART driver (in this case BLE).
2017-02-28 23:18:31 +01:00
Glenn Ruben Bakke 216c97ff9a nrf5/sdk: Adding compiler guard around exchange MTU request event.
As s110 is not having this event or function call to answer on a MTU
exchange request, this is excluded for all other version than s132
for now.
2017-02-28 23:13:02 +01:00
glennrub c1ffac9998 Merge pull request #1 from ajbaabf/nrf5_no_sdk
added support for hardware temperature sensor
2017-02-28 08:33:11 +01:00
Bander Ajba 0e723091f9 minor documentation and extra tabs removal fixes 2017-02-28 09:34:13 +03:00
Glenn Ruben Bakke 382f718cfc nrf5/sdk: Updating BLE UART implementation by swapping TX and RX uuid and characterisitic handling. Removed dummy write delay of 10 ms. 2017-02-27 23:47:47 +01:00
Glenn Ruben Bakke b032d765ff nrf5/sdk: Backing up progress in bluetooth le driver. Adding new gap and gatts handlers. Added handling of tx complete events when using notification, responding to MTU request, and setting of default connection parameters. 2017-02-27 23:40:39 +01:00
Bander Ajba 12a6cb0fbf fixed temp module to allow for instance support 2017-02-27 21:46:53 +03:00
Bander Ajba e52ebb095c fixed temp module to allow for instance support 2017-02-27 21:37:32 +03:00
glennrub 56cf514627 Merge pull request #2 from dhylands/fix-makefile
Fix up Makefile dependencies
2017-02-26 17:39:09 +01:00
Bander Ajba 66542c34b9 did required modification to merge the temperature sensore module 2017-02-26 11:17:07 +03:00
Bander Ajba 378c40b4da did required modification to merge the temperature sensore module 2017-02-26 11:14:17 +03:00
Dave Hylands d3c3fa4a74 Fix up Makefile dependencies
I also didn't see any real reason for mkrules.mk to exist,
so I merged the contents into Makefile.

Now you can do:
```
make BOARD=pca10028 clean
make BOARD=pca10028 flash
```
and it will work properly.
2017-02-25 16:52:46 -08:00
Glenn Ruben Bakke dcd980381d nrf5: Updating Makefile to use correct variable for setting directory of file to freeze as mpy. 2017-02-26 01:30:33 +01:00
Glenn Ruben Bakke 65f3e16775 nrf5: Setting stack top in main.c. Thanks dhylands for pointing this out. 2017-02-26 01:29:13 +01:00
Glenn Ruben Bakke 64b23e1127 nrf5/sdk: Backing up progress in BLE UART driver. Adding ringbuffer in order to poll bytes from recieved data in REPL main loop. 2017-02-24 15:14:12 +01:00
Glenn Ruben Bakke bfda169dfe nrf5/modules: Updating ubluepy example to print out gatts write events with data. 2017-02-24 15:08:32 +01:00
Glenn Ruben Bakke e60a06563e nrf5/boards: Updating pca10028 bluetooth stack targets to have a MCU_SUB_VARIANT. 2017-02-24 15:03:53 +01:00
Bander Ajba 3882b0e2ff added support for hardware temperature sensor 2017-02-24 00:38:08 +03:00
Glenn Ruben Bakke 6b898d1d67 nrf5/sdk: Adding macro based ringbuffer written by Philip Thrasher. source: https://github.com/pthrasher/c-generic-ring-buffer/blob/master/ringbuffer.h. Copyright noticed copied into the file, and file reviewed by Philip. 2017-02-23 21:52:23 +01:00
Glenn Ruben Bakke f10abda60a nrf5/sdk: Updating bluetooth le driver to extract data length and pointer from the event structure upon gatts write operation. 2017-02-22 19:54:02 +01:00
Glenn Ruben Bakke 7fee0cdde1 nrf5/modules: Expose ubluepy characteristic and peripheral types as external declaration in ublupy header. 2017-02-22 19:10:18 +01:00
Glenn Ruben Bakke 09fd2b86d1 nrf5: Updating main to initialize bluetooth le uart module right before bluetooth REPL is started. 2017-02-21 23:38:35 +01:00
Glenn Ruben Bakke 3e66898c37 nrf5/sdk: Updating bluetooth le uart implemenatation to block until cccd is written. 2017-02-21 23:37:52 +01:00
Glenn Ruben Bakke 80b2d7e4ad nrf5/sdk: Backing up ubluepy version of ble uart service for Bluetooth LE REPL. 2017-02-21 00:15:51 +01:00
Glenn Ruben Bakke acb5c7b4ee nrf5/modules: Updating ubluepy example in header to align with bluetooth uart service characteristic's. 2017-02-20 21:28:07 +01:00
Glenn Ruben Bakke c9bfcb5bc5 nrf5/modules: Implementing characteristic write method. Possible to use write for both write and notifications. 2017-02-20 21:27:21 +01:00
Glenn Ruben Bakke 7223950864 nrf5/sdk: Remaning bluetooth driver function ble_drv_attr_notif to *_notify. 2017-02-20 21:26:19 +01:00
Glenn Ruben Bakke 601f07cbf2 nrf5/modules: Adding props and attrs parameter to ubluepy characteristic constructor to override default values. Adding method for reading characteristic properties. Adding values to the local dict table that gives possibility to OR together a configuration of properties and attributes in the keyword argument during construction. 2017-02-20 20:28:19 +01:00
Glenn Ruben Bakke a973dde603 nrf5/sdk: Adding parsing of characteristic properties and attributes (extra descriptions for the characteristic, for now cccd). 2017-02-20 20:24:27 +01:00
Glenn Ruben Bakke 89fc67a9f8 nrf5/modules: Adding new members to ubluepy characteristic object, props and attrs. Adding enum typedefs for various properties and attributes. 2017-02-20 20:22:23 +01:00
Glenn Ruben Bakke 7c0195da6c nrf5/modules: Syncing uart module code after upmerge with upstream master. 2017-02-19 19:06:12 +01:00
Glenn Ruben Bakke 486d05ff17 nrf5/boards: Releasing more RAM for heap use in the nrf51 s110 linker script. 2017-02-19 19:00:31 +01:00
Glenn Ruben Bakke 10e7c16351 nrf5/modules: Adding new gatts handler and registration of it during creation of a peripheral object. Also, added forwarding to python callback function (for now the same as for GAP). 2017-02-19 00:10:27 +01:00
Glenn Ruben Bakke ac14bb4736 nrf5/modules: Adding new callback type in modubluepy for gatts events. 2017-02-19 00:09:11 +01:00
Glenn Ruben Bakke 29b283f697 nrf5/sdk: Adding support for setting gatts handler in the bluetooth le driver. 2017-02-19 00:08:05 +01:00
Glenn Ruben Bakke 45144ee8a8 nrf5/modules: Adding constant for CCCD uuid in ubluepy constants dict. 2017-02-18 23:11:12 +01:00
Glenn Ruben Bakke 4fe4c2967f nrf5: Adding ubluepy_descriptor.c into source list to compile. 2017-02-18 22:49:50 +01:00
Glenn Ruben Bakke 842b83cbd8 nrf5/modules: Adding template for ubluepy descriptor class implementation. 2017-02-18 22:49:18 +01:00
Glenn Ruben Bakke 6a374dc5a2 nrf5/modules: Adding object structure for ubluepy descriptor. 2017-02-18 22:48:48 +01:00
Glenn Ruben Bakke 98358e4400 nrf5/sdk: Adding template functions for attribute read/write/notify in bluetooth le driver. 2017-02-18 21:11:39 +01:00
Glenn Ruben Bakke 9a08ed1a08 nrf5/modules: Adding getCharacteristic method in ublupy service class. This function returns the characteristic with the given UUID if found, else None. The UUID parameter has to be of UUID class type, any other value, like strings will throw an exception. 2017-02-18 18:38:31 +01:00
Glenn Ruben Bakke 71475bb028 nrf5/modules: Updating method documentation in ubluepy peripheral and service. 2017-02-18 18:16:07 +01:00
Glenn Ruben Bakke 655d6c9bcd nrf5/modules: Adding new method, getCharacteristics(), in the ubluepy service class. The method returns the list of characteristics which has been added to the service instance. 2017-02-18 18:14:27 +01:00
Glenn Ruben Bakke 307c2d6aed nrf5/modules: Updating method documentation in ubluepy peripheral class. 2017-02-18 18:12:37 +01:00
Glenn Ruben Bakke 1da82b2aeb nrf5/modules: Updating ubluepy service. Creating empty characteristic list in constructor. Appending characteristic to the list when added. 2017-02-18 18:06:58 +01:00
Glenn Ruben Bakke 15d7353cb3 nrf5/modules: Changed return in ubluepy addService() function to return mp_const_none instead of boolean. 2017-02-18 17:59:10 +01:00
Glenn Ruben Bakke 63ed32ecaa nrf5/modules: Correcting tabbing in ubluepy periheral impl. 2017-02-18 17:57:59 +01:00
Glenn Ruben Bakke 577bf0724a nrf5/modules: Updating ubluepy peripheral. Creating empty service list in constructor. Appending services to the list when added. Added new function for retreiving the service list; getServices(). 2017-02-18 17:57:10 +01:00
Glenn Ruben Bakke 8ffd167d4b nrf5/modules: Adding new members in ubluepy peripheral and service object to keep track of child elements. Peripheral will have a list of services, and service will have a list of charactaristics. 2017-02-18 17:54:47 +01:00
Glenn Ruben Bakke 852dde6747 nrf5/modules: Removing connection handle from python gap event handler callback function. 2017-02-18 14:41:46 +01:00
Glenn Ruben Bakke f800f22a79 nrf5/modules: Updating ubluepy example in the header file with new function call to add service to a peripheral instance. 2017-02-18 13:20:03 +01:00
Glenn Ruben Bakke 04f8891dc9 nrf5/modules: Updating peripheral class to assign periopheral parent pointer to service's thats added. Also added a hook in the bluetooth le event handler to store the connection handle value, to prevent any services or characteristics to handle this value themselves. 2017-02-18 13:17:31 +01:00
Glenn Ruben Bakke f956947c23 nrf5/modules: Updating service object to clear pointer to parent peripheral instance. Also assinging pointer to the service when adding a new characteristic. 2017-02-18 13:15:08 +01:00
Glenn Ruben Bakke f3d8fc830e nrf5/modules: Updating print to also include peripheral's connection handle. Setting pointer to service parent instance to NULL. 2017-02-18 13:11:39 +01:00
Glenn Ruben Bakke f5324060cc nrf5/modules: Correcting event id numbers for connect and disconnect event in ubluepy_constants.py 2017-02-18 13:07:00 +01:00
Glenn Ruben Bakke 292c15bf1a nrf5/modules: Shuffle order of typedef in ubluepy header. Adding service pointer in characteristic object. Adding peripheral pointer to the service structure. When populated, the characteristic would get access to conn_handle and service handle through pointers. Also service would get access to peripheral instance. 2017-02-18 01:19:43 +01:00
Glenn Ruben Bakke e0fc8b88c1 nrf5/modules: adding template functions for characteristic read and write. 2017-02-18 01:17:57 +01:00
Glenn Ruben Bakke af2f32ed6a nrf5/modules: Adding constants class to ubluepy which will contain easy access to common bluetooth le numbers and definitions for the bluetooth stack. 2017-02-18 00:11:10 +01:00
Glenn Ruben Bakke f0f6ad20b2 nrf5/modules: Updating example in ubluepy header with 16-bit uuid's commented out, to show usage. 2017-02-17 21:50:50 +01:00
Glenn Ruben Bakke c81b606b01 nrf5/sdk: Adding support for adding 16-bit uuid's in advertisment packet. The services in paramter list can mix 16-bit and 128-bit. 2017-02-17 21:47:38 +01:00
Glenn Ruben Bakke 9befd776fa nrf5/sdk: Updating sdk_common.mk with new filename of bluetooth le driver. 2017-02-17 19:13:49 +01:00
Glenn Ruben Bakke 21f1d8c640 nrf5: Updating all includes of softdevice.h to ble_drv.h 2017-02-17 19:10:24 +01:00
Glenn Ruben Bakke 793cf991ad nrf5/sdk: renaming softdevice.* to ble_drv.* 2017-02-17 19:06:11 +01:00
Glenn Ruben Bakke 5f4c464f29 nrf5/sdk: Renaming bluetooth driver functions to have ble_drv* prefix. Updating modules using it. 2017-02-17 19:02:24 +01:00
Glenn Ruben Bakke 3ff245f667 nrf5/sdk: Enable ubluepy module if s110 bluetooth stack is enabled. 2017-02-17 18:11:22 +01:00
Glenn Ruben Bakke 86c900313c nrf5/sdk: Updating bluetooth driver to only set periph and central count if s132 bluetooth stack. These parameters does not exist in older stacks. 2017-02-17 18:09:23 +01:00
Glenn Ruben Bakke bba8221aa2 nrf5/modules: Updating bluetooth driver and ubluepy to use explicit gap event handler. Adding connection handle parameter to the gap handler from ubluepy. Resetting advertisment flag if connection event is recieved, in order to allow for subsequent advertisment if disconnected again. Example in ublupy header updated. 2017-02-17 17:32:42 +01:00
Glenn Ruben Bakke 7ce31444a0 nrf5: Adding target to flash bluetooth stack when using pyocd-flashtool. 2017-02-16 23:18:07 +01:00
Glenn Ruben Bakke 2fd55feb0c nrf5/modules: Guarding callback to python event handler before issue the call in case it is not set. 2017-02-16 18:49:47 +01:00
Glenn Ruben Bakke 18365135f7 nrf5/modules: Updating ubluepy example to turn led2 on and off when receiving connected and disconnect bluetooth event. 2017-02-15 23:58:23 +01:00
Glenn Ruben Bakke d88320b5b3 nrf5/sdk: Updating bluetooth driver to have configurable logs. 2017-02-15 23:57:23 +01:00
Glenn Ruben Bakke 832a7ffd14 nrf5/modules: updating ubluepy and bluetooth driver to support python created event handler. Added registration of callback from ubluepy against the bluetooth driver and dispatching of events to the user supplied python function. 2017-02-15 23:32:42 +01:00
Glenn Ruben Bakke d29539a395 nrf5/modules: Splitting includes to be inside or outside of the compile guard in ubluepy. This way, all micropython specific includes will be outside, and internal will be inside. This way, there will not be any dependency towards ubluepy headers if not compiled in. 2017-02-15 19:33:11 +01:00
Glenn Ruben Bakke db75b5535c nrf5/modules: Adding two new functions to ubluepy peripheral class to set specific handlers for notificaitons and connection related events. 2017-02-15 19:30:45 +01:00