Da Vinci Firmware 1
Firmware for the DaVinci-M rocket avionics board.
Loading...
Searching...
No Matches

This section group all the functions concerning data generation. More...

Collaboration diagram for "Data Generation":

Functions

int32_t lis2mdl_mag_user_offset_set (const stmdev_ctx_t *ctx, int16_t *val)
 These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.[set].
 
int32_t lis2mdl_mag_user_offset_get (const stmdev_ctx_t *ctx, int16_t *val)
 These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.[get].
 
int32_t lis2mdl_operating_mode_set (const stmdev_ctx_t *ctx, lis2mdl_md_t val)
 Operating mode selection.[set].
 
int32_t lis2mdl_operating_mode_get (const stmdev_ctx_t *ctx, lis2mdl_md_t *val)
 Operating mode selection.[get].
 
int32_t lis2mdl_data_rate_set (const stmdev_ctx_t *ctx, lis2mdl_odr_t val)
 Output data rate selection.[set].
 
int32_t lis2mdl_data_rate_get (const stmdev_ctx_t *ctx, lis2mdl_odr_t *val)
 Output data rate selection.[get].
 
int32_t lis2mdl_power_mode_set (const stmdev_ctx_t *ctx, lis2mdl_lp_t val)
 Enables high-resolution/low-power mode.[set].
 
int32_t lis2mdl_power_mode_get (const stmdev_ctx_t *ctx, lis2mdl_lp_t *val)
 Enables high-resolution/low-power mode.[get].
 
int32_t lis2mdl_offset_temp_comp_set (const stmdev_ctx_t *ctx, uint8_t val)
 Enables the magnetometer temperature compensation.[set].
 
int32_t lis2mdl_offset_temp_comp_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Enables the magnetometer temperature compensation.[get].
 
int32_t lis2mdl_low_pass_bandwidth_set (const stmdev_ctx_t *ctx, lis2mdl_lpf_t val)
 Low-pass bandwidth selection.[set].
 
int32_t lis2mdl_low_pass_bandwidth_get (const stmdev_ctx_t *ctx, lis2mdl_lpf_t *val)
 Low-pass bandwidth selection.[get].
 
int32_t lis2mdl_set_rst_mode_set (const stmdev_ctx_t *ctx, lis2mdl_set_rst_t val)
 Reset mode.[set].
 
int32_t lis2mdl_set_rst_mode_get (const stmdev_ctx_t *ctx, lis2mdl_set_rst_t *val)
 Reset mode.[get].
 
int32_t lis2mdl_set_rst_sensor_single_set (const stmdev_ctx_t *ctx, uint8_t val)
 Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.[set].
 
int32_t lis2mdl_set_rst_sensor_single_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.[get].
 
int32_t lis2mdl_block_data_update_set (const stmdev_ctx_t *ctx, uint8_t val)
 Blockdataupdate.[set].
 
int32_t lis2mdl_block_data_update_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Blockdataupdate.[get].
 
int32_t lis2mdl_mag_data_ready_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Magnetic set of data available.[get].
 
int32_t lis2mdl_mag_data_ovr_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Magnetic set of data overrun.[get].
 
int32_t lis2mdl_magnetic_raw_get (const stmdev_ctx_t *ctx, int16_t *val)
 Magnetic output value.[get].
 
int32_t lis2mdl_temperature_raw_get (const stmdev_ctx_t *ctx, int16_t *val)
 Temperature output value.[get].
 

Detailed Description

This section group all the functions concerning data generation.

Function Documentation

◆ lis2mdl_block_data_update_get()

int32_t lis2mdl_block_data_update_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Blockdataupdate.[get].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of bdu in reg CFG_REG_C.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 646 of file lis2mdl_reg.c.

647{
649 int32_t ret;
650
651 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
652 *val = reg.bdu;
653
654 return ret;
655}
int32_t __weak lis2mdl_read_reg(const stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Read generic device register.
Definition lis2mdl_reg.c:66
#define LIS2MDL_CFG_REG_C

References lis2mdl_cfg_reg_c_t::bdu, LIS2MDL_CFG_REG_C, and lis2mdl_read_reg().

Here is the call graph for this function:

◆ lis2mdl_block_data_update_set()

int32_t lis2mdl_block_data_update_set ( const stmdev_ctx_t ctx,
uint8_t  val 
)

Blockdataupdate.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of bdu in reg CFG_REG_C
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 622 of file lis2mdl_reg.c.

623{
625 int32_t ret;
626
627 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
628
629 if (ret == 0)
630 {
631 reg.bdu = val;
632 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
633 }
634
635 return ret;
636}
int32_t __weak lis2mdl_write_reg(const stmdev_ctx_t *ctx, uint8_t reg, uint8_t *data, uint16_t len)
Write generic device register.
Definition lis2mdl_reg.c:92

References lis2mdl_cfg_reg_c_t::bdu, LIS2MDL_CFG_REG_C, lis2mdl_read_reg(), and lis2mdl_write_reg().

Here is the call graph for this function:

◆ lis2mdl_data_rate_get()

int32_t lis2mdl_data_rate_get ( const stmdev_ctx_t ctx,
lis2mdl_odr_t val 
)

Output data rate selection.[get].

Parameters
ctxread / write interface definitions.(ptr)
valGet the values of odr in reg CFG_REG_A.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 306 of file lis2mdl_reg.c.

307{
309 int32_t ret;
310
311 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
312
313 switch (reg.odr)
314 {
315 case LIS2MDL_ODR_10Hz:
316 *val = LIS2MDL_ODR_10Hz;
317 break;
318
319 case LIS2MDL_ODR_20Hz:
320 *val = LIS2MDL_ODR_20Hz;
321 break;
322
323 case LIS2MDL_ODR_50Hz:
324 *val = LIS2MDL_ODR_50Hz;
325 break;
326
328 *val = LIS2MDL_ODR_100Hz;
329 break;
330
331 default:
332 *val = LIS2MDL_ODR_10Hz;
333 break;
334 }
335
336 return ret;
337}
#define LIS2MDL_CFG_REG_A
@ LIS2MDL_ODR_100Hz
@ LIS2MDL_ODR_50Hz
@ LIS2MDL_ODR_10Hz
@ LIS2MDL_ODR_20Hz

References LIS2MDL_CFG_REG_A, LIS2MDL_ODR_100Hz, LIS2MDL_ODR_10Hz, LIS2MDL_ODR_20Hz, LIS2MDL_ODR_50Hz, lis2mdl_read_reg(), and lis2mdl_cfg_reg_a_t::odr.

Here is the call graph for this function:

◆ lis2mdl_data_rate_set()

int32_t lis2mdl_data_rate_set ( const stmdev_ctx_t ctx,
lis2mdl_odr_t  val 
)

Output data rate selection.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of odr in reg CFG_REG_A
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 282 of file lis2mdl_reg.c.

283{
285 int32_t ret;
286
287 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
288
289 if (ret == 0)
290 {
291 reg.odr = (uint8_t)val;
292 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
293 }
294
295 return ret;
296}

References LIS2MDL_CFG_REG_A, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_a_t::odr.

Here is the call graph for this function:

◆ lis2mdl_low_pass_bandwidth_get()

int32_t lis2mdl_low_pass_bandwidth_get ( const stmdev_ctx_t ctx,
lis2mdl_lpf_t val 
)

Low-pass bandwidth selection.[get].

Parameters
ctxread / write interface definitions.(ptr)
valGet the values of lpf in reg CFG_REG_B.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 472 of file lis2mdl_reg.c.

474{
476 int32_t ret;
477
478 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
479
480 switch (reg.lpf)
481 {
483 *val = LIS2MDL_ODR_DIV_2;
484 break;
485
487 *val = LIS2MDL_ODR_DIV_4;
488 break;
489
490 default:
491 *val = LIS2MDL_ODR_DIV_2;
492 break;
493 }
494
495 return ret;
496}
#define LIS2MDL_CFG_REG_B
@ LIS2MDL_ODR_DIV_4
@ LIS2MDL_ODR_DIV_2

References LIS2MDL_CFG_REG_B, LIS2MDL_ODR_DIV_2, LIS2MDL_ODR_DIV_4, lis2mdl_read_reg(), and lis2mdl_cfg_reg_b_t::lpf.

Here is the call graph for this function:

◆ lis2mdl_low_pass_bandwidth_set()

int32_t lis2mdl_low_pass_bandwidth_set ( const stmdev_ctx_t ctx,
lis2mdl_lpf_t  val 
)

Low-pass bandwidth selection.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of lpf in reg CFG_REG_B
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 447 of file lis2mdl_reg.c.

449{
451 int32_t ret;
452
453 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
454
455 if (ret == 0)
456 {
457 reg.lpf = (uint8_t)val;
458 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
459 }
460
461 return ret;
462}

References LIS2MDL_CFG_REG_B, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_b_t::lpf.

Here is the call graph for this function:

◆ lis2mdl_mag_data_ovr_get()

int32_t lis2mdl_mag_data_ovr_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Magnetic set of data overrun.[get].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of zyxor in reg STATUS_REG.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 684 of file lis2mdl_reg.c.

685{
687 int32_t ret;
688
689 ret = lis2mdl_read_reg(ctx, LIS2MDL_STATUS_REG, (uint8_t *)&reg, 1);
690 *val = reg.zyxor;
691
692 return ret;
693}
#define LIS2MDL_STATUS_REG

References lis2mdl_read_reg(), LIS2MDL_STATUS_REG, and lis2mdl_status_reg_t::zyxor.

Here is the call graph for this function:

◆ lis2mdl_mag_data_ready_get()

int32_t lis2mdl_mag_data_ready_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Magnetic set of data available.[get].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of zyxda in reg STATUS_REG.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 665 of file lis2mdl_reg.c.

666{
668 int32_t ret;
669
670 ret = lis2mdl_read_reg(ctx, LIS2MDL_STATUS_REG, (uint8_t *)&reg, 1);
671 *val = reg.zyxda;
672
673 return ret;
674}

References lis2mdl_read_reg(), LIS2MDL_STATUS_REG, and lis2mdl_status_reg_t::zyxda.

Here is the call graph for this function:

◆ lis2mdl_mag_user_offset_get()

int32_t lis2mdl_mag_user_offset_get ( const stmdev_ctx_t ctx,
int16_t *  val 
)

These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.[get].

Parameters
ctxread / write interface definitions.(ptr)
buffthat stores data read
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 195 of file lis2mdl_reg.c.

196{
197 uint8_t buff[6];
198 int32_t ret;
199
200 ret = lis2mdl_read_reg(ctx, LIS2MDL_OFFSET_X_REG_L, buff, 6);
201 val[0] = (int16_t)buff[1];
202 val[0] = (val[0] * 256) + (int16_t)buff[0];
203 val[1] = (int16_t)buff[3];
204 val[1] = (val[1] * 256) + (int16_t)buff[2];
205 val[2] = (int16_t)buff[5];
206 val[2] = (val[2] * 256) + (int16_t)buff[4];
207
208 return ret;
209}
#define LIS2MDL_OFFSET_X_REG_L

References LIS2MDL_OFFSET_X_REG_L, and lis2mdl_read_reg().

Here is the call graph for this function:

◆ lis2mdl_mag_user_offset_set()

int32_t lis2mdl_mag_user_offset_set ( const stmdev_ctx_t ctx,
int16_t *  val 
)

These registers comprise a 3 group of 16-bit number and represent hard-iron offset in order to compensate environmental effects. Data format is the same of output data raw: two’s complement with 1LSb = 1.5mG. These values act on the magnetic output data value in order to delete the environmental offset.[set].

Parameters
ctxread / write interface definitions.(ptr)
buffbuffer that contains data to write
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 167 of file lis2mdl_reg.c.

168{
169 uint8_t buff[6];
170 int32_t ret;
171
172 buff[1] = (uint8_t)((uint16_t)val[0] / 256U);
173 buff[0] = (uint8_t)((uint16_t)val[0] - (buff[1] * 256U));
174 buff[3] = (uint8_t)((uint16_t)val[1] / 256U);
175 buff[2] = (uint8_t)((uint16_t)val[1] - (buff[3] * 256U));
176 buff[5] = (uint8_t)((uint16_t)val[2] / 256U);
177 buff[4] = (uint8_t)((uint16_t)val[2] - (buff[5] * 256U));
178 ret = lis2mdl_write_reg(ctx, LIS2MDL_OFFSET_X_REG_L, buff, 6);
179
180 return ret;
181}

References LIS2MDL_OFFSET_X_REG_L, and lis2mdl_write_reg().

Here is the call graph for this function:

◆ lis2mdl_magnetic_raw_get()

int32_t lis2mdl_magnetic_raw_get ( const stmdev_ctx_t ctx,
int16_t *  val 
)

Magnetic output value.[get].

Parameters
ctxread / write interface definitions.(ptr)
buffthat stores data read
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 703 of file lis2mdl_reg.c.

704{
705 uint8_t buff[6];
706 int32_t ret;
707
708 ret = lis2mdl_read_reg(ctx, LIS2MDL_OUTX_L_REG, buff, 6);
709 val[0] = (int16_t)buff[1];
710 val[0] = (val[0] * 256) + (int16_t)buff[0];
711 val[1] = (int16_t)buff[3];
712 val[1] = (val[1] * 256) + (int16_t)buff[2];
713 val[2] = (int16_t)buff[5];
714 val[2] = (val[2] * 256) + (int16_t)buff[4];
715
716 return ret;
717}
#define LIS2MDL_OUTX_L_REG

References LIS2MDL_OUTX_L_REG, and lis2mdl_read_reg().

Here is the call graph for this function:

◆ lis2mdl_offset_temp_comp_get()

int32_t lis2mdl_offset_temp_comp_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Enables the magnetometer temperature compensation.[get].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of comp_temp_en in reg CFG_REG_A.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 428 of file lis2mdl_reg.c.

429{
431 int32_t ret;
432
433 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
434 *val = reg.comp_temp_en;
435
436 return ret;
437}

References lis2mdl_cfg_reg_a_t::comp_temp_en, LIS2MDL_CFG_REG_A, and lis2mdl_read_reg().

Here is the call graph for this function:

◆ lis2mdl_offset_temp_comp_set()

int32_t lis2mdl_offset_temp_comp_set ( const stmdev_ctx_t ctx,
uint8_t  val 
)

Enables the magnetometer temperature compensation.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of comp_temp_en in reg CFG_REG_A
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 404 of file lis2mdl_reg.c.

405{
407 int32_t ret;
408
409 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
410
411 if (ret == 0)
412 {
413 reg.comp_temp_en = val;
414 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
415 }
416
417 return ret;
418}

References lis2mdl_cfg_reg_a_t::comp_temp_en, LIS2MDL_CFG_REG_A, lis2mdl_read_reg(), and lis2mdl_write_reg().

Here is the call graph for this function:

◆ lis2mdl_operating_mode_get()

int32_t lis2mdl_operating_mode_get ( const stmdev_ctx_t ctx,
lis2mdl_md_t val 
)

Operating mode selection.[get].

Parameters
ctxread / write interface definitions.(ptr)
valGet the values of md in reg CFG_REG_A.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 244 of file lis2mdl_reg.c.

246{
248 int32_t ret;
249
250 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
251
252 switch (reg.md)
253 {
255 *val = LIS2MDL_POWER_DOWN;
256 break;
257
260 break;
261
264 break;
265
266 default:
267 *val = LIS2MDL_POWER_DOWN;
268 break;
269 }
270
271 return ret;
272}
@ LIS2MDL_POWER_DOWN
@ LIS2MDL_CONTINUOUS_MODE
@ LIS2MDL_SINGLE_TRIGGER

References LIS2MDL_CFG_REG_A, LIS2MDL_CONTINUOUS_MODE, LIS2MDL_POWER_DOWN, lis2mdl_read_reg(), LIS2MDL_SINGLE_TRIGGER, and lis2mdl_cfg_reg_a_t::md.

Here is the call graph for this function:

◆ lis2mdl_operating_mode_set()

int32_t lis2mdl_operating_mode_set ( const stmdev_ctx_t ctx,
lis2mdl_md_t  val 
)

Operating mode selection.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of md in reg CFG_REG_A
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 219 of file lis2mdl_reg.c.

221{
223 int32_t ret;
224
225 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
226
227 if (ret == 0)
228 {
229 reg.md = (uint8_t)val;
230 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
231 }
232
233 return ret;
234}

References LIS2MDL_CFG_REG_A, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_a_t::md.

Here is the call graph for this function:

◆ lis2mdl_power_mode_get()

int32_t lis2mdl_power_mode_get ( const stmdev_ctx_t ctx,
lis2mdl_lp_t val 
)

Enables high-resolution/low-power mode.[get].

Parameters
ctxread / write interface definitions.(ptr)
valGet the values of lp in reg CFG_REG_A.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 371 of file lis2mdl_reg.c.

372{
374 int32_t ret;
375
376 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
377
378 switch (reg.lp)
379 {
382 break;
383
385 *val = LIS2MDL_LOW_POWER;
386 break;
387
388 default:
390 break;
391 }
392
393 return ret;
394}
@ LIS2MDL_LOW_POWER
@ LIS2MDL_HIGH_RESOLUTION

References LIS2MDL_CFG_REG_A, LIS2MDL_HIGH_RESOLUTION, LIS2MDL_LOW_POWER, lis2mdl_read_reg(), and lis2mdl_cfg_reg_a_t::lp.

Here is the call graph for this function:

◆ lis2mdl_power_mode_set()

int32_t lis2mdl_power_mode_set ( const stmdev_ctx_t ctx,
lis2mdl_lp_t  val 
)

Enables high-resolution/low-power mode.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of lp in reg CFG_REG_A
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 347 of file lis2mdl_reg.c.

348{
350 int32_t ret;
351
352 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
353
354 if (ret == 0)
355 {
356 reg.lp = (uint8_t)val;
357 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
358 }
359
360 return ret;
361}

References LIS2MDL_CFG_REG_A, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_a_t::lp.

Here is the call graph for this function:

◆ lis2mdl_set_rst_mode_get()

int32_t lis2mdl_set_rst_mode_get ( const stmdev_ctx_t ctx,
lis2mdl_set_rst_t val 
)

Reset mode.[get].

Parameters
ctxread / write interface definitions.(ptr)
valGet the values of set_rst in reg CFG_REG_B.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 531 of file lis2mdl_reg.c.

533{
535 int32_t ret;
536
537 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
538
539 switch (reg.set_rst)
540 {
543 break;
544
547 break;
548
551 break;
552
553 default:
555 break;
556 }
557
558 return ret;
559}
@ LIS2MDL_SET_SENS_ODR_DIV_63
@ LIS2MDL_SET_SENS_ONLY_AT_POWER_ON
@ LIS2MDL_SENS_OFF_CANC_EVERY_ODR

References LIS2MDL_CFG_REG_B, lis2mdl_read_reg(), LIS2MDL_SENS_OFF_CANC_EVERY_ODR, LIS2MDL_SET_SENS_ODR_DIV_63, LIS2MDL_SET_SENS_ONLY_AT_POWER_ON, and lis2mdl_cfg_reg_b_t::set_rst.

Here is the call graph for this function:

◆ lis2mdl_set_rst_mode_set()

int32_t lis2mdl_set_rst_mode_set ( const stmdev_ctx_t ctx,
lis2mdl_set_rst_t  val 
)

Reset mode.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of set_rst in reg CFG_REG_B
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 506 of file lis2mdl_reg.c.

508{
510 int32_t ret;
511
512 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
513
514 if (ret == 0)
515 {
516 reg.set_rst = (uint8_t)val;
517 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
518 }
519
520 return ret;
521}

References LIS2MDL_CFG_REG_B, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_b_t::set_rst.

Here is the call graph for this function:

◆ lis2mdl_set_rst_sensor_single_get()

int32_t lis2mdl_set_rst_sensor_single_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.[get].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of off_canc_one_shot in reg CFG_REG_B.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 602 of file lis2mdl_reg.c.

604{
606 int32_t ret;
607
608 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
609 *val = reg.off_canc_one_shot;
610
611 return ret;
612}

References LIS2MDL_CFG_REG_B, lis2mdl_read_reg(), and lis2mdl_cfg_reg_b_t::off_canc_one_shot.

Here is the call graph for this function:

◆ lis2mdl_set_rst_sensor_single_set()

int32_t lis2mdl_set_rst_sensor_single_set ( const stmdev_ctx_t ctx,
uint8_t  val 
)

Enables offset cancellation in single measurement mode. The OFF_CANC bit must be set to 1 when enabling offset cancellation in single measurement mode this means a call function: set_rst_mode(SENS_OFF_CANC_EVERY_ODR) is need.[set].

Parameters
ctxread / write interface definitions.(ptr)
valchange the values of off_canc_one_shot in reg CFG_REG_B
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 573 of file lis2mdl_reg.c.

575{
577 int32_t ret;
578
579 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
580
581 if (ret == 0)
582 {
583 reg.off_canc_one_shot = val;
584 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_B, (uint8_t *)&reg, 1);
585 }
586
587 return ret;
588}

References LIS2MDL_CFG_REG_B, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_b_t::off_canc_one_shot.

Here is the call graph for this function:

◆ lis2mdl_temperature_raw_get()

int32_t lis2mdl_temperature_raw_get ( const stmdev_ctx_t ctx,
int16_t *  val 
)

Temperature output value.[get].

Parameters
ctxread / write interface definitions.(ptr)
buffthat stores data read
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 727 of file lis2mdl_reg.c.

728{
729 uint8_t buff[2];
730 int32_t ret;
731
732 ret = lis2mdl_read_reg(ctx, LIS2MDL_TEMP_OUT_L_REG, buff, 2);
733 *val = (int16_t)buff[1];
734 *val = (*val * 256) + (int16_t)buff[0];
735
736 return ret;
737}
#define LIS2MDL_TEMP_OUT_L_REG

References lis2mdl_read_reg(), and LIS2MDL_TEMP_OUT_L_REG.

Here is the call graph for this function: