Initial commit
This commit is contained in:
47
AS5600L/AS5600L.h
Normal file
47
AS5600L/AS5600L.h
Normal file
@@ -0,0 +1,47 @@
|
||||
#ifndef AS5600L_H
|
||||
#define AS5600L_H
|
||||
|
||||
#include "hardware/i2c.h"
|
||||
#include "pico/stdlib.h"
|
||||
#include "pico/time.h"
|
||||
#include <stdio.h>
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
#define I2C_TIMEOUT_US (100000)
|
||||
|
||||
#define AS560x_STATUS_REG (0x0B)
|
||||
#define AS560x_RAW_ANGLE_REG (0x0C)
|
||||
#define AS5600L_ADDRESS 0x40
|
||||
#define ENCODER_RESOLUTION 4096
|
||||
|
||||
|
||||
|
||||
typedef struct {
|
||||
i2c_inst_t *I2C_PORT;
|
||||
int FREQUENCE;
|
||||
int I2C_SDA_PIN;
|
||||
int I2C_SCL_PIN;
|
||||
} AS5600L_I2C;
|
||||
|
||||
typedef struct {
|
||||
AS5600L_I2C serial_instance;
|
||||
int last_angle;
|
||||
int curr_angle ;
|
||||
int abs_pos ;
|
||||
int start_pos;
|
||||
} AS5600L;
|
||||
|
||||
|
||||
void as560x_init(AS5600L* as5600l, i2c_inst_t *I2C_ID, int frq , int sda, int scl);
|
||||
int update_pos(AS5600L* as5600l);
|
||||
int __bswap16(int value);
|
||||
void i2cError();
|
||||
int as560xReadReg(AS5600L* as5600l,int addr, bool wide, int mask);
|
||||
void AS560x_print_reg16(AS5600L* as5600l,const char *formatStr, int addr, int mask);
|
||||
void AS560x_print_reg8(AS5600L* as5600l,const char *formatStr, int addr, uint8_t mask);
|
||||
int as560xReadAngle(AS5600L* as5600l);
|
||||
uint8_t as560xGetStatus(AS5600L* as5600l);
|
||||
void sensorData(AS5600L* as5600l);
|
||||
|
||||
#endif /* AS5600L_H */
|
||||
Reference in New Issue
Block a user