Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 26 additions & 3 deletions include/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

#include "mbed.h"
#include "arm_math.h"
#include "ble/BLE.h"
#include "ble/Gap.h"
#include "ble/GattServer.h"

extern BufferedSerial serial_port;
FileHandle *mbed_override_console(int);
Expand All @@ -28,10 +31,12 @@ extern I2C i2c;
#define OUTZ_L_G 0x26
#define OUTZ_H_G 0x27


static constexpr int BUFFER_SIZE = 512;
static constexpr int BATCH_TIME_MS = 3000;
static constexpr int SAMPLE_INTERVAL_US = BATCH_TIME_MS * 1000 / BUFFER_SIZE;

// --- FFT & Sensor Data Arrays ---
extern arm_rfft_fast_instance_f32 fftInst;
extern float fftOut[BUFFER_SIZE];

Expand All @@ -58,15 +63,33 @@ extern float gyroZ_g[BUFFER_SIZE];

extern int circular_idx;

extern DigitalOut tremorLed;
extern DigitalOut dyskinesiaLed;

// --- Threading, Tickers, and Status Flags ---
extern volatile bool batchReady;
extern volatile bool isReading;
extern Ticker sampleTicker;
extern EventQueue queue;
extern Thread worker;
extern Ticker tremorBlinkTicker;
extern Ticker dyskinesiaBlinkTicker;
extern DigitalOut tremorLed;
extern DigitalOut dyskinesiaLed;

// --- Motion Status Variables (Used in main.cpp for calculation) ---
extern float currentTremorEnergy;
extern float currentDyskinesiaEnergy;
extern float currentFreezeIndex;
extern bool isFreezing;
extern DigitalOut freezeLed; // You need this if LED is used for Freeze


extern BLE &ble_interface;

// Characteristic UUIDs (You can choose custom UUIDs or reserved ranges)
#define PARKINSONS_SERVICE_UUID 0xA001
#define STATUS_CHAR_UUID 0xA002

extern uint8_t BLE_status;

extern GattCharacteristic *p_status_characteristic;

#endif // GLOBALS_H
Loading