Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Diff: AS7000.h
- Revision:
- 0:aa97de8e628a
- Child:
- 1:510ee396d140
diff -r 000000000000 -r aa97de8e628a AS7000.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/AS7000.h Sun Apr 23 01:04:47 2017 +0000
@@ -0,0 +1,63 @@
+#ifndef AS7000_H
+#define AS7000_H
+
+#include "mbed.h"
+//
+#define AS7000Address 0x60
+//Register definitions
+#define AS7000_STARTUP 0x04 //4
+#define HR_ONLY 0x08 //8
+#define HR_ONLY_LEN 0x07 //7
+#define HR_REG 0x12 //18
+#define HR_LEN 21
+
+typedef struct{
+ uint8_t transaction_id;
+ uint8_t status;
+ uint8_t hreat_rate;
+ uint8_t signal_QA;
+ uint16_t LED_current;
+ uint8_t SYNC;
+ uint8_t startup_flag;
+ bool contact_detected;
+}as7000_t;
+
+
+
+
+/** Class for operating Bosch BNO055 sensor over I2C **/
+class AS7000
+{
+public:
+
+/** Create BNO055 instance **/
+ AS7000(PinName SDA, PinName SCL);
+
+ void gpio_init(void);
+ void enable (void);
+ void startup (void);
+ void hr_only (void);
+ void update (void);
+ as7000_t hrm;
+
+
+ private:
+ I2C _i2c;
+ char rx,tx[2],address; //I2C variables
+ char rawdata[22]; //Temporary array for input data values
+ char hreat_rate;
+ char startup_flag;
+
+void readchar(char location){
+ tx[0] = location;
+ _i2c.write(address,tx,1,true);
+ _i2c.read(address,&rx,1,false);
+}
+
+void writechar(char location, char value){
+ tx[0] = location;
+ tx[1] = value;
+ _i2c.write(address,tx,2);
+}
+ };
+#endif
\ No newline at end of file