Nano2 onDisconnection errors


Hey everyone. I just received a Nano 2 and am trying to put the nanokeys Bluetooth keyboard project on it.

I am very new to some of this higher level program as I typically do embedded C programming, so I’m definitely getting lost in following the code (especially given the difficulty following functions in the arduino IDE). After fixing a few include issues with the code, I am now running into an issue with the way the callback functions work. It seems that RedBear has made a change in the params of the connect/disconnect functions, and I’m not sure of the proper way to fix it. Here is the first error I get with regards to it:

\\\home\deccln.jk\My Documents\Arduino\libraries\NanoKeys\src\Manager.cpp: In member function 'void NanoKeys::Manager::setOnDisconnection(NanoKeys::Manager::DisconnCallback)':

\\\home\deccln.jk\My Documents\Arduino\libraries\NanoKeys\src\Manager.cpp:78:40: error: invalid conversion from 'NanoKeys::Manager::DisconnCallback {aka void (*)(short unsigned int, Gap::DisconnectionReason_t)}' to 'void (*)(const Gap::DisconnectionCallbackParams_t*)' [-fpermissive]


The line of code from Manager.cpp line 78 is " theBLE->onDisconnection(on_disconn_cb);"

Eventually it points to this:

C:\Users\208575\AppData\Local\Arduino15\packages\RedBear\hardware\nRF52832\0.0.2/cores/RBL_nRF52832/FEATURE_BLE/ble/FunctionPointerWithContext.h:37:5: error:   initializing argument 1 of 'FunctionPointerWithContext<ContextType>::FunctionPointerWithContext(void (*)(ContextType)) [with ContextType = const Gap::DisconnectionCallbackParams_t*]' [-fpermissive]

     FunctionPointerWithContext(void (*function)(ContextType context) = NULL) :

Older versions of the RedBear board libraries for the Nano 1.5 have no issues with this, but even 1.0.7 of the Nano 1.5 throws the same error as the code version 0.0.1 or 0.0.2 for the Nano 2. So this means they obviously changed the library. What is the proper way for me to use this function?

I hope I have provided enough information as I’m obviously a bit lost.



I am trying to do the same, did you ever get this figured out?