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

This section group common useful functions. More...

Collaboration diagram for "Common":

Functions

int32_t lis2mdl_device_id_get (const stmdev_ctx_t *ctx, uint8_t *buff)
 DeviceWhoamI.[get].
 
int32_t lis2mdl_reset_set (const stmdev_ctx_t *ctx, uint8_t val)
 Software reset. Restore the default values in user registers.[set].
 
int32_t lis2mdl_reset_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Software reset. Restore the default values in user registers.[get].
 
int32_t lis2mdl_boot_set (const stmdev_ctx_t *ctx, uint8_t val)
 Reboot memory content. Reload the calibration parameters.[set].
 
int32_t lis2mdl_boot_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Reboot memory content. Reload the calibration parameters.[get].
 
int32_t lis2mdl_self_test_set (const stmdev_ctx_t *ctx, uint8_t val)
 Selftest.[set].
 
int32_t lis2mdl_self_test_get (const stmdev_ctx_t *ctx, uint8_t *val)
 Selftest.[get].
 
int32_t lis2mdl_data_format_set (const stmdev_ctx_t *ctx, lis2mdl_ble_t val)
 Big/Little Endian data selection.[set].
 
int32_t lis2mdl_data_format_get (const stmdev_ctx_t *ctx, lis2mdl_ble_t *val)
 Big/Little Endian data selection.[get].
 
int32_t lis2mdl_status_get (const stmdev_ctx_t *ctx, lis2mdl_status_reg_t *val)
 Info about device status.[get].
 

Detailed Description

This section group common useful functions.

Function Documentation

◆ lis2mdl_boot_get()

int32_t lis2mdl_boot_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Reboot memory content. Reload the calibration parameters.[get].

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

Definition at line 843 of file lis2mdl_reg.c.

844{
846 int32_t ret;
847
848 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
849 *val = reg.reboot;
850
851 return ret;
852}
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_A

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

Referenced by lis2mdl_init(), and lis2mdl_init_2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lis2mdl_boot_set()

int32_t lis2mdl_boot_set ( const stmdev_ctx_t ctx,
uint8_t  val 
)

Reboot memory content. Reload the calibration parameters.[set].

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

Definition at line 819 of file lis2mdl_reg.c.

820{
822 int32_t ret;
823
824 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
825
826 if (ret == 0)
827 {
828 reg.reboot = val;
829 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
830 }
831
832 return ret;
833}
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_A, lis2mdl_read_reg(), lis2mdl_write_reg(), and lis2mdl_cfg_reg_a_t::reboot.

Referenced by lis2mdl_init(), and lis2mdl_init_2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lis2mdl_data_format_get()

int32_t lis2mdl_data_format_get ( const stmdev_ctx_t ctx,
lis2mdl_ble_t val 
)

Big/Little Endian data selection.[get].

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

Definition at line 929 of file lis2mdl_reg.c.

930{
932 int32_t ret;
933
934 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
935
936 switch (reg.ble)
937 {
940 break;
941
944 break;
945
946 default:
948 break;
949 }
950
951 return ret;
952}
#define LIS2MDL_CFG_REG_C
@ LIS2MDL_LSB_AT_LOW_ADD
@ LIS2MDL_MSB_AT_LOW_ADD

References lis2mdl_cfg_reg_c_t::ble, LIS2MDL_CFG_REG_C, LIS2MDL_LSB_AT_LOW_ADD, LIS2MDL_MSB_AT_LOW_ADD, and lis2mdl_read_reg().

Here is the call graph for this function:

◆ lis2mdl_data_format_set()

int32_t lis2mdl_data_format_set ( const stmdev_ctx_t ctx,
lis2mdl_ble_t  val 
)

Big/Little Endian data selection.[set].

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

Definition at line 905 of file lis2mdl_reg.c.

906{
908 int32_t ret;
909
910 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
911
912 if (ret == 0)
913 {
914 reg.ble = (uint8_t)val;
915 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
916 }
917
918 return ret;
919}

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

Here is the call graph for this function:

◆ lis2mdl_device_id_get()

int32_t lis2mdl_device_id_get ( const stmdev_ctx_t ctx,
uint8_t *  buff 
)

DeviceWhoamI.[get].

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

Definition at line 759 of file lis2mdl_reg.c.

760{
761 int32_t ret;
762
763 ret = lis2mdl_read_reg(ctx, LIS2MDL_WHO_AM_I, buff, 1);
764
765 return ret;
766}
#define LIS2MDL_WHO_AM_I

References lis2mdl_read_reg(), and LIS2MDL_WHO_AM_I.

Referenced by lis2mdl_init(), and lis2mdl_init_2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lis2mdl_reset_get()

int32_t lis2mdl_reset_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Software reset. Restore the default values in user registers.[get].

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

Definition at line 800 of file lis2mdl_reg.c.

801{
803 int32_t ret;
804
805 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
806 *val = reg.soft_rst;
807
808 return ret;
809}

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

Referenced by lis2mdl_init(), and lis2mdl_init_2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lis2mdl_reset_set()

int32_t lis2mdl_reset_set ( const stmdev_ctx_t ctx,
uint8_t  val 
)

Software reset. Restore the default values in user registers.[set].

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

Definition at line 776 of file lis2mdl_reg.c.

777{
779 int32_t ret;
780
781 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
782
783 if (ret == 0)
784 {
785 reg.soft_rst = val;
786 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_A, (uint8_t *)&reg, 1);
787 }
788
789 return ret;
790}

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

Referenced by lis2mdl_init(), and lis2mdl_init_2().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ lis2mdl_self_test_get()

int32_t lis2mdl_self_test_get ( const stmdev_ctx_t ctx,
uint8_t *  val 
)

Selftest.[get].

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

Definition at line 886 of file lis2mdl_reg.c.

887{
889 int32_t ret;
890
891 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
892 *val = reg.self_test;
893
894 return ret;
895}

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

Here is the call graph for this function:

◆ lis2mdl_self_test_set()

int32_t lis2mdl_self_test_set ( const stmdev_ctx_t ctx,
uint8_t  val 
)

Selftest.[set].

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

Definition at line 862 of file lis2mdl_reg.c.

863{
865 int32_t ret;
866
867 ret = lis2mdl_read_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
868
869 if (ret == 0)
870 {
871 reg.self_test = val;
872 ret = lis2mdl_write_reg(ctx, LIS2MDL_CFG_REG_C, (uint8_t *)&reg, 1);
873 }
874
875 return ret;
876}

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

Here is the call graph for this function:

◆ lis2mdl_status_get()

int32_t lis2mdl_status_get ( const stmdev_ctx_t ctx,
lis2mdl_status_reg_t val 
)

Info about device status.[get].

Parameters
ctxread / write interface definitions.(ptr)
valregisters STATUS_REG.(ptr)
Return values
interfacestatus.(MANDATORY: return 0 -> no Error)

Definition at line 962 of file lis2mdl_reg.c.

964{
965 int32_t ret;
966
967 ret = lis2mdl_read_reg(ctx, LIS2MDL_STATUS_REG, (uint8_t *) val, 1);
968
969 return ret;
970}
#define LIS2MDL_STATUS_REG

References lis2mdl_read_reg(), and LIS2MDL_STATUS_REG.

Here is the call graph for this function: