rejigger file locations

This commit is contained in:
Drashna Jael're 2023-11-21 03:43:30 -08:00
parent 69f31be5c1
commit d422ba4f38
No known key found for this signature in database
GPG Key ID: DBA1FD3A860D1B11
2 changed files with 21 additions and 26 deletions

View File

@ -7,8 +7,29 @@
// datasheet available at https://3dconnexion.com/cn/wp-content/uploads/2020/02/HW-Spec-3DX-700039_Rev001_serial.pdf // datasheet available at https://3dconnexion.com/cn/wp-content/uploads/2020/02/HW-Spec-3DX-700039_Rev001_serial.pdf
// Datasheet UART settings specify:
// - 38400 baud
// - 8 data bits
// - 1 stop bit
// - no parity
// - 100/s data rate
#define SPACEMOUSE_BAUD_RATE 38400
#define SPACEMOUSE_AXIS_COUNT 6
#define SPACEMOUSE_INPUT_OFFSET (8192) #define SPACEMOUSE_INPUT_OFFSET (8192)
#define SPACEMOUSE_LENGTH_DATA (2 * SPACEMOUSE_AXIS_COUNT)
enum spacemouse_commands {
SPACEMOUSE_CMD_REQUEST_DATA = 0xAC,
SPACEMOUSE_CMD_SET_ZERO_POSITION = 0xAD,
SPACEMOUSE_CMD_AUTO_DATA_ON = 0xAE,
SPACEMOUSE_CMD_AUTO_DATA_OFF = 0xAF,
SPACEMOUSE_CMD_END = 0x8D,
SPACEMOUSE_DATA_REQUEST_START = 0x96,
};
bool spacemouse_send_command(uint8_t cmd) { bool spacemouse_send_command(uint8_t cmd) {
uart_write(cmd); uart_write(cmd);
uint8_t buf[2]; uint8_t buf[2];

View File

@ -6,32 +6,6 @@
#include <stdint.h> #include <stdint.h>
#include <stdbool.h> #include <stdbool.h>
// Datasheet UART settings specify:
// - 38400 baud
// - 8 data bits
// - 1 stop bit
// - no parity
// - 100/s data rate
#define SPACEMOUSE_BAUD_RATE 38400
#define SPACEMOUSE_AXIS_COUNT 6
#define SPACEMOUSE_LENGTH_HEADER 1
#define SPACEMOUSE_LENGTH_DATA (2 * SPACEMOUSE_AXIS_COUNT)
#define SPACEMOUSE_LENGTH_CHECKSUM 2
#define SPACEMOUSE_LENGTH_FOOTER 1
#define SPACEMOUSE_LENGTH_PACKET (SPACEMOUSE_LENGTH_HEADER + SPACEMOUSE_LENGTH_DATA + SPACEMOUSE_LENGTH_CHECKSUM + SPACEMOUSE_LENGTH_FOOTER)
enum spacemouse_commands {
SPACEMOUSE_CMD_REQUEST_DATA = 0xAC,
SPACEMOUSE_CMD_SET_ZERO_POSITION = 0xAD,
SPACEMOUSE_CMD_AUTO_DATA_ON = 0xAE,
SPACEMOUSE_CMD_AUTO_DATA_OFF = 0xAF,
SPACEMOUSE_CMD_END = 0x8D,
SPACEMOUSE_DATA_REQUEST_START = 0x96,
};
typedef struct { typedef struct {
int16_t x; int16_t x;
int16_t y; int16_t y;