Modified the original DRV2605 library written by Bryce Williams. Team specific uint8_t kick_start_my_heart(int intensity, int duration) function is added to the library, otherwise unchanged. FLY ARMY!!!

Fork of DRV2605 by Bryce Williams

  1. include "mbed.h"
  2. include "DRV2605.h" DRV2605 haptics(p9, p10); *NEEDE FOR KCIKSTART*

PwmOut base(p26); *NEEDED FOR BOOSTER CIRCUIT, if required*

int main() { base.period(.000001);1MHz base=.5;50% duty cycle

*FOLLOWING NEEDED FOR KICKSTART*

haptics.init(3.3); Motor initialization will cause a 1 second vibration

wait(2);

uint8_t stats=haptics.kick_start_my_heart(10, 1); Intensity range 1-10, duratio range 1-8

printf("dig %X/n",haptics.init(3.3)); }

Files at this revision

API Documentation at this revision

Comitter:
hkreuk
Date:
Fri Dec 02 00:20:14 2016 +0000
Parent:
0:3b2b4f34aaca
Commit message:
To integrate to the Mask, just need DRV2605.cpp and its header file. To haptic feedback, example is provided in main.cpp; ; FLY ARMY!!!

Changed in this revision

DRV2605.cpp Show annotated file Show diff for this revision Revisions of this file
DRV2605.h Show annotated file Show diff for this revision Revisions of this file
diff -r 3b2b4f34aaca -r 224404f39d98 DRV2605.cpp
--- a/DRV2605.cpp	Wed Oct 21 01:02:59 2015 +0000
+++ b/DRV2605.cpp	Fri Dec 02 00:20:14 2016 +0000
@@ -64,6 +64,24 @@
     i2cWriteByte(GO, 1);
 }
 
+uint8_t DRV2605::kick_start_my_heart(int inten, int dur) { //inten range 1-10, dur range 1-8 
+//intensity values(1-123) refer to dvr2605_waveform.pdf, page60
+    int left_over;
+    uint8_t res;
+    for ( int ind=0x04; ind<=(dur+0x003); ind++ ) {
+        i2cWriteByte(ind, inten);
+        left_over=ind;
+        } 
+    for (int ind=(left_over+1); ind<=0x0B; ind++) {
+        i2cWriteByte(ind, 0);
+        }
+        res=diagnostics();
+        printf("%X", res);
+        play();
+        return res;
+        }
+        
+
 uint8_t DRV2605::auto_cal_open_loop(float actuator_peak_voltage){
     // Exit Standby Mode; Enter Auto- Cal Mode
     mode(AUTO_CAL);
diff -r 3b2b4f34aaca -r 224404f39d98 DRV2605.h
--- a/DRV2605.h	Wed Oct 21 01:02:59 2015 +0000
+++ b/DRV2605.h	Fri Dec 02 00:20:14 2016 +0000
@@ -169,6 +169,8 @@
         */
         void play();
         
+        uint8_t kick_start_my_heart(int inten, int dur);
+        
         /**
             TODO: Add Closed Loop Calibration