Skip to content
Snippets Groups Projects
Verified Commit bd325f08 authored by schneider's avatar schneider Committed by rahix
Browse files

chore(ble): Clean up uart file

parent 6348e507
No related branches found
No related tags found
No related merge requests found
...@@ -47,6 +47,7 @@ static wsfBufPoolDesc_t mainPoolDesc[WSF_BUF_POOLS] = ...@@ -47,6 +47,7 @@ static wsfBufPoolDesc_t mainPoolDesc[WSF_BUF_POOLS] =
/*! \brief Stack initialization for app. */ /*! \brief Stack initialization for app. */
extern void StackInit(void); extern void StackInit(void);
extern void AppInit(void); extern void AppInit(void);
extern void bleuart_init(void);
/*************************************************************************************************/ /*************************************************************************************************/
void PalSysAssertTrap(void) void PalSysAssertTrap(void)
......
#include "modules/modules.h"
#include "wsf_types.h" #include "wsf_types.h"
#include "wsf_os.h"
#include "wsf_buf.h"
#include "wsf_timer.h"
#include "wsf_trace.h"
#include "app_ui.h"
#include "ble_api.h"
#include "hci_vs.h"
#include "att_defs.h"
#include "util/bstream.h" #include "util/bstream.h"
#include "att_api.h" #include "att_api.h"
#include "modules/modules.h"
#include "FreeRTOS.h" #include "FreeRTOS.h"
#include "timers.h" #include "timers.h"
...@@ -21,7 +13,7 @@ ...@@ -21,7 +13,7 @@
#define UART_START_HDL 0x800 /*!< \brief Service start handle. */ #define UART_START_HDL 0x800 /*!< \brief Service start handle. */
#define UART_END_HDL (BATT_MAX_HDL - 1) /*!< \brief Service end handle. */ #define UART_END_HDL (UART_MAX_HDL - 1) /*!< \brief Service end handle. */
/************************************************************************************************** /**************************************************************************************************
Handles Handles
...@@ -30,16 +22,17 @@ ...@@ -30,16 +22,17 @@
/*! \brief UART Service Handles */ /*! \brief UART Service Handles */
enum enum
{ {
UART_SVC_HDL = UART_START_HDL, /*!< \brief UART service declaration */ UART_SVC_HDL = UART_START_HDL, /*!< \brief UART service declaration */
UART_RX_CH_HDL, /*!< \brief UART rx characteristic */ UART_RX_CH_HDL, /*!< \brief UART rx characteristic */
UART_RX_HDL, /*!< \brief UART rx value */ UART_RX_HDL, /*!< \brief UART rx value */
UART_TX_CH_HDL, /*!< \brief UART tx characteristic */ UART_TX_CH_HDL, /*!< \brief UART tx characteristic */
UART_TX_HDL, /*!< \brief UART tx value */ UART_TX_HDL, /*!< \brief UART tx value */
UART_TX_CH_CCC_HDL, /*!< \brief UART tx CCCD */ UART_TX_CH_CCC_HDL, /*!< \brief UART tx CCCD */
BATT_MAX_HDL /*!< \brief Maximum handle. */ UART_MAX_HDL /*!< \brief Maximum handle. */
}; };
/**@}*/ /**@}*/
/* clang-format off */
static const uint8_t UARTSvc[] = {0x9E,0xCA,0xDC,0x24,0x0E,0xE5,0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x01,0x00,0x40,0x6E}; static const uint8_t UARTSvc[] = {0x9E,0xCA,0xDC,0x24,0x0E,0xE5,0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x01,0x00,0x40,0x6E};
static const uint8_t uartRxCh[] = {ATT_PROP_WRITE, UINT16_TO_BYTES(UART_RX_HDL), 0x9E,0xCA,0xDC,0x24,0x0E,0xE5,0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x02,0x00,0x40,0x6E}; static const uint8_t uartRxCh[] = {ATT_PROP_WRITE, UINT16_TO_BYTES(UART_RX_HDL), 0x9E,0xCA,0xDC,0x24,0x0E,0xE5,0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x02,0x00,0x40,0x6E};
...@@ -47,7 +40,7 @@ const uint8_t attUartRxChUuid[] = {0x9E,0xCA,0xDC,0x24,0x0E,0xE5, 0xA9,0xE0,0x93 ...@@ -47,7 +40,7 @@ const uint8_t attUartRxChUuid[] = {0x9E,0xCA,0xDC,0x24,0x0E,0xE5, 0xA9,0xE0,0x93
static const uint8_t uartTxCh[] = {ATT_PROP_READ | ATT_PROP_NOTIFY, UINT16_TO_BYTES(UART_TX_HDL), 0x9E,0xCA,0xDC,0x24,0x0E,0xE5,0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x03,0x00,0x40,0x6E}; static const uint8_t uartTxCh[] = {ATT_PROP_READ | ATT_PROP_NOTIFY, UINT16_TO_BYTES(UART_TX_HDL), 0x9E,0xCA,0xDC,0x24,0x0E,0xE5,0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x03,0x00,0x40,0x6E};
const uint8_t attUartTxChUuid[] = {0x9E,0xCA,0xDC,0x24,0x0E,0xE5, 0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x03,0x00,0x40,0x6E}; const uint8_t attUartTxChUuid[] = {0x9E,0xCA,0xDC,0x24,0x0E,0xE5, 0xA9,0xE0,0x93,0xF3,0xA3,0xB5,0x03,0x00,0x40,0x6E};
/* Battery level client characteristic configuration */ /* clang-format on */
...@@ -55,7 +48,6 @@ static void *SvcUARTAddGroupDyn(void) ...@@ -55,7 +48,6 @@ static void *SvcUARTAddGroupDyn(void)
{ {
void *pSHdl; void *pSHdl;
uint8_t initCcc[] = {UINT16_TO_BYTES(0x0000)}; uint8_t initCcc[] = {UINT16_TO_BYTES(0x0000)};
uint8_t initUARTVal[] = {0x20};
/* Create the service */ /* Create the service */
pSHdl = AttsDynCreateGroup(UART_START_HDL, UART_END_HDL); pSHdl = AttsDynCreateGroup(UART_START_HDL, UART_END_HDL);
...@@ -79,7 +71,7 @@ static void *SvcUARTAddGroupDyn(void) ...@@ -79,7 +71,7 @@ static void *SvcUARTAddGroupDyn(void)
AttsDynAddAttrConst(pSHdl, attChUuid, uartTxCh, sizeof(uartTxCh), 0, ATTS_PERMIT_READ); AttsDynAddAttrConst(pSHdl, attChUuid, uartTxCh, sizeof(uartTxCh), 0, ATTS_PERMIT_READ);
/* UART tx value */ /* UART tx value */
/* TODO: do we need ATTS_SET_READ_CBACK ? */ /* TODO: do we need ATTS_SET_READ_CBACK ? */
AttsDynAddAttr(pSHdl, attUartTxChUuid, initUARTVal, sizeof(uint8_t), sizeof(uint8_t), AttsDynAddAttr(pSHdl, attUartTxChUuid, NULL, 0, sizeof(uint8_t),
ATTS_SET_READ_CBACK, ATTS_PERMIT_READ); ATTS_SET_READ_CBACK, ATTS_PERMIT_READ);
/* UART tx CCC descriptor */ /* UART tx CCC descriptor */
AttsDynAddAttr(pSHdl, attCliChCfgUuid, initCcc, sizeof(uint16_t), sizeof(uint16_t), AttsDynAddAttr(pSHdl, attCliChCfgUuid, initCcc, sizeof(uint16_t), sizeof(uint16_t),
...@@ -94,7 +86,6 @@ dmConnId_t active_connection = 0; ...@@ -94,7 +86,6 @@ dmConnId_t active_connection = 0;
static uint8_t UARTReadCback(dmConnId_t connId, uint16_t handle, uint8_t operation, static uint8_t UARTReadCback(dmConnId_t connId, uint16_t handle, uint8_t operation,
uint16_t offset, attsAttr_t *pAttr) uint16_t offset, attsAttr_t *pAttr)
{ {
//AppHwBattRead(pAttr->pValue);
printf("read callback\n"); printf("read callback\n");
return ATT_SUCCESS; return ATT_SUCCESS;
} }
......
#ifndef MODULES_H #ifndef MODULES_H
#define MODULES_H #define MODULES_H
#include <stdint.h>
/* ---------- FAT fs ------------------------------------------------------ */ /* ---------- FAT fs ------------------------------------------------------ */
/* Number of bits to use for indexing into our internal pool of files/directories /* Number of bits to use for indexing into our internal pool of files/directories
* This indirectly specifies the size of the pool as 2^EPIC_FAT_FD_INDEX_BITS * This indirectly specifies the size of the pool as 2^EPIC_FAT_FD_INDEX_BITS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment