hsc26-artemis2/firmware/app/driver/accel.h
true d95af918fa initial WIP
lots of code copied over, things filled in to hopefully get the LED matrix lighting up. untested.
2026-05-08 11:54:12 -07:00

49 lines
692 B
C

/*
* accel.h
*
* Created on: Oct 13, 2024
* Author: true
*/
#ifndef USER_MISC_ACCEL_H_
#define USER_MISC_ACCEL_H_
#include "ch32x035_conf.h"
#include <stdint.h>
#define LIS2_CS_PORT GPIOB // CH32X035-specific
#define LIS2_CS_PIN GPIO_Pin_6
#define LIS2_I2C_ADDR 0x30
#define LIS2_I2C_ADDR_SDO_LOW 0x32
typedef struct AccelData {
int16_t x;
int16_t y;
int16_t z;
} AccelData;
extern AccelData accel;
extern uint8_t accel_found;
extern uint16_t movement_worst;
void accel_init();
void accel_poll();
int8_t accel_get_rotation(struct AccelData *a);
int16_t accel_get_movement();
#endif /* USER_MISC_ACCEL_H_ */