IRPyro API  (sKEMLIB1)
Collection of routines and data structures covering the functionality of the IRPyro sensor
IRPyro_API_single_device_layer.c File Reference

IRPyro Application interface functions implementation. More...

Include dependency graph for IRPyro_API_single_device_layer.c:

Go to the source code of this file.

Data Structures

struct  notice
 Checksum string for the IRPyro API. More...
 

Macros

#define AFE_INIT_DEFAULT(X)
 
#define CCP_INIT_DEFAULT(X)
 
#define IRPyro_ADDR_WRITE   0x1E
 
#define IRPyro_AFE_READ   0x12
 
#define IRPyro_AFE_SIZE   2
 
#define IRPyro_AFE_WRITE   0x14
 
#define IRPyro_BYTES_FRAME_COUNT   2
 
#define IRPyro_BYTES_PER_CHANNEL   3
 
#define IRPyro_CCP_READ   0x0E
 
#define IRPyro_CCP_SIZE   5
 
#define IRPyro_CCP_WRITE   0x10
 
#define IRPyro_CHANNEL_DATA   0x7FFFFF
 
#define IRPyro_CHANNEL_SAT   0X800000
 
#define IRPyro_DATA_SIZE   17
 
#define IRPyro_DEFAULT_I2C   0x65
 
#define IRPyro_FIFO_CLEAR   0x0A
 
#define IRPyro_FIFO_CLEAR_ERR   0X2A
 
#define IRPyro_FIFO_CLEAR_OK   0X29
 
#define IRPyro_FIFO_COUNT_MASK   0X1E
 
#define IRPyro_FIFO_ERROR_I2C_EARLY   0X02
 
#define IRPyro_FIFO_ERROR_I2C_EXTRA   0X03
 
#define IRPyro_FIFO_ERROR_MASK   0X60
 
#define IRPyro_FIFO_ERROR_OK   0X00
 
#define IRPyro_FIFO_ERROR_WRITE_FULL   0X01
 
#define IRPyro_FIFO_INT_MASK   0X01
 
#define IRPyro_FIFO_NO_FRAMES   14
 
#define IRPyro_FIFO_READ_ACTIVE   0x08
 
#define IRPyro_FIFO_READ_FULL   0x06
 
#define IRPyro_FIFO_RESET   0x0C
 
#define IRPyro_FIFO_RESET_ERR   0X32
 
#define IRPyro_FIFO_RESET_OK   0X31
 
#define IRPyro_FIFO_STATUS   0x04
 
#define IRPyro_FIFO_STATUS_SIZE   1
 
#define IRPyro_FIFO_WAKE_MASK   0X80
 
#define IRPyro_FRAME_COUNT_LOCATION   5
 
#define IRPyro_FRAME_COUNT_LOW_BYTE   1
 
#define IRPyro_FRAME_COUNT_TOP_BYTE   2
 
#define IRPyro_GO_TO_SLEEP   0x20
 
#define IRPyro_GO_TO_SLEEP_ERR   0X82
 
#define IRPyro_GO_TO_SLEEP_OK   0X81
 
#define IRPyro_MAX_FRAME_COUNT   0xFFFF
 
#define IRPyro_RESET_FULL   0x26
 
#define IRPyro_RESET_FULL_ERR   0X9A
 
#define IRPyro_RESET_FULL_OK   0X99
 
#define IRPyro_RESET_SOFT   0x24
 
#define IRPyro_RESET_SOFT_ERR   0X92
 
#define IRPyro_RESET_SOFT_OK   0X91
 
#define IRPyro_SHIFT_FOUR   4
 
#define IRPyro_SHIFT_ONE   1
 
#define IRPyro_SHIFT_TO_MSB   8
 
#define IRPyro_TEST   0x00
 
#define IRPyro_TEST_ERR   0x02
 
#define IRPyro_TEST_OK   0x01
 
#define IRPyro_VERSION   0x02
 
#define IRPyro_WAKE_UP   0x22
 
#define IRPyro_WAKE_UP_ERR   0X8A
 
#define IRPyro_WAKE_UP_OK   0X89
 
#define IRPyro_WUP_READ   0x16
 
#define IRPyro_WUP_SIZE   6
 
#define IRPyro_WUP_WRITE   0x18
 
#define LOW_POWER_INIT_DEFAULT(X)
 
#define NORMAL_POWER_INIT_DEFAULT(X)
 
#define WUP_INIT_DEFAULT(X)
 

Functions

static uint8_t AFE_init (IRPyro_sensor_device_type *this_device)
 Initializes the AFE register with this_device values. More...
 
static uint8_t AFE_read (IRPyro_sensor_device_type *this_device, AFE_reg_type *AFE_data)
 reads the AFE register on the IRPyro and loads into this_device More...
 
static uint8_t AFE_register_empty (AFE_reg_type first)
 Checks if the AFE register is empty. More...
 
static void AFE_to_bytes (AFE_reg_type AFE_register, uint8_t *AFE_byte)
 encodes the AFE register contents of this_device into the IRPyro More...
 
static uint8_t AFE_write (IRPyro_sensor_device_type *this_device)
 writes the AFE register contents of this_device into the IRPyro More...
 
static void bytes_to_AFE (uint8_t *AFE_bytes, AFE_reg_type *AFE_register)
 decodes the AFE register of the IRPyro into this_device More...
 
static void bytes_to_CCP (uint8_t CCP_byte, CCP_reg_type *CCP_register)
 decodes the CCP register of the IRPyro into this_device More...
 
static void bytes_to_WUP (uint8_t *WUP_bytes, WUP_reg_type *WUP_register)
 decodes the WUP register of the IRPyro into this_device More...
 
static uint8_t CCP_init (IRPyro_sensor_device_type *this_device)
 Initializes the CCP register with this_device values. More...
 
static uint8_t CCP_read (IRPyro_sensor_device_type *this_device, CCP_reg_type *CCP_data)
 reads the CCP registers on the IRPyro and loads into this_device More...
 
static uint8_t CCP_register_empty (CCP_reg_type first)
 Checks if the CCP register is empty. More...
 
static void CCP_to_bytes (CCP_reg_type CCP_register, uint8_t *CCP_byte)
 encodes the CCP register contents of this_device into IRPyro More...
 
static uint8_t CCP_write (IRPyro_sensor_device_type *this_device)
 writes the CCP registers contents of this_device into the IRPyro More...
 
static uint8_t channel_value_decode (IRPyro_sensor_device_type *this_device)
 Decodes the channel values on a given frame. More...
 
static uint8_t FIFO_data_active_get (IRPyro_sensor_device_type *this_device)
 Read data packet (up to 17 bytes) for only active channel. More...
 
static uint8_t FIFO_ready_status_get (IRPyro_sensor_device_type *this_device)
 Ask the IRPyro if a frame of data is available used when a polling reading operation has started. More...
 
static uint8_t FIFO_reset (IRPyro_sensor_device_type *this_device)
 Clear the entire FIFO (Rd/Wr pointer reset with the Empty) More...
 
static uint8_t I2C_address_set (IRPyro_sensor_device_type *this_device)
 Sends new I2C address to the IRPyro sensor Default i2c address is 0x65, if multiple devices are being used care needs to be taken when writing new i2c addresses by switching off other devices with the same address. More...
 
static struct notice IRPyro_checksum (void)
 
uint8_t IRPyro_close (IRPyro_sensor_device_type *this_device)
 Stops streaming, deallocates memory and disable the IRPyro sensor. More...
 
uint8_t IRPyro_ioctl (IRPyro_sensor_device_type *this_device, IRPyro_cmd_type *cmd, IRPyro_arg_type arg)
 access to IRPyro registers More...
 
uint8_t IRPyro_open (IRPyro_sensor_device_type *this_device)
 Initializes the IRPyro device. More...
 
static uint8_t IRPyro_power_mode_low_set (IRPyro_sensor_device_type *this_device)
 activates the low power mode settings stored on the IRPyro structure More...
 
static uint8_t IRPyro_power_mode_normal_set (IRPyro_sensor_device_type *this_device)
 activates the normal power mode settings stored on the IRPyro structure More...
 
static uint8_t IRPyro_power_mode_sleep_set (IRPyro_sensor_device_type *this_device)
 The device will automatically enter either low power or normal power sleep mode depending in the power state the device is in when it is put to sleep. The WUP register contains the settings for either sleep mode. More...
 
static uint8_t IRPyro_power_mode_wakeup_set (IRPyro_sensor_device_type *this_device)
 The device will automatically enter either low power or normal power sleep mode depending in the power state the device is in when it is put to sleep. The WUP register contains the settings for either sleep mode. More...
 
static uint8_t IRPyro_power_settings_init (IRPyro_sensor_device_type *this_device)
 initializes with defaults the power settings of an IRPyro device More...
 
uint8_t IRPyro_read (IRPyro_sensor_device_type *this_device)
 Reads a frame of data from the IRPyro. More...
 
static uint8_t IRPyro_test (IRPyro_sensor_device_type *this_device)
 Sends test code to the IRPyro sensor to confirm is there. More...
 
static uint8_t WUP_init (IRPyro_sensor_device_type *this_device)
 Initializes the WUP register with this_device values. More...
 
static uint8_t WUP_read (IRPyro_sensor_device_type *this_device, WUP_reg_type *WUP_data)
 reads the WUP register on the IRPyro and loads into this_device More...
 
static uint8_t WUP_register_empty (WUP_reg_type first)
 Checks if the AFE register is empty. More...
 
static void WUP_to_bytes (WUP_reg_type WUP_register, uint8_t *WUP_byte)
 encodes the WUP register contents of this_device into the IRPyro More...
 
static uint8_t WUP_write (IRPyro_sensor_device_type *this_device)
 writes the WUP register contents of this_device into the IRPyro More...
 

Detailed Description

IRPyro Application interface functions implementation.

Author
_KEMET Ltd.
Date
March 2018
Version
Release 1.0.6
Attention

© COPYRIGHT 2018 _KEMET, Ltd

    Copyright (c) 2018, _KEMET, Ltd
    All rights reserved.

    THIS SOFTWARE IS PROVIDED BY _KEMET, Ltd ''AS IS'' AND ANY
    EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
    WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
    DISCLAIMED. IN NO EVENT SHALL _KEMET, Ltd BE LIABLE FOR ANY
    DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
    (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
    ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
    (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
    SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Definition in file IRPyro_API_single_device_layer.c.