-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathHaptic.h
More file actions
34 lines (26 loc) · 671 Bytes
/
Haptic.h
File metadata and controls
34 lines (26 loc) · 671 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#ifndef __HAPTIC_H__
#define __HAPTIC_H__
#pragma once
#if ARDUINO >= 100
#include "Arduino.h"
#else
#include "WProgram.h"
#endif
#include "DRV2605.h"
#include "adsrTable.h"
#include "driver/ledc.h"
#include <math.h>
class HapticStereo {
public:
HapticStereo(DRV2605* the_drv1, DRV2605* the_drv2, int pwm1Pin, int pwm2Pin);
DRV2605* drv[2];
ledc_channel_config_t* pwm[2];
ledc_channel_config_t pwm1;
ledc_channel_config_t pwm2;
float threshold;
int update(float control1, float control2, float control3, int mode);
float updateLFO(int idx, float rate, float offset, float gain);
void setDuty(int idx, int duty);
void play(int idx, int effect);
};
#endif