Skip to content
Snippets Groups Projects
Select Git revision
  • d6ea08a742ef818a5ef07b2eefadfd7ea1af6e2f
  • master default protected
  • rahix/user-space-ctx
  • schneider/iaq-python
  • schneider/ble-mini-demo
  • schneider/ble-ecg-stream-visu
  • schneider/mp-exception-print
  • schneider/sleep-display
  • schneider/deepsleep4
  • schneider/deepsleep2
  • schneider/deepsleep
  • schneider/ble-central
  • rahix/bluetooth-app-favorite
  • schneider/v1.17-changelog
  • schneider/ancs
  • schneider/png
  • schneider/freertos-list-debug
  • schneider/212-reset-hardware-when-entering-repl
  • schneider/bonding-fail-if-full
  • schneider/ble-fixes-2020-3
  • schneider/spo2-playground
  • v1.18
  • v1.17
  • v1.16
  • v1.15
  • v1.14
  • v1.13
  • v1.12
  • v1.11
  • v1.10
  • v1.9
  • v1.8
  • v1.7
  • v1.6
  • v1.5
  • v1.4
  • v1.3
  • v1.2
  • v1.1
  • v1.0
  • release-1
41 results

ble.c

Blame
  • Forked from card10 / firmware
    Source project has a limited visibility.
    ble.c 10.52 KiB
    #include "epicardium.h"
    #include "modules/log.h"
    #include "modules/config.h"
    
    #include "fs/fs_util.h"
    #include "wsf_types.h"
    #include "wsf_buf.h"
    #include "wsf_trace.h"
    #include "ble_api.h"
    #include "hci_vs.h"
    #include "att_api.h"
    
    #include "FreeRTOS.h"
    #include "timers.h"
    
    #include <machine/endian.h>
    #include <stdio.h>
    #include <string.h>
    #include <stdbool.h>
    
    #define FACTOR 2
    #define WSF_BUF_POOLS 6
    #define WSF_BUF_SIZE (0x1048 * FACTOR)
    
    struct log_packet_header {
    	uint32_t original_length;
    	uint32_t included_length;
    	uint32_t packet_flags;
    	uint32_t cumulative_drops;
    	uint32_t timestamp_us_h;
    	uint32_t timestamp_us_l;
    };
    static const uint8_t log_header[] = {
    	'b', 't', 's', 'n', 'o', 'o', 'p', 0, 0, 0, 0, 1, 0, 0, 0x03, 0xea
    };
    
    uint32_t SystemHeapSize = WSF_BUF_SIZE;
    uint32_t SystemHeap[WSF_BUF_SIZE / 4];
    uint32_t SystemHeapStart;
    
    /* Task ID for the ble handler */
    static TaskHandle_t ble_task_id = NULL;
    
    /*! Default pool descriptor. */
    /* clang-format off */
    static wsfBufPoolDesc_t mainPoolDesc[WSF_BUF_POOLS] =
    {
      {  16,  8*FACTOR },
      {  32,  4*FACTOR },
      {  64,  4*FACTOR },
      { 128,  4*FACTOR },
      { 256,  4*FACTOR },
      { 512,  4*FACTOR }
    };
    /* clang-format on */
    
    static StaticTimer_t x;
    static TimerHandle_t timerWakeup = NULL;
    static int lasttick              = 0;
    
    static int log_fd;
    static bool log_dirty        = false;
    static bool log_enabled      = false;
    static int log_lastflushtick = 0;
    
    /*! \brief  Stack initialization for app. */
    extern void StackInit(void);
    extern void AppInit(void);
    extern void bleuart_init(void);
    extern void bleFileTransfer_init(void);