#pragma once
#include "esp_http_server.h"

#define MAXCHANNELS 2

typedef enum filterType
{
  filter_lpf,
  filter_hpf
} filterType;

typedef struct filterDesign
{
  int initialized;
  int order;
  int sampleRate;
  int cutOffFrequency;
  int noPoles;
  filterType type;
  float *A;
  float *d1;
  float *d2;
  float *w0;
  float *w1;
  float *w2;
  
} filterDesign;

filterDesign *createFilter(filterType type, int order, int sampleRate, int cutOffFrequency,int channel);
void IRAM_ATTR runFilter(float *input, float *output, int noSamples, void *filter);
void freeFilter(filterDesign *filter);


void filter_registerHTTPHandlers(httpd_handle_t *server);

