Last active
November 3, 2015 10:57
-
-
Save ytsuboi/1674941119f6bf2a055f to your computer and use it in GitHub Desktop.
Eddystone-URL on PRoC BLE module sample code.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
* Eddystone on PRoC BLE module sample code. | |
* ytsuboi Switch Science | |
* | |
* These codes are licensed under CC0. | |
* http://creativecommons.org/publicdomain/zero/1.0/deed.ja | |
*/ | |
#include <project.h> | |
void StackEventHandler(uint32 event, void *eventParam) { | |
switch (event) { | |
// Mandatory events to be handled | |
case CYBLE_EVT_STACK_ON: | |
CyBle_GappStartAdvertisement(CYBLE_ADVERTISING_FAST); | |
LED_1_Write(0); // LED on | |
break; | |
case CYBLE_EVT_TIMEOUT: | |
LED_1_Write(1); // LED off | |
break; | |
default: | |
break; | |
} | |
} | |
int main() | |
{ | |
CYBLE_API_RESULT_T apiResult; | |
// Enable global interrupts | |
CyGlobalIntEnable; | |
// Initialize the BLE device. | |
apiResult = CyBle_Start(StackEventHandler); | |
// Validate BLE stack initialization succeeded | |
CYASSERT(apiResult == CYBLE_ERROR_OK); | |
for(;;){ | |
// Service all the BLE stack events. | |
// Must be called at least once in a BLE connection interval | |
CyBle_ProcessEvents(); | |
} | |
} | |
/* [] END OF FILE */ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment