recover annotations from b25b31c2

This commit is contained in:
Matthias Ringwald 2015-04-19 22:39:48 +02:00
parent 8ca565ce9c
commit a3683d7720

View File

@ -36,11 +36,17 @@
*/
// *****************************************************************************
//
// led_counter demo - uses the BTstack run loop to blink an LED
//
/* EXAMPLE_START(led_counter): UART and timer interrupt without Bluetooth
*
* @text The example uses the BTstack run loop to blink an LED.
* The example demonstrates how to setup hardware, initialize BTstack without
* Bluetooth, provide a periodic timer to toggle an LED and print number of
* toggles as a minimal BTstack test.
*/
// *****************************************************************************
#include <stdint.h>
#include <stdio.h>
@ -57,7 +63,16 @@ static void run_loop_register_timer(timer_source_t *timer, uint16_t period){
run_loop_add_timer(timer);
}
static void heartbeat_handler(timer_source_t *ts){
/* @section Periodic Timer Setup
*
* @text As timers in BTstack are single shot,
* the periodic counter is implemented by re-registering the timer source in the
* heartbeat handler callback function. Listing LEDToggler shows heartbeat handler
* adapted to periodically toggle an LED and print number of toggles.
*/
/* LISTING_START(LEDToggler): Periodic counter */
static void heartbeat_handler(timer_source_t *ts){
// increment counter
char lineBuffer[30];
sprintf(lineBuffer, "BTstack counter %04u\n\r", ++counter);
@ -69,20 +84,24 @@ static void heartbeat_handler(timer_source_t *ts){
// re-register timer
run_loop_register_timer(ts, HEARTBEAT_PERIOD_MS);
}
/* LISTING_END */
static void timer_setup(){
/* @section Turn On and Go
*
* @text Listing MainConfiguration shows main application code.
* It is called after hardware and BTstack configuration (memory, run loop and
* transport layer) by the platform main in
* \path{platforms/PLATFORM/src/main.c}.
*/
/* LISTING_START(MainConfiguration): Setup heartbeat timer */
int btstack_main(int argc, const char * argv[]);
int btstack_main(int argc, const char * argv[]){
// set one-shot timer
heartbeat.process = &heartbeat_handler;
run_loop_register_timer(&heartbeat, HEARTBEAT_PERIOD_MS);
}
int btstack_main(int argc, const char * argv[]);
int btstack_main(int argc, const char * argv[]){
timer_setup();
printf("Run...\n\r");
printf("Run...\n\r");
return 0;
}
/* LISTING_END */
/* EXAMPLE_END */