Defines | Enumerations | Functions

gazell/common/gzp_device.c File Reference

Implementation of Gazell Pairing Library (gzp), Device functions. More...

#include <stdint.h>
#include <stdbool.h>
#include <string.h>
#include "gzll.h"
#include "gzp.h"
#include "hal_aes.h"
#include "hal_delay.h"
#include "hal_flash.h"
#include "memdefs.h"

Go to the source code of this file.

Defines

#define GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS   0
#define GZP_PARAMS_DB_ELEMENT_HOST_ID   (GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS + GZP_SYSTEM_ADDRESS_WIDTH)
#define GZP_PARAMS_DB_ELEMENT_SIZE   (GZP_SYSTEM_ADDRESS_WIDTH + GZP_HOST_ID_LENGTH)
#define GZP_PARAMS_DB_MAX_ENTRIES   14
#define GZP_PARAMS_DB_ADR   GZP_PARAMS_STORAGE_ADR
#define GZP_PARAMS_DB_SIZE   (GZP_PARAMS_DB_MAX_ENTRIES * GZP_PARAMS_DB_ELEMENT_SIZE)
#define GZP_INDEX_DB_ADR   (GZP_PARAMS_STORAGE_ADR + GZP_PARAMS_DB_SIZE)
#define GZP_INDEX_DB_SIZE   (GZP_DEVICE_PARAMS_STORAGE_SIZE - GZP_PARAMS_DB_SIZE)

Enumerations

enum  gzp_tx_rx_trans_result_t { GZP_TX_RX_SUCCESS, GZP_TX_RX_FAILED_TO_SEND, GZP_TX_RX_NO_RESPONSE }

Functions

void gzp_delay_rx_periods (uint16_t rx_periods)
void gzp_init ()
_Bool gzp_address_req_send ()
gzp_id_req_res_t gzp_id_req_send ()
void gzp_id_req_cancel ()
_Bool gzp_crypt_data_send (const uint8_t *src, uint8_t length)
_Bool gzp_set_host_id (const uint8_t *id)
_Bool gzp_get_host_id (uint8_t *dst_id)

Detailed Description

Implementation of Gazell Pairing Library (gzp), Device functions.

Definition in file gzp_device.c.


Define Documentation

#define GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS   0

Definition at line 33 of file gzp_device.c.

#define GZP_PARAMS_DB_ELEMENT_HOST_ID   (GZP_PARAMS_DB_ELEMENT_SYSTEM_ADDRESS + GZP_SYSTEM_ADDRESS_WIDTH)

Definition at line 34 of file gzp_device.c.

#define GZP_PARAMS_DB_ELEMENT_SIZE   (GZP_SYSTEM_ADDRESS_WIDTH + GZP_HOST_ID_LENGTH)

Definition at line 35 of file gzp_device.c.

#define GZP_PARAMS_DB_MAX_ENTRIES   14

Definition at line 36 of file gzp_device.c.

#define GZP_PARAMS_DB_ADR   GZP_PARAMS_STORAGE_ADR

Definition at line 42 of file gzp_device.c.

#define GZP_PARAMS_DB_SIZE   (GZP_PARAMS_DB_MAX_ENTRIES * GZP_PARAMS_DB_ELEMENT_SIZE)

Definition at line 43 of file gzp_device.c.

#define GZP_INDEX_DB_ADR   (GZP_PARAMS_STORAGE_ADR + GZP_PARAMS_DB_SIZE)

Definition at line 45 of file gzp_device.c.

#define GZP_INDEX_DB_SIZE   (GZP_DEVICE_PARAMS_STORAGE_SIZE - GZP_PARAMS_DB_SIZE)

Definition at line 46 of file gzp_device.c.


Enumeration Type Documentation

Definition of the possible return values for the function gzp_tx_rx_transaction()

Enumerator:
GZP_TX_RX_SUCCESS 
GZP_TX_RX_FAILED_TO_SEND 
GZP_TX_RX_NO_RESPONSE 

Definition at line 61 of file gzp_device.c.


Function Documentation

void gzp_delay_rx_periods ( uint16_t  rx_periods )

Delay function. Will add a delay equal to GZLL_RX_PERIOD * rx_periods [us].

Definition at line 794 of file gzp_device.c.

{
  uint16_t i;
  
  for(i=0; i < rx_periods; i++)
  {
    delay_us(GZLL_DEFAULT_PARAM_RX_PERIOD);
  }
}
static _Bool gzp_set_host_id ( const uint8_t *  src )

Function for wriring variable holding "Host ID". Returns false if host ID could not be written.

Definition at line 544 of file gzp_device.c.

{
  memcpy(gzp_host_id, id, GZP_HOST_ID_LENGTH);
  return true;
}
_Bool gzp_get_host_id ( uint8_t *  dst )

Function reading current "Host ID". On Host, returns false if host ID not yet generated.

Definition at line 550 of file gzp_device.c.

{
  memcpy(dst_id, gzp_host_id, GZP_HOST_ID_LENGTH);
  return true;
}