Commit Graph

698 Commits

Author SHA1 Message Date
Glenn Ruben Bakke
52be9eec9d nrf5: Adding include of modmusic.h in main.c. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
4c5c83567e nrf5: Call microbit_music_init0() if enabled in main.c. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
6330fd4f31 nrf5/modules/music: Expose public init function for music module. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
d412241143 nrf5/modules/music: Update modmusic to use updated includes. Add extern ticks. Add function which implements initialization of pwm and ticker, register ticker callback, and start the pwm and ticker. This corresponds to microbit port main.cpp init. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
a0ad7ce0b4 nrf5/drivers/softpwm: Enable use of ticker in softpwm driver. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
cab515a022 nrf5/drivers/ticker: Adding ticker.c/.h from microbit port. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
3bc8309dab nrf5/drivers/pwm: Renaming pwm.c/.h to softpwm.c/.h 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
226d872d11 nrf5/drivers/pwm: Expose pwm_init() as public function. 2017-05-18 23:11:41 +02:00
Glenn Ruben Bakke
02e215dc59 nrf5/modules/ubluepy: Making peripheral conn_handle volatile. Upon connection event, the variable is accessed in thread mode. However, the main-loop is blocking on conn_handle != 0xFFFF. If this is not volatile, optimized code will not exit the loop. 2017-05-15 23:01:29 +02:00
Glenn Ruben Bakke
36d9c0cb83 nrf5/drivers/bluetooth: As callback functions are in most usecases are set to NULL upon last event to get public API function out of blocking mode, these function pointers has to be set as volatile, as they are updated to NULL in interrupt context, but read in blocking main-thread. 2017-05-15 23:01:10 +02:00
Glenn Ruben Bakke
e6b49af27e nrf5/examples: Fixing overlapping function names and variable names inside the object. Also removing some print statements. Tuning max angle from -7/7 to -25/25. 2017-05-15 21:59:00 +02:00
glennrub
9b76983af9 Powerup (#26)
* nrf5/examples: Adding python example template for PowerUp 3.0 Bluetooth LE controlled Paper Airplane.

* nrf5: Enable bluetooth le central while developing powerup 3.0 example.

* nrf5/examples: Backing up powerup 3.0 progress.

* nrf5/examples: Adding working example on how to control PowerUp 3.0 paper airplane using bluetooth le.

* nrf5/bluetooth: Disable central role.
2017-05-14 23:02:10 +02:00
Glenn Ruben Bakke
63805bac9c nrf5/modules/ubluepy: Correcting alignment of enum values in modubluepy.h. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
d96e2a3e08 nrf5/drivers/bluetooth: Add implementation of client attribute write without response. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
8f423c26d0 nrf5/modules/ubluepy: Pass on buffer to write in characteristic write central mode. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
ceb2602005 nrf5/modules/ubluepy: Updating characteristic object write function to be role aware. Either peripheral or central (gatts or gattc). Adding dummy call to attr_c_write if central is compiled in. Still in progress to be implemented. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
1f8ceaa6fb nrf5/drivers/bluetooth: Adding template function for attr_c_write. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
fd52691f02 nrf5/drivers/bluetooth: Renaming attr_write and attr_notify to attr_s_write and attr_s_notify to prepare for introduction of attribute write for gatt client. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
5d9c191a19 nrf5/modules/ubluepy: Fixing type in ubluepy_peripheral.c. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
cf0d2bb457 nrf5/modules/ubluepy: Setting peripheral role upon advertise() or connect(). 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
f8c0ff6413 nrf5/drivers/bluetooth: Adding role member to peripheral object to indicate whether Peripheral object is Peripheral or Central role. 2017-05-14 19:58:10 +02:00
Glenn Ruben Bakke
78c0821216 nrf5/modules/ubluepy: Continue characteristic discovery until nothing more is found during connect proceedure. 2017-05-14 18:06:42 +02:00
Glenn Ruben Bakke
653f4a86d5 nrf5/drivers/bluetooth: Refactoring code to group statics for s130 and s132 into the same ifdef. Also adding two empty lines in discovery functions to make it more easy to read. 2017-05-14 18:06:42 +02:00
Glenn Ruben Bakke
e8cd010f59 nrf5/drivers/bluetooth: Updating characteristic discovery to signal whether anything was found or not. 2017-05-14 18:06:42 +02:00
Glenn Ruben Bakke
370c20ff6c nrf5/modules/ubluepy: Continue primary service discovery until nothing more is found in connect proceedure. 2017-05-13 18:12:15 +02:00
Glenn Ruben Bakke
b4f96a1dc3 nrf5/drivers/bluetooth: Updating primary service discovery api to take in start handle from where to start the service discovery. Also adjusting return parameter to signal whether anything was found or not. 2017-05-13 18:12:15 +02:00
Glenn Ruben Bakke
3420843774 nrf5/modules/ubluepy: Remove duplication GAP event handler registration in peripheral.connect(). 2017-05-13 16:17:03 +02:00
glennrub
4584ef4ace Support address types (#18)
* nrf5/modules/ubluepy: Adding new enumeration of address types.

* nrf5/modules/ubluepy: Adding constants that can be used from micropython for public and random static address types.

* nrf5/modules/ubluepy: Adding support for optionally setting address type in Peripheral.connect(). Public address is used as default. Address types can be retrieved from 'constants'. Either constants.ADDR_TYPE_PUBLIC or constants.ADDR_TYPE_RANDOM_STATIC.

* nrf5/modules/ubluepy: Register central GAP event handler before issuing connect to a peripheral. Has to be done before connect() function as a connected event will be propergated upon successfull connection. The handler will set the connection handle which gets connect function out of the busy loop waiting for connection to succeed.

* nrf5/modules/ubluepy: Removing duplicate setting of GAP event handler in connect().
2017-05-13 16:12:14 +02:00
Glenn Ruben Bakke
0865fbd92d nrf5/modules/ubluepy: Register central GAP event handler before issuing connect to a peripheral. Has to be done before connect() function as a connected event will be propergated upon successfull connection. The handler will set the connection handle which gets connect function out of the busy loop waiting for connection to succeed. 2017-05-13 15:06:58 +02:00
Glenn Ruben Bakke
18e73d4214 nrf5/modules/ubluepy: Fixing compilation bug of wrong variable name when registering gattc event handler in ublupy peripheral connect function (central mode). 2017-05-12 20:11:30 +02:00
Glenn Ruben Bakke
96b203b729 nrf5/bluetooth: Updating makefiles with updated paths to bluetooth le components after moving files. 2017-05-11 19:13:20 +02:00
Glenn Ruben Bakke
3d503cf7a8 nrf5/bluetooth: Moving stack download script to drivers/bluetooth folder. 2017-05-11 19:13:20 +02:00
Glenn Ruben Bakke
bdaa714f85 nrf5/bluetooth: Move bluetooth driver files to drivers/bluetooth. Move bluetooth stack download script to root folder. 2017-05-11 19:13:20 +02:00
Glenn Ruben Bakke
e69e47bc24 nrf5/bluetooth: Guarding implementation against being linked in by surrounding it with BLUETOOTH_SD flag. Flag is only set if SD=<sdname> parameter is provided during make. 2017-05-11 19:13:20 +02:00
Glenn Ruben Bakke
4676e5900b nrf5/bluetooth: Moving makefile include folder and source files of bluetooth driver, ble uart and ble module to main Makefile. 2017-05-11 19:13:20 +02:00
Glenn Ruben Bakke
d61dcf18fb nrf5/bluetooth: Moving help_sd.h and modble.c to modules/ble. 2017-05-11 19:13:20 +02:00
Glenn Ruben Bakke
b245011259 nrf5/modules/machine: bugfix after changing to MP_ROM_PTR in machine module local dict. 2017-05-11 00:08:44 +02:00
Glenn Ruben Bakke
54656044f7 nrf5: Syncing code with upstream master and converting all module and method tables to use MP_ROM macros. Also adding explicit casting of local dicts to (mp_obj_dict_t*). 2017-05-09 22:54:58 +02:00
Glenn Ruben Bakke
00d96f5695 nrf5/modules/timer: Fixing bug in timer_find(). Function allowed to locate index out of range and started to look up in config pointer (index == size of array). 2017-05-08 23:32:42 +02:00
Glenn Ruben Bakke
1063a44ec6 nrf5/modules/timer: Remove test which is covered by timer_find() function in the line below. 2017-05-08 23:31:14 +02:00
Glenn Ruben Bakke
2cf9e3e625 nrf5/modules/timer: Adding locals dict table and adding start/stop template functions. Also adding constants for oneshot and periodic to locals dict. 2017-05-08 23:24:15 +02:00
Glenn Ruben Bakke
9e6cca66b4 nrf5/modules/timer: Adding timer module to modmachine. 2017-05-08 23:09:15 +02:00
Glenn Ruben Bakke
bf79699810 nrf5/boards: Adding micro:bit default music pin definition. Also adding config flag for enabling pwm machine module. 2017-05-08 22:16:59 +02:00
Glenn Ruben Bakke
130a00fdeb nrf5/hal/timer: Adding start/stop template functions to hal_timer.h/.c 2017-05-08 22:10:02 +02:00
Glenn Ruben Bakke
64f91e01ac nrf5/Makefile: Adding drivers/pwm.c and modules/music files to the source file list. 2017-05-08 22:06:25 +02:00
Glenn Ruben Bakke
d3509517f5 nrf5/modules/music: Adding config guard in musictunes.c and adding import of mphal.h. 2017-05-08 22:05:23 +02:00
Glenn Ruben Bakke
a84ed760b5 nrf5/modules/music: Including mphal.h before config guard in modmusic.c. Also changed name on config guard to MICROPY_PY_MUSIC. Missing PWM functions during linkage will show up if PWM module has not not configured. 2017-05-08 22:03:33 +02:00
Glenn Ruben Bakke
24e902aa8f nrf5/drivers/pwm: Including mphal.h before config guard in pwm.c. 2017-05-08 22:01:47 +02:00
Glenn Ruben Bakke
cf1c6939ea nrf5: Updating mpconfigport.h to include music module as builtin. Adding new configuration for enabling music module. Activating MODULE_BUILTIN_INIT in order to run music module init function on import. 2017-05-08 22:01:05 +02:00
Glenn Ruben Bakke
c3ccef800d nrf5/modules/music: Backing up progress in music module. 2017-05-08 21:22:53 +02:00