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.
AS7000.h
- Committer:
- sog_yang
- Date:
- 2017-04-23
- Revision:
- 0:aa97de8e628a
- Child:
- 1:510ee396d140
File content as of revision 0:aa97de8e628a:
#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