Initial public release.

This commit is contained in:
Joe Kearney 2025-02-01 19:22:12 -06:00
parent 7b169e8116
commit dac4af8d25
255 changed files with 68595 additions and 2 deletions

View file

@ -0,0 +1,94 @@
/*******************************************************************************
* File Name: common.h
*
* Version 1.0
*
* Description:
* Contains the function prototypes and constants available to the example
* project.
*
********************************************************************************
* Copyright 2017, Cypress Semiconductor Corporation. All rights reserved.
* You may use this file only in accordance with the license, terms, conditions,
* disclaimers, and limitations in the end user license agreement accompanying
* the software package with which this file was provided.
*******************************************************************************/
#ifndef COMMON_H
#define COMMON_H
#include <project.h>
#include <stdio.h>
/***************************************
* Conditional Compilation Parameters
***************************************/
#define ENABLED (1u)
#define DISABLED (0u)
#define DEBUG_UART_ENABLED ENABLED
/***************************************
* API Constants
***************************************/
#define ADV_TIMER_TIMEOUT (1u) /* Сounts in seconds */
#define SW2_PRESS_TIME_DEL_BOND_LIST (0x04u)
/* BAS service defines */
#define BATTERY_TIMEOUT (30u) /* Battery simulation timeout */
/***************************************
* External Function Prototypes
***************************************/
int HostMain(void);
/* Function prototypes from debug.c */
void ShowValue(cy_stc_ble_gatt_value_t *value);
char HexToAscii(uint8_t value, uint8_t nibble);
void Set32ByPtr(uint8_t ptr[], uint32_t value);
void PrintStackVersion(void);
void PrintApiResult(cy_en_ble_api_result_t apiResult);
void ShowError(void);
/* Function prototypes from bond.c */
void App_DisplayBondList(void);
void App_RemoveDevicesFromBondListBySW2Press(uint32_t seconds);
void App_RemoveDevicesFromBondList(void);
void App_SetRemoveBondListFlag(void);
bool App_IsRemoveBondListFlag(void);
bool App_IsDeviceInBondList(uint32_t bdHandle);
uint32_t App_GetCountOfBondedDevices(void);
/***************************************
* UART_DEB Macros / prototypes
***************************************/
#if (DEBUG_UART_ENABLED == ENABLED)
#define DBG_PRINTF(...) (printf(__VA_ARGS__))
#define UART_DEB_PUT_CHAR(...) while(1UL != UART_DEB_Put(__VA_ARGS__))
#define UART_DEB_GET_CHAR(...) (UART_DEB_Get())
#define UART_DEB_IS_TX_COMPLETE(...) (UART_DEB_IsTxComplete())
#define UART_DEB_WAIT_TX_COMPLETE(...) while(UART_DEB_IS_TX_COMPLETE() == 0) ;
#define UART_DEB_SCB_CLEAR_RX_FIFO(...) (Cy_SCB_ClearRxFifo(UART_DEB_SCB__HW))
#define UART_START(...) (UART_DEB_Start(__VA_ARGS__))
#else
#define DBG_PRINTF(...)
#define UART_DEB_PUT_CHAR(...)
#define UART_DEB_GET_CHAR(...) (0u)
#define UART_DEB_IS_TX_COMPLETE(...) (1u)
#define UART_DEB_WAIT_TX_COMPLETE(...) (0u)
#define UART_DEB_SCB_CLEAR_RX_FIFO(...) (0u)
#define UART_START(...)
#endif /* (DEBUG_UART_ENABLED == ENABLED) */
#define UART_DEB_NO_DATA (char8) CY_SCB_UART_RX_NO_DATA
/***************************************
* External data references
***************************************/
extern cy_stc_ble_conn_handle_t appConnHandle;
#endif /* COMMON_H */
/* [] END OF FILE */