A library called EasySleep

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I found the low power handling on PSoC4BLE difficult so I tried to create a more user friendly function: void sleep_ble(BLESleepT request). It it based on documentation I've found, see comments in the source code. The function takes one of the following requests:

   
        
  • BLE_SLEEP: put BLE into Sleep
  •     
  • BLE_DEEPSLEEP: put BLE into DeepSleep, which takes some longer time to wake up than Sleep
  •     
  • BLE_SLEEP_CPU_SLEEP: put BLE into Sleep, put CPU into Sleep
  •     
  • BLE_DEEPSLEEP_CPU_SLEEP: put BLE into DeepSleep, put CPU into Sleep
  •     
  • BLE_DEEPSLEEP_CPU_DEEPSLEEP: put BLE into DeepSleep, put CPU into DeepSleep
  •    
   

and tries to to it's best. The typical usage will probably use one of BLE_DEEPSLEEP, BLE_DEEPSLEEP_CPU_SLEEP or BLE_DEEPSLEEP_CPU_DEEPSLEEP.

   

Enjoy! And please add comments if parts of the code must be fixed.

0 Likes
3 Replies
Anonymous
Not applicable

Awesome! 🙂 Thanks for your interest!

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

I found a nasty bug in this library: The if-statements in the function unzip() was not put into braces. I've attached the bugfixed files (I plan to put this (and more?) on GitHub, when I get time).

   

 

   

So if you have been using EasySleep, you must update it. And please give feedback if more needs to be fixed. I have not tested this code well, yet.

0 Likes
lock attach
Attachments are accessible only for community members.
Anonymous
Not applicable

OK. I started to use this library by my own, and have now fixed another problem: The documentation for CyBle_GetBleSsState() was wrong for the CYBLE_BLESS_STATE_EVENT_CLOSE state ("after this state").

   

 

   

The code is now on GitHub instead, and further (?) development will be done there: https://github.com/cypress-speedycat/EasySleep

0 Likes