si114x_sys_out.c File Reference

Implementation specific functions for HRM code.

License

Copyright 2018 Silicon Laboratories Inc. www.silabs.com

SPDX-License-Identifier: Zlib

The licensor of this software is Silicon Laboratories Inc.

This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for any damages arising from the use of this software.

Permission is granted to anyone to use this software for any purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions:

  1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment in the product documentation would be appreciated but is not required.
  2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
  3. This notice may not be removed or altered from any source distribution.

Definition in file si114x_sys_out.c.

#include <stdio.h>
#include "i2cspm.h"
#include "em_i2c.h"
#include "em_gpio.h"
#include "string.h"
#include "em_usb.h"
#include "sl_sleeptimer.h"
#include "si114x_functions.h"
#include "si114x_sys_out.h"
#include "si114xhrm.h"

Macros

#define IRQ_QUEUE_SIZE   270
 

Functions

void delay_10ms (void)
 10ms delay required by Si114x reset sequence.
 
void delay_1ms (void)
 1ms delay required by Si114x polling sequence.
 
void DisableSi114xInterrupt ()
 Disable GPIO interrupt for Si114x interrupt.
 
void EnableSi114xInterrupt ()
 Enable GPIO interrupt for Si114x.
 
static s16 Si114x_i2c_smbus_read_byte_data (HANDLE si114x_handle, u8 address, u8 *data, bool block)
 Read from Si114x i2c.
 
static s16 Si114x_i2c_smbus_read_i2c_block_data (HANDLE si114x_handle, u8 address, u8 length, u8 *data, bool block)
 Read block of data from Si114x i2c.
 
static s16 Si114x_i2c_smbus_write_byte_data (HANDLE si114x_handle, u8 address, u8 data, bool block)
 Write to Si114x i2c.
 
static s16 Si114x_i2c_smbus_write_i2c_block_data (HANDLE si114x_handle, u8 address, u8 length, u8 const *data, bool block)
 Write block of data to Si114x i2c.
 
int16_t Si114xBlockRead (HANDLE si114x_handle, uint8_t address, uint8_t length, uint8_t *values)
 Block read from Si114x.
 
int16_t Si114xBlockWrite (HANDLE si114x_handle, uint8_t address, uint8_t length, uint8_t *values)
 block write to si114x
 
s16 Si114xClose (HANDLE si114x_handle)
 Close Si114x.
 
int si114xFindEvb (char *port_description, char *last_port, int num_ports_found)
 
s16 Si114xInit (void *port, int options, HANDLE *si114x_handle)
 Initialize low level handle and clear irq queue.
 
s16 Si114xIrqQueue_Clear (HANDLE si114x_handle)
 Empty the interrupt queue.
 
s16 Si114xIrqQueue_Get (HANDLE si114x_handle, SI114X_IRQ_SAMPLE *samples)
 Get sample from the interrupt queue.
 
static s16 Si114xIrqQueue_Put (SI114X_IRQ_SAMPLE *samples)
 Put new sample in the interrupt queue.
 
s16 Si114xIrqQueueNumentries (HANDLE si114x_handle)
 Query number of entries in the interrupt queue.
 
int si114xOutputDebugMessage (HANDLE si114x_handle, char *message)
 Prints USB debug output.
 
s16 Si114xProcessIrq (HANDLE si114x_handle, u16 timestamp)
 Main interrupt processing routine for Si114x.
 
int16_t Si114xReadFromRegister (HANDLE si114x_handle, uint8_t address)
 Read from Si114x register.
 
int si114xSetupDebug (HANDLE si114x_handle, void *si114x_debug)
 Enables/Disables USB debug output.
 
s16 Si114xSysReset (HANDLE si114x_handle)
 Reset not implemented.
 
int16_t Si114xWriteToRegister (HANDLE si114x_handle, uint8_t address, uint8_t data)
 Write to Si114x register.
 

Variables

static Si114xPortConfig_t _handle
 
static u8 IrqQueue [IRQ_QUEUE_SIZE]
 
static u16 irqQueueGetIndex = 0
 
static u16 irqQueuePutIndex = 0
 
static uint16_t irqSequence = 0
 
static bool usbDebugEnable