Lizzy project

Dependencies:   aconno_I2C Lis2dh12 adc52832_common aconno_SEGGER_RTT

tasks/tasks.cpp

Committer:
jurica238814
Date:
2018-09-13
Branch:
SimpleGATTExample
Revision:
22:7dae8496b97c
Parent:
19:2681edc2f2b9

File content as of revision 22:7dae8496b97c:

/**
 * Aconno.de
 */

#include "bspLed.h"
#include "aconno_ble.h"
#include "tasks.h"
#include "GapAdvertisingData.h"
#include "aconnoConfig.h"
#include "bsp.h"

#define SHORT_DELAY_MS			(75)

static advertising_packet advertisementPacket;
static GapAdvertisingData adv_data = GapAdvertisingData();

void updateBuzzLedsF()
{

    while (true)
    {
        Thread::signal_wait(UPDATE_BUZZ_LEDS);
        updateBuzzLedsT.signal_clr(UPDATE_BUZZ_LEDS);

        if (lizzy_service->get_red_state())
        {
            redLed = LED_ON;
			wait_ms(SHORT_DELAY_MS);
			redLed = LED_OFF;
			lizzy_service->set_red_state(LED_OFF);
        }
        if (lizzy_service->get_green_state())
        {
            greenLed = LED_ON;
			wait_ms(SHORT_DELAY_MS);
			greenLed = LED_OFF;
			lizzy_service->set_green_state(LED_OFF);
        }
    }
}

void bleF(BLE *ble)
{
    while(true)
    {
        Thread::signal_wait(MEAS_DONE);
        bleT.signal_clr(MEAS_DONE);

        adv_data = ble->getAdvertisingData();
        adv_data.updateData(adv_data.MANUFACTURER_SPECIFIC_DATA,
			(uint8_t *)&advertisementPacket, sizeof(advertisementPacket));
        ble->setAdvertisingData(adv_data);
    }
}