initial WIP
lots of code copied over, things filled in to hopefully get the LED matrix lighting up. untested.
This commit is contained in:
48
firmware/app/driver/accel.h
Normal file
48
firmware/app/driver/accel.h
Normal file
@@ -0,0 +1,48 @@
|
||||
/*
|
||||
* 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_ */
|
||||
Reference in New Issue
Block a user