Sens'it SDK  v2.0.0
Functions
Sens'it APIs

Sens'it SDK user functions. 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...
 

Detailed Description

Sens'it SDK user functions.


Function Documentation

◆ SENSIT_API_get_sdk_version()

error_t SENSIT_API_get_sdk_version ( u8 **  version,
u8 size 
)

Return Sens'it SDK library version, in ASCII format.


Parameters
[out]versionPointer to Byte array containing version
[out]sizeSize of version buffer
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_configure_radio()

error_t SENSIT_API_configure_radio ( rc_origin_e  origin,
radio_conf_e rc 
)

Configure the device with the selected Sigfox Radio Configuration (RC).


Parameters
[in]originRadio Configuration value origin
[out]rcIf RC_FROM_MEMORY, Radio Configuration set in the device memory
[in]rcIf RC_FROM_PARAMETER, Radio Configuration to use
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_MEMORYError, device memory is corrupted
SENSIT_ERR_RADIO_CONFRadio Configuration has an invalid value

◆ SENSIT_API_switch_radio()

error_t SENSIT_API_switch_radio ( bool  on,
rgb_color_e  color 
)

Switch on/off radio power.


Parameters
[in]onTRUE to switch on radio FALSE to switch off radio
[in]colorColor of LEDs blink during transmission. Use 0xFF to have the white LED blinks.
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_RADIO_NOT_INITError, radio is not configured

◆ SENSIT_API_reset()

void SENSIT_API_reset ( void  )

Reset the device.


The device reset is signaled by 5 white led blinks.
If the button is pressed during the reset, the device will restart in bootloader.

◆ SENSIT_API_sleep()

error_t SENSIT_API_sleep ( bool  auto_wake_up)

Put the device in stop mode and wait for an interrupt.


Use pending_interrupt to know wake up source.

Parameters
[in]auto_wake_upIf TRUE, auto wake up each second
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_set_rtc_alarm()

error_t SENSIT_API_set_rtc_alarm ( u32  interrupt_period)

Set RTC alarm timer.
Set interrupt period to 0 to disable it.


Use pending_interrupt to know when timer interrupt occurs.

Parameters
[in]interrupt_periodAlarm interrupt period in s
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_configure_button()

error_t SENSIT_API_configure_button ( interrupt_e  config)

Configure button interrupt.


Parameters
[in]configInterrupt configuration
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_get_button_state()

error_t SENSIT_API_get_button_state ( bool state)

Get the state of the button.


Parameters
[out]stateIf FALSE, button is pressed. If TRUE, button is released.
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_set_rgb_led()

error_t SENSIT_API_set_rgb_led ( rgb_color_e  color)

Set RGB led state.


Parameters
[in]colorColor of the RGB led
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_set_white_led()

error_t SENSIT_API_set_white_led ( bool  on)

Set white led state.


Parameters
[in]onTRUE: led is turned on FALSE: led is turned off
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_get_battery_level()

error_t SENSIT_API_get_battery_level ( u16 battery_voltage)

Do a measurement of battery voltage.


Parameters
[out]battery_voltageBattery voltage in mV
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_get_current_time()

error_t SENSIT_API_get_current_time ( u32 current_time)

Return time passed since last device reset.


Parameters
[out]current_timeCurrent time in s
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_wait()

error_t SENSIT_API_wait ( u32  time_ms)

Wait during 'time_ms'.


Parameters
[in]time_msTime to wait in milliseconds
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_configure_reed_switch()

error_t SENSIT_API_configure_reed_switch ( bool  enable,
interrupt_e  config 
)

Enable/disable the reed switch and configure interrupt.


Parameters
[in]enableTRUE to enable reed switch
[in]configInterrupt configuration
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_get_reed_switch_state()

error_t SENSIT_API_get_reed_switch_state ( bool state)

Get the state of the reed switch.


Parameters
[out]stateIf FALSE, magnet not detected. If TRUE, magnet detected
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_REED_SWITCH_STATEReed switch is not enabled

◆ SENSIT_API_write_read_i2c_bus()

error_t SENSIT_API_write_read_i2c_bus ( u8  addr,
u8 buffer,
u8  nbWrite,
u8  nbRead 
)

I2C bus driver.


Parameters
[in]addrSensor address. Use SENSOR_I2C_ADDR values.
[in]bufferFrom buffer[0] to buffer[nbWrite-1]: Data to write
[out]bufferFrom buffer[nbWrite] to buffer[nbWrite+nbRead-1]: Read data
[in]nbWriteNumber of bytes to write
[in]nbReadNumber of bytes to read
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_I2C_WRITEFailed to write data on I2C bus
SENSIT_ERR_I2C_READFailed to read data from I2C bus
SENSIT_ERR_I2C_TIMEOUTI2C communication timeout

◆ SENSIT_API_configure_fxos8700_interrupt()

error_t SENSIT_API_configure_fxos8700_interrupt ( bool  enable)

Enable/Disable interrupt from Accelerometer.


Warning
Interrupt must be routed to INT1 pin and active low in FXOS8700 registers.
Parameters
[in]enableTRUE to enable interrupt
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_init_nv_mem()

error_t SENSIT_API_init_nv_mem ( u16  block_length)

Initialize Non-Volatile Memory.


Warning
If you change the block length, it will be impossible to get data already stored in Non-Volatile Memory.
Parameters
[in]block_lengthNon-Volatile Memory data block length
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_NVMEM_SIZEBlock length exceeds SENSIT_NV_MEM_SIZE

◆ SENSIT_API_get_nv_mem()

error_t SENSIT_API_get_nv_mem ( u8 data)

Read user data from non-volatile memory.


Data length must be defined by initializing the NVMEM with SENSIT_API_init_nv_mem

Parameters
[out]dataData read from non-volatile memory
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_NVMEM_INITNon-Volatile memory must be init first

◆ SENSIT_API_set_nv_mem()

error_t SENSIT_API_set_nv_mem ( u8 data)

Write user data in a non-volatile memory.


Data length must be defined by initializing the NVMEM with SENSIT_API_init_nv_mem

Parameters
[in]dataData to write in non-volatile memory
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_NVMEM_INITNon-Volatile memory must be init first
SENSIT_ERR_NVMEM_WRITEFailed to write data

◆ SENSIT_API_init_watchdog()

error_t SENSIT_API_init_watchdog ( void  )

Activate the watchdog.


SENSIT_API_watchdog_clear must be called at least every 26 seconds, otherwise the device will be reset.

Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_clear_watchdog()

error_t SENSIT_API_clear_watchdog ( void  )

Clear watchdog timer.


Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_init_uart()

error_t SENSIT_API_init_uart ( void  )

Initialize the UART communication.


  • Serial Link settings:
    • Data Rate: 115,200 bps
    • Parity: None
    • Bit: 8
    • Stop bit: 1
Warning
Sleep mode will be disable.
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_close_uart()

error_t SENSIT_API_close_uart ( void  )

Close the UART communication.


Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_send_data_to_uart()

error_t SENSIT_API_send_data_to_uart ( u8 data,
u8  size 
)

Send a string on the UART communication.


Parameters
[in]dataData to send
[in]sizeData size
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_UART_STATEFirst init the UART
SENSIT_ERR_UART_FULLNo more space in UART Tx buffer

◆ SENSIT_API_get_data_from_uart()

error_t SENSIT_API_get_data_from_uart ( u8 c)

Get a char from the UART Rx buffer.


Parameters
[out]cPointer on the read char
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_UART_STATEFirst init the UART
SENSIT_ERR_UART_EMPTYUART Rx buffer is empty

◆ SENSIT_API_init_usb()

error_t SENSIT_API_init_usb ( void  )

Initialize USB communication of the device.


The USB interfaces will not work if your device is in sleep mode.

  • Serial Link settings:
    • Data Rate: 115,200 bps
    • Parity: None
    • Bit: 8
    • Stop bit: 1
Warning
Sleep mode will be disable.
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_send_data_to_usb()

error_t SENSIT_API_send_data_to_usb ( u8 data,
u8  size 
)

Send a string on the USB communication.


Parameters
[in]dataData to send
[in]sizeData size
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_USB_STATEFirst init the USB

◆ SENSIT_API_get_data_from_usb()

error_t SENSIT_API_get_data_from_usb ( u8 c)

Get a char from the USB Rx buffer.


Parameters
[out]cPointer on the read character
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_USB_STATEFirst init the USB
SENSIT_ERR_USB_EMPTYUSB Rx buffer empty

◆ SENSIT_API_switch_battery_charger()

error_t SENSIT_API_switch_battery_charger ( bool  enable)

Function to disable battery charger in case of use of an external power supply.


Parameters
[in]enableTRUE to enable battery charger FALSE to disable battery charger
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_switch_test_mode_creedentials()

error_t SENSIT_API_switch_test_mode_creedentials ( bool  enable)

Switch to private/test mode credentials.


Test mode credentials are used for Sigfox API test functions & Sigfox Verified Addon.
Test mode ID = 0xFEDCBA98
TEST mode key = 0x0123456789ABCDEF0123456789ABCDEF

Warning
You will no longer be received by the network when using the test mode credentials.
Parameters
[in]enableTRUE to enable test mode credentials
Return values
SENSIT_ERR_NONENo error

◆ SENSIT_API_reset_device_sequence_number()

error_t SENSIT_API_reset_device_sequence_number ( void  )

Reset device sequence number.


This fucntion can be use when you have an error during the save of sequence number (SFX_ERR_INT_EXECUTE_COM_SEQUENCE_NVM_STORAGE_MESSAGE).

Warning
If you reset the sequence number, you will need to "Disengage sequence number" on the Sigfox Cloud to continue to receive your messages.
Return values
SENSIT_ERR_NONENo error
SENSIT_ERR_RESET_SEQ_NBFailed to reset device sequence number.