Sens'it SDK  v2.0.0
Macros | Enumerations | Functions | Variables
sensit_api.h File Reference

Sens'it SDK user functions. More...

Go to the source code of this file.

Macros

#define SENSIT_ERR_NONE   0x00
 
#define SENSIT_ERR_MEMORY   0x01
 
#define SENSIT_ERR_RADIO_CONF   0x08
 
#define SENSIT_ERR_RADIO_NOT_INIT   0x09
 
#define SENSIT_ERR_REED_SWITCH_STATE   0x10
 
#define SENSIT_ERR_NVMEM_SIZE   0x11
 
#define SENSIT_ERR_NVMEM_INIT   0x12
 
#define SENSIT_ERR_NVMEM_WRITE   0x13
 
#define SENSIT_ERR_I2C_WRITE   0x14
 
#define SENSIT_ERR_I2C_READ   0x15
 
#define SENSIT_ERR_I2C_TIMEOUT   0x16
 
#define SENSIT_ERR_UART_STATE   0x17
 
#define SENSIT_ERR_UART_EMPTY   0x18
 
#define SENSIT_ERR_UART_FULL   0x19
 
#define SENSIT_ERR_USB_STATE   0x1A
 
#define SENSIT_ERR_USB_EMPTY   0x1B
 
#define SENSIT_ERR_USB_FULL   0x1C
 
#define SENSIT_ERR_RESET_SEQ_NB   0x1F
 
#define INTERRUPT_MASK_RTC   0b00000001
 
#define INTERRUPT_MASK_BUTTON   0b00000010
 
#define INTERRUPT_MASK_REED_SWITCH   0b00000100
 
#define INTERRUPT_MASK_FXOS8700   0b00001000
 
#define SENSOR_I2C_ADDR_HTS221   0xBE
 
#define SENSOR_I2C_ADDR_LTR329   0x52
 
#define SENSOR_I2C_ADDR_FXOS8700   0x3C
 
#define SENSIT_NV_MEM_SIZE   0x03F0
 Sens'it Non-Volatile Memory maximum size. More...
 

Enumerations

enum  radio_conf_e {
  SIGFOX_RC1 = 0, SIGFOX_RC2 = 1, SIGFOX_RC3C = 2, SIGFOX_RC4 = 3,
  RADIO_CONF_LAST
}
 List of implemented Sigfox Radio Configuration. More...
 
enum  rc_origin_e { RC_FROM_PARAMETER = 0, RC_FROM_MEMORY = 1 }
 Enum to be used in SENSIT_API_configure_radio. More...
 
enum  rgb_color_e {
  RGB_OFF = 0b000, RGB_BLUE = 0b001, RGB_GREEN = 0b010, RGB_CYAN = 0b011,
  RGB_RED = 0b100, RGB_MAGENTA = 0b101, RGB_YELLOW = 0b110, RGB_WHITE = 0b111
}
 List of possible colors for the RGB led. More...
 
enum  interrupt_e { INTERRUPT_NONE = 0b00, INTERRUPT_FALLING_EGDE = 0b01, INTERRUPT_RISING_EGDE = 0b10, INTERRUPT_BOTH_EGDE = 0b11 }
 Interupt configuration. More...
 

Functions

error_t SENSIT_API_get_sdk_version (u8 **version, u8 *size)
 Return Sens'it SDK library version, in ASCII format. More...
 
error_t SENSIT_API_configure_radio (rc_origin_e origin, radio_conf_e *rc)
 Configure the device with the selected Sigfox Radio Configuration (RC). More...
 
error_t SENSIT_API_switch_radio (bool on, rgb_color_e color)
 Switch on/off radio power. More...
 
void SENSIT_API_reset (void)
 Reset the device. More...
 
error_t SENSIT_API_sleep (bool auto_wake_up)
 Put the device in stop mode and wait for an interrupt. More...
 
error_t SENSIT_API_set_rtc_alarm (u32 interrupt_period)
 Set RTC alarm timer.
Set interrupt period to 0 to disable it. More...
 
error_t SENSIT_API_configure_button (interrupt_e config)
 Configure button interrupt. More...
 
error_t SENSIT_API_get_button_state (bool *state)
 Get the state of the button. More...
 
error_t SENSIT_API_set_rgb_led (rgb_color_e color)
 Set RGB led state. More...
 
error_t SENSIT_API_set_white_led (bool on)
 Set white led state. More...
 
error_t SENSIT_API_get_battery_level (u16 *battery_voltage)
 Do a measurement of battery voltage. More...
 
error_t SENSIT_API_get_current_time (u32 *current_time)
 Return time passed since last device reset. More...
 
error_t SENSIT_API_wait (u32 time_ms)
 Wait during 'time_ms'. More...
 
error_t SENSIT_API_configure_reed_switch (bool enable, interrupt_e config)
 Enable/disable the reed switch and configure interrupt. More...
 
error_t SENSIT_API_get_reed_switch_state (bool *state)
 Get the state of the reed switch. More...
 
error_t SENSIT_API_write_read_i2c_bus (u8 addr, u8 *buffer, u8 nbWrite, u8 nbRead)
 I2C bus driver. More...
 
error_t SENSIT_API_configure_fxos8700_interrupt (bool enable)
 Enable/Disable interrupt from Accelerometer. More...
 
error_t SENSIT_API_init_nv_mem (u16 block_length)
 Initialize Non-Volatile Memory. More...
 
error_t SENSIT_API_get_nv_mem (u8 *data)
 Read user data from non-volatile memory. More...
 
error_t SENSIT_API_set_nv_mem (u8 *data)
 Write user data in a non-volatile memory. More...
 
error_t SENSIT_API_init_watchdog (void)
 Activate the watchdog. More...
 
error_t SENSIT_API_clear_watchdog (void)
 Clear watchdog timer. More...
 
error_t SENSIT_API_init_uart (void)
 Initialize the UART communication. More...
 
error_t SENSIT_API_close_uart (void)
 Close the UART communication. More...
 
error_t SENSIT_API_send_data_to_uart (u8 *data, u8 size)
 Send a string on the UART communication. More...
 
error_t SENSIT_API_get_data_from_uart (u8 *c)
 Get a char from the UART Rx buffer. More...
 
error_t SENSIT_API_init_usb (void)
 Initialize USB communication of the device. More...
 
error_t SENSIT_API_send_data_to_usb (u8 *data, u8 size)
 Send a string on the USB communication. More...
 
error_t SENSIT_API_get_data_from_usb (u8 *c)
 Get a char from the USB Rx buffer. More...
 
error_t SENSIT_API_switch_battery_charger (bool enable)
 Function to disable battery charger in case of use of an external power supply. More...
 
error_t SENSIT_API_switch_test_mode_creedentials (bool enable)
 Switch to private/test mode credentials. More...
 
error_t SENSIT_API_reset_device_sequence_number (void)
 Reset device sequence number. More...
 

Variables

u8 firmware_version [16]
 Varible use at the device initialization to set your firmware version in the non-volatile memory. More...
 
volatile u8 pending_interrupt
 Bit array of peripherals interrupt. More...
 

Detailed Description

Sens'it SDK user functions.


Author
Sens'it Team

!!! DO NOT MODIFY THIS FILE !!!

Macro Definition Documentation

◆ SENSIT_NV_MEM_SIZE

#define SENSIT_NV_MEM_SIZE   0x03F0

Sens'it Non-Volatile Memory maximum size.


Enumeration Type Documentation

◆ radio_conf_e

List of implemented Sigfox Radio Configuration.


Enumerator
SIGFOX_RC1 

Sigfox Radio Configuration 1

SIGFOX_RC2 

Sigfox Radio Configuration 2

SIGFOX_RC3C 

Sigfox Radio Configuration 3c

SIGFOX_RC4 

Sigfox Radio Configuration 4

◆ rc_origin_e

Enum to be used in SENSIT_API_configure_radio.


Enumerator
RC_FROM_PARAMETER 

Use Radio Configuration passed as parameter

RC_FROM_MEMORY 

Use Radio Configuration set in device memory

◆ rgb_color_e

List of possible colors for the RGB led.


Enumerator
RGB_OFF 

RGB led is off

RGB_BLUE 

RGB led is blue

RGB_GREEN 

RGB led is green

RGB_CYAN 

RGB led is cyan

RGB_RED 

RGB led is red

RGB_MAGENTA 

RGB led is magenta

RGB_YELLOW 

RGB led is yellow

RGB_WHITE 

RGB led is white

◆ interrupt_e

Interupt configuration.


Enumerator
INTERRUPT_NONE 

Interrupt disable

INTERRUPT_FALLING_EGDE 

Falling edge interrupt

INTERRUPT_RISING_EGDE 

Rising edge interrupt

INTERRUPT_BOTH_EGDE 

Falling & Rising edge interrupt

Variable Documentation

◆ firmware_version

u8 firmware_version[16]

Varible use at the device initialization to set your firmware version in the non-volatile memory.


Its value is written at the address 0x08007400.

Warning
If the value of firmware_version change, the non-volatile memory will be erased.

◆ pending_interrupt

volatile u8 pending_interrupt

Bit array of peripherals interrupt.


Use INTERRUPT_MASK to know wich peripheral have a pending interrupt.