I'd like to start working on adding support for the adafruit ble to the proton c (chibios generally). I was just hoping to get some pointers for what that should look like.
tmk_core/protocol/chibios.config_common.h errors out if BLUETOOTH_ENABLE is defined (I guess it becomes defined when I set BLUETOOTH = AdafruitBLE) on the proton c because it can only configure the USART for a few chips (e.g. __AVR_ATmega32U4__). We don't need USART here, but what definition should I use to identify the proton c in order not to error out here?stm32/mcuconf.h will need one of STM32_SPI_USE_SPI1/2/3 enabled, but I don't know which one.I'm sure I'll have more questions. Thanks for the help!
I have ported the adafruit ble to chibios before,(https://github.com/yulei/qmk_firmware/tree/wm690/tmk_core/protocol/chibios), you can check the spi.h.c, adafruit_ble.h.cpp. I'm using a stm32f4(proton c used stm32f3), and you can try to port them to using stm32f3.
That's great, thank you!
One thing I'm stuck on is, since I have a battery (it will stay on when I remove the USB cable), I would like to be able to unplug the usb, have it switch to bluetooth (this part I can get, I look for the USB_ACTIVE state, ironically, this seems wrong to me...), and when I plug in the usb again, it would switch back. However, once I unplug the usb, I can't get it to reconnect with the computer when plugging it back in. I have to shut down the board manually. Is it possible to have the USB reconfigured when it is reattached?
you need to detect the presence of the VBUS, that means a dedicate IO pin will be used, once you found the VBUS power was lost. Stop and release the usb driver, and re-initialize the usb driver while VBUS was power on. Or just reset the MCU to re-configure the USB.
How do I reset the MCU without going back into the bootloader?
Similarly, how is the usb driver released and reinstalled?
I think I just need to be pointed in the right direction. Should I be looking at chibios docs? The MCU docs?
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.
I am also interested in getting SPI working with chibios for a different Bluetooth module. I鈥檓 looking for guidance on how this should be structured. I don鈥檛 have a chibios SPI driver yet but I was thinking about setting this up with out it.
@smp4488 #8299 will provide the interface for a potential ARM SPI driver - it's similar to the existing i2c_master stuff.
I've merged the AVR spi_master implementation for #8299.
We'll need to sort out an equivalent ChibiOS implementation.
Have raised a draft PR, #8739, which lays the groundwork for the SPI protocol on ChibiOS/ARM.
The Adafruit BLE will require a bunch of changes to turn it into a generic driver after that PR gets merged.
This issue has been automatically marked as stale because it has not had activity in the last 90 days. It will be closed in the next 30 days unless it is tagged properly or other activity occurs.
For maintainers: Please label with bug, in progress, on hold, discussion or to do to prevent the issue from being re-flagged.
This issue has been automatically closed because it has not had activity in the last 30 days. If this issue is still valid, re-open the issue and let us know.
Most helpful comment
@smp4488 #8299 will provide the interface for a potential ARM SPI driver - it's similar to the existing i2c_master stuff.