magneticrotary2 2.0.0.0
|
API for configuring and manipulating Magnetic Rotary 2 Click driver. More...
Topics | |
Magnetic Rotary 2 Registers List | |
List of registers of Magnetic Rotary 2 Click driver. | |
Magnetic Rotary 2 Registers Settings | |
Settings for registers of Magnetic Rotary 2 Click driver. | |
Magnetic Rotary 2 MikroBUS Map | |
MikroBUS pin mapping of Magnetic Rotary 2 Click driver. | |
Functions | |
void | magneticrotary2_cfg_setup (magneticrotary2_cfg_t *cfg) |
Magnetic Rotary 2 configuration object setup function. | |
void | magneticrotary2_msel_pin_selection (magneticrotary2_cfg_t *cfg, magneticrotary2_msel_t msel) |
Magnetic Rotary 2 MSEL pin selection function. | |
err_t | magneticrotary2_init (magneticrotary2_t *ctx, magneticrotary2_cfg_t *cfg) |
Magnetic Rotary 2 initialization function. | |
err_t | magneticrotary2_default_cfg (magneticrotary2_t *ctx) |
Magnetic Rotary 2 default configuration function. | |
err_t | magneticrotary2_write_register (magneticrotary2_t *ctx, uint8_t reg, uint8_t data_in) |
Magnetic Rotary 2 write register function. | |
err_t | magneticrotary2_read_register (magneticrotary2_t *ctx, uint8_t reg, uint8_t *data_out) |
Magnetic Rotary 2 read register function. | |
err_t | magneticrotary2_unlock_eeprom (magneticrotary2_t *ctx) |
Magnetic Rotary 2 unlock eeprom function. | |
err_t | magneticrotary2_lock_eeprom (magneticrotary2_t *ctx) |
Magnetic Rotary 2 lock eeprom function. | |
err_t | magneticrotary2_program_eeprom (magneticrotary2_t *ctx) |
Magnetic Rotary 2 program eeprom function. | |
err_t | magneticrotary2_get_raw_data (magneticrotary2_t *ctx, uint32_t *data_out) |
Magnetic Rotary 2 get raw data function. | |
err_t | magneticrotary2_get_angle (magneticrotary2_t *ctx, float *angle) |
Magnetic Rotary 2 get angle function. | |
API for configuring and manipulating Magnetic Rotary 2 Click driver.
Any initialization code needed for MCU to function properly. Do not remove this line or clock might not be set correctly.
void magneticrotary2_cfg_setup | ( | magneticrotary2_cfg_t * | cfg | ) |
Magnetic Rotary 2 configuration object setup function.
This function initializes click configuration structure to initial values.
[out] | cfg | : Click configuration structure. See magneticrotary2_cfg_t object definition for detailed explanation. |
err_t magneticrotary2_default_cfg | ( | magneticrotary2_t * | ctx | ) |
Magnetic Rotary 2 default configuration function.
This function executes a default configuration of Magnetic Rotary 2 click board.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_get_angle | ( | magneticrotary2_t * | ctx, |
float * | angle ) |
Magnetic Rotary 2 get angle function.
This function reads the absolute position raw data and converts it to degrees (Angle).
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
[out] | angle | : Angle in degrees [0-360]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_get_raw_data | ( | magneticrotary2_t * | ctx, |
uint32_t * | data_out ) |
Magnetic Rotary 2 get raw data function.
This function reads the absolute position raw data.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
[out] | data_out | : Absolute position raw data [18 bits by default]. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_init | ( | magneticrotary2_t * | ctx, |
magneticrotary2_cfg_t * | cfg ) |
Magnetic Rotary 2 initialization function.
This function initializes all necessary pins and peripherals used for this click board.
[out] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
[in] | cfg | : Click configuration structure. See magneticrotary2_cfg_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_lock_eeprom | ( | magneticrotary2_t * | ctx | ) |
Magnetic Rotary 2 lock eeprom function.
This function locks eeprom by writing 0xFF to the unlock eeprom address.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. void magneticrotary2_msel_pin_selection | ( | magneticrotary2_cfg_t * | cfg, |
magneticrotary2_msel_t | msel ) |
Magnetic Rotary 2 MSEL pin selection function.
This function sets a serial driver interface which will be used further in the click driver.
[out] | cfg | : Click configuration structure. See magneticrotary2_cfg_t object definition for detailed explanation. |
[in] | msel | : MSEL selection. See magneticrotary2_msel_t object definition for detailed explanation. |
err_t magneticrotary2_program_eeprom | ( | magneticrotary2_t * | ctx | ) |
Magnetic Rotary 2 program eeprom function.
This function programs eeprom by sending the program eeprom command.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_read_register | ( | magneticrotary2_t * | ctx, |
uint8_t | reg, | ||
uint8_t * | data_out ) |
Magnetic Rotary 2 read register function.
This function reads a data byte from the selected register by using SPI serial interface. In the case of SPI4 and absolute position register, it will read 3 bytes of data without parity and error flag bits.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[out] | data_out | : Output read data. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_unlock_eeprom | ( | magneticrotary2_t * | ctx | ) |
Magnetic Rotary 2 unlock eeprom function.
This function unlocks eeprom by sending the unlock eeprom command.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation. err_t magneticrotary2_write_register | ( | magneticrotary2_t * | ctx, |
uint8_t | reg, | ||
uint8_t | data_in ) |
Magnetic Rotary 2 write register function.
This function writes a data byte to the selected register by using SPI serial interface. It will also verify if the data is written correctly by reading back the same register.
[in] | ctx | : Click context object. See magneticrotary2_t object definition for detailed explanation. |
[in] | reg | : Register address. |
[in] | data_in | : Data to be written. |
0
- Success, -1
- Error. See #err_t definition for detailed explanation.