From 6477248e3bc911aa777613c621f9b44e07076b82 Mon Sep 17 00:00:00 2001 From: jake Date: Mon, 11 Sep 2023 22:43:56 -0700 Subject: [PATCH] cleaned up the defines --- src/gy521_driver/gy521_driver.c | 45 --------------------------------- src/gy521_driver/gy521_driver.h | 33 ++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 45 deletions(-) diff --git a/src/gy521_driver/gy521_driver.c b/src/gy521_driver/gy521_driver.c index 8440dc4..df41d5b 100644 --- a/src/gy521_driver/gy521_driver.c +++ b/src/gy521_driver/gy521_driver.c @@ -37,51 +37,6 @@ extern void mock_assert(const int result, const char* const expression, #endif // UNIT_TESTING -/* - * ############################ - * Defines and consts - * ############################ - */ - -#define NUM_ACCEL_REGS 6 -#define NUM_GYRO_REGS 6 - -/*GYRO MIN MAX PARAMETERS(percentage)*/ -#define GYRO_MIN_ST -14 -#define GYRO_MAX_ST 14 - - -/*GYRO_CONFIG*/ -#define XG_ST (1<<7) -#define YG_ST (1<<6) -#define ZG_ST (1<<5) -#define FS_SEL_MSK 0x18//0b00011000 -#define FS_SEL_250 0 -#define FS_SEL_500 (1<<3) -#define FS_SEL_1000 (1<<4) -#define FS_SEL_2000 (1<<4)|(1<<3) - - - -/* - * ############################ - * Structures - * ############################ - */ - - - -struct gy521_module{ - uint8_t slave_address; - gyro_values_struct gyro; - accel_values_struct accel; -}; - -struct ft_vals{ - float x; - float y; - float z; -}; /* * ############################ diff --git a/src/gy521_driver/gy521_driver.h b/src/gy521_driver/gy521_driver.h index 4b4caa9..8ff8ea8 100644 --- a/src/gy521_driver/gy521_driver.h +++ b/src/gy521_driver/gy521_driver.h @@ -15,6 +15,25 @@ * ############################ */ +#define NUM_ACCEL_REGS 6 +#define NUM_GYRO_REGS 6 + +/*GYRO MIN MAX PARAMETERS(percentage)*/ +#define GYRO_MIN_ST -14 +#define GYRO_MAX_ST 14 + + +/*GYRO_CONFIG*/ +#define XG_ST (1<<7) +#define YG_ST (1<<6) +#define ZG_ST (1<<5) +#define FS_SEL_MSK 0x18//0b00011000 +#define FS_SEL_250 0 +#define FS_SEL_500 (1<<3) +#define FS_SEL_1000 (1<<4) +#define FS_SEL_2000 (1<<4)|(1<<3) + + /* * ############################ * Types/Structures @@ -33,6 +52,20 @@ typedef struct accel_values{ uint16_t z; }accel_values_struct; +struct gy521_module{ + uint8_t slave_address; + gyro_values_struct gyro; + accel_values_struct accel; +}; + +struct ft_vals{ + float x; + float y; + float z; +}; + + + /* * ############################ * REGISTER MAP