coinesAPI calls: Other useful APIs¶
coines_get_millis¶
Returns the number of milliseconds passed since the program started
coines_get_micro_sec¶
Returns the number of microseconds passed since the program started
coines_attach_interrupt¶
Attaches an interrupt to a Multi-IO pin.Works only on MCU.
void coines_attach_interrupt(enum coines_multi_io_pin pin_number,void (*callback)(uint32_t, uint32_t),enum coines_pin_interrupt_mode int_mode);
Arguments:
pin_number
: Multi-IO pincallback
: Name of the function to be called on detection of interruptint_mode
: Trigger modes
change (COINES_PIN_INTERRUPT_CHANGE
),
rising edge (COINES_PIN_INTERRUPT_RISING_EDGE
),
falling edge (COINES_PIN_INTERRUPT_FALLING_EDGE
)
coines_detach_interrupt¶
Detaches interrupt from a Multi-IO pin.Works only on MCU.
coines_intf_available¶
Return the number of bytes available in the read buffer of the interface. Works only on APP3.0 MCU target.
Arguments:
intf
: Type of interface (USB, COM, or BLE)
coines_intf_connected¶
Check if the interface is connected.Works only on APP3.0 MCU target.
Arguments:
intf
: Type of interface (USB, COM, or BLE)
coines_flush_intf¶
Flush the write buffer.Works only on APP3.0 MCU target.
Arguments:
intf
: Type of interface (USB, COM, or BLE)
coines_read_intf¶
Read data over the specified interface.Works only on APP3.0 MCU target.
Arguments:
intf
: Type of interface (USB, COM, or BLE)buffer
: Pointer to the buffer to store the datalen
: Length of the buffer
coines_write_intf¶
Write data over the specified interface.Works only on APP3.0 MCU target.
Arguments:
intf
: Type of interface (USB, COM, or BLE)buffer
: Pointer to the buffer storing the datalen
: Length of the buffer
coines_get_version¶
Returns pointer to COINES version string
coines_soft_reset¶
Resets the device. After reset device jumps to the address specified in makefile(APP_START_ADDRESS).
coines_read_temp_data¶
This API is used to read the temperature sensor data.
Arguments:
temp_conv_data
: Buffer to retrieve the sensor data in degree Celsius.
coines_read_bat_status¶
This API is used to read the battery status.
Arguments:
bat_status_mv
: Buffer to retrieve the battery status in millivoltbat_status_percent
: Buffer to retrieve the battery status in percentage
coines_ble_config¶
This API is used to configure BLE name and power. It should be called before calling coines_open_comm_intf API.
Arguments:
ble_config
: structure holding ble name and power details
coines_set_led¶
This API is used to set led state(on or off).
Arguments:
led
: led to which the state has to be set.led_state
: state to be set to the given led.
coines_timer_config¶
This API is used to configure the hardware timer.
Arguments:
instance
: timer instance.handler
: callback to be called when timer expires.
coines_timer_start¶
This API is used to start the configured hardware timer.
Arguments:
instance
: timer instance.timeout
: timeout in microseconds.
coines_timer_stop¶
This API is used to stop the hardware timer.
Arguments:
instance
: timer instance.
coines_get_realtime_usec¶
This API is used to get the current counter(RTC) reference time in usec
coines_delay_realtime_usec¶
This API is used to introduce delay based on high precision RTC(LFCLK crystal) with the resolution of 30.517 usec.
Arguments:
period
: required delay in microseconds