LibDriver AS5600
Loading...
Searching...
No Matches
driver_as5600.c File Reference

driver as5600 source file More...

#include "driver_as5600.h"
Include dependency graph for driver_as5600.c:

Go to the source code of this file.

Macros

#define CHIP_NAME   "AMS AS5600"
 chip information definition
#define MANUFACTURER_NAME   "AMS"
#define SUPPLY_VOLTAGE_MIN   4.5f
#define SUPPLY_VOLTAGE_MAX   5.5f
#define MAX_CURRENT   100.0f
#define TEMPERATURE_MIN   -40.0f
#define TEMPERATURE_MAX   125.0f
#define DRIVER_VERSION   1000
#define AS5600_ADDRESS   0x6C
 chip address definition
#define AS5600_REG_ZMCO   0x00
 chip register definition
#define AS5600_REG_ZPOS_H   0x01
#define AS5600_REG_ZPOS_L   0x02
#define AS5600_REG_MPOS_H   0x03
#define AS5600_REG_MPOS_L   0x04
#define AS5600_REG_MANG_H   0x05
#define AS5600_REG_MANG_L   0x06
#define AS5600_REG_CONF_H   0x07
#define AS5600_REG_CONF_L   0x08
#define AS5600_REG_RAW_ANGLE_H   0x0C
#define AS5600_REG_RAW_ANGLE_L   0x0D
#define AS5600_REG_ANGLE_H   0x0E
#define AS5600_REG_ANGLE_L   0x0F
#define AS5600_REG_STATUS   0x0B
#define AS5600_REG_AGC   0x1A
#define AS5600_REG_MAGNITUDE_H   0x1B
#define AS5600_REG_MAGNITUDE_L   0x1C
#define AS5600_REG_BURN   0xFF

Functions

uint8_t as5600_init (as5600_handle_t *handle)
 initialize the chip
uint8_t as5600_deinit (as5600_handle_t *handle)
 close the chip
uint8_t as5600_read (as5600_handle_t *handle, uint16_t *angle_raw, float *deg)
 read the magnetic angle
uint8_t as5600_angle_convert_to_register (as5600_handle_t *handle, float deg, uint16_t *reg)
 convert the angle to the register raw data
uint8_t as5600_angle_convert_to_data (as5600_handle_t *handle, uint16_t reg, float *deg)
 convert the register raw data to the angle
uint8_t as5600_set_start_position (as5600_handle_t *handle, uint16_t pos)
 set the start position
uint8_t as5600_get_start_position (as5600_handle_t *handle, uint16_t *pos)
 get the start position
uint8_t as5600_set_stop_position (as5600_handle_t *handle, uint16_t pos)
 set the stop position
uint8_t as5600_get_stop_position (as5600_handle_t *handle, uint16_t *pos)
 get the stop position
uint8_t as5600_set_max_angle (as5600_handle_t *handle, uint16_t ang)
 set the max angle
uint8_t as5600_get_max_angle (as5600_handle_t *handle, uint16_t *ang)
 get the max angle
uint8_t as5600_set_watch_dog (as5600_handle_t *handle, as5600_bool_t enable)
 enable or disable the watch dog
uint8_t as5600_get_watch_dog (as5600_handle_t *handle, as5600_bool_t *enable)
 get the watch dog status
uint8_t as5600_set_fast_filter_threshold (as5600_handle_t *handle, as5600_fast_filter_threshold_t threshold)
 set the fast filter threshold
uint8_t as5600_get_fast_filter_threshold (as5600_handle_t *handle, as5600_fast_filter_threshold_t *threshold)
 get the fast filter threshold
uint8_t as5600_set_slow_filter (as5600_handle_t *handle, as5600_slow_filter_t filter)
 set the slow filter
uint8_t as5600_get_slow_filter (as5600_handle_t *handle, as5600_slow_filter_t *filter)
 get the slow filter
uint8_t as5600_set_pwm_frequency (as5600_handle_t *handle, as5600_pwm_frequency_t freq)
 set the pwm frequency
uint8_t as5600_get_pwm_frequency (as5600_handle_t *handle, as5600_pwm_frequency_t *freq)
 get the pwm frequency
uint8_t as5600_set_output_stage (as5600_handle_t *handle, as5600_output_stage_t stage)
 set the output stage
uint8_t as5600_get_output_stage (as5600_handle_t *handle, as5600_output_stage_t *stage)
 get the output stage
uint8_t as5600_set_hysteresis (as5600_handle_t *handle, as5600_hysteresis_t hysteresis)
 set the hysteresis
uint8_t as5600_get_hysteresis (as5600_handle_t *handle, as5600_hysteresis_t *hysteresis)
 get the hysteresis
uint8_t as5600_set_power_mode (as5600_handle_t *handle, as5600_power_mode_t mode)
 set the power mode
uint8_t as5600_get_power_mode (as5600_handle_t *handle, as5600_power_mode_t *mode)
 get the power mode
uint8_t as5600_get_raw_angle (as5600_handle_t *handle, uint16_t *ang)
 get the raw angle
uint8_t as5600_get_angle (as5600_handle_t *handle, uint16_t *ang)
 get the angle
uint8_t as5600_get_status (as5600_handle_t *handle, uint8_t *status)
 get the status
uint8_t as5600_get_agc (as5600_handle_t *handle, uint8_t *agc)
 get the automatic gain control
uint8_t as5600_get_magnitude (as5600_handle_t *handle, uint16_t *magnitude)
 get the magnitude
uint8_t as5600_set_burn (as5600_handle_t *handle, as5600_burn_t burn)
 set the burn
uint8_t as5600_set_reg (as5600_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 set the chip register
uint8_t as5600_get_reg (as5600_handle_t *handle, uint8_t reg, uint8_t *buf, uint16_t len)
 get the chip register
uint8_t as5600_info (as5600_info_t *info)
 get chip's information

Detailed Description

driver as5600 source file

Copyright (c) 2015 - present LibDriver All rights reserved

The MIT License (MIT)

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Version
1.0.0
Author
Shifeng Li
Date
2022-09-30

history

Date Version Author Description
2022/09/30 1.0 Shifeng Li first upload

Definition in file driver_as5600.c.

Macro Definition Documentation

◆ AS5600_ADDRESS

#define AS5600_ADDRESS   0x6C

chip address definition

iic device address

Definition at line 54 of file driver_as5600.c.

◆ AS5600_REG_AGC

#define AS5600_REG_AGC   0x1A

automatic gain control register

Definition at line 73 of file driver_as5600.c.

◆ AS5600_REG_ANGLE_H

#define AS5600_REG_ANGLE_H   0x0E

angle register high

Definition at line 70 of file driver_as5600.c.

◆ AS5600_REG_ANGLE_L

#define AS5600_REG_ANGLE_L   0x0F

angle register low

Definition at line 71 of file driver_as5600.c.

◆ AS5600_REG_BURN

#define AS5600_REG_BURN   0xFF

burn register

Definition at line 76 of file driver_as5600.c.

◆ AS5600_REG_CONF_H

#define AS5600_REG_CONF_H   0x07

conf register high

Definition at line 66 of file driver_as5600.c.

◆ AS5600_REG_CONF_L

#define AS5600_REG_CONF_L   0x08

conf register low

Definition at line 67 of file driver_as5600.c.

◆ AS5600_REG_MAGNITUDE_H

#define AS5600_REG_MAGNITUDE_H   0x1B

magnitude register high

Definition at line 74 of file driver_as5600.c.

◆ AS5600_REG_MAGNITUDE_L

#define AS5600_REG_MAGNITUDE_L   0x1C

magnitude register low

Definition at line 75 of file driver_as5600.c.

◆ AS5600_REG_MANG_H

#define AS5600_REG_MANG_H   0x05

maximum angle register high

Definition at line 64 of file driver_as5600.c.

◆ AS5600_REG_MANG_L

#define AS5600_REG_MANG_L   0x06

maximum angle register low

Definition at line 65 of file driver_as5600.c.

◆ AS5600_REG_MPOS_H

#define AS5600_REG_MPOS_H   0x03

stop position register high

Definition at line 62 of file driver_as5600.c.

◆ AS5600_REG_MPOS_L

#define AS5600_REG_MPOS_L   0x04

stop position register low

Definition at line 63 of file driver_as5600.c.

◆ AS5600_REG_RAW_ANGLE_H

#define AS5600_REG_RAW_ANGLE_H   0x0C

raw angle register high

Definition at line 68 of file driver_as5600.c.

◆ AS5600_REG_RAW_ANGLE_L

#define AS5600_REG_RAW_ANGLE_L   0x0D

raw angle register low

Definition at line 69 of file driver_as5600.c.

◆ AS5600_REG_STATUS

#define AS5600_REG_STATUS   0x0B

status register

Definition at line 72 of file driver_as5600.c.

◆ AS5600_REG_ZMCO

#define AS5600_REG_ZMCO   0x00

chip register definition

written times register

Definition at line 59 of file driver_as5600.c.

◆ AS5600_REG_ZPOS_H

#define AS5600_REG_ZPOS_H   0x01

start position register high

Definition at line 60 of file driver_as5600.c.

◆ AS5600_REG_ZPOS_L

#define AS5600_REG_ZPOS_L   0x02

start position register low

Definition at line 61 of file driver_as5600.c.

◆ CHIP_NAME

#define CHIP_NAME   "AMS AS5600"

chip information definition

chip name

Definition at line 42 of file driver_as5600.c.

◆ DRIVER_VERSION

#define DRIVER_VERSION   1000

driver version

Definition at line 49 of file driver_as5600.c.

◆ MANUFACTURER_NAME

#define MANUFACTURER_NAME   "AMS"

manufacturer name

Definition at line 43 of file driver_as5600.c.

◆ MAX_CURRENT

#define MAX_CURRENT   100.0f

chip max current

Definition at line 46 of file driver_as5600.c.

◆ SUPPLY_VOLTAGE_MAX

#define SUPPLY_VOLTAGE_MAX   5.5f

chip max supply voltage

Definition at line 45 of file driver_as5600.c.

◆ SUPPLY_VOLTAGE_MIN

#define SUPPLY_VOLTAGE_MIN   4.5f

chip min supply voltage

Definition at line 44 of file driver_as5600.c.

◆ TEMPERATURE_MAX

#define TEMPERATURE_MAX   125.0f

chip max operating temperature

Definition at line 48 of file driver_as5600.c.

◆ TEMPERATURE_MIN

#define TEMPERATURE_MIN   -40.0f

chip min operating temperature

Definition at line 47 of file driver_as5600.c.