TEST

Dependencies:   max32630fthr Adafruit_FeatherOLED USBDevice

Committer:
gmehmet
Date:
Wed Apr 10 14:56:25 2019 +0300
Revision:
1:f60eafbf009a
Child:
3:2fe2ff1ca0dc
upload from local

Who changed what in which revision?

UserRevisionLine numberNew contents of line
gmehmet 1:f60eafbf009a 1 #include "MaximSensor.h"
gmehmet 1:f60eafbf009a 2 #include "Peripherals.h"
gmehmet 1:f60eafbf009a 3
gmehmet 1:f60eafbf009a 4 /* PUBLIC FUNCTION DECLARATIONS */
gmehmet 1:f60eafbf009a 5 /**
gmehmet 1:f60eafbf009a 6 * @brief Reads from register.
gmehmet 1:f60eafbf009a 7 * @details Reads specific Maxim Sensor register via SPI bus.
gmehmet 1:f60eafbf009a 8 *
gmehmet 1:f60eafbf009a 9 * @param[in] reg Beginning address of a register to be read.
gmehmet 1:f60eafbf009a 10 * @param[out] data Buffer space to save result value.
gmehmet 1:f60eafbf009a 11 * @param[in] len Number of consecutive bytes to be read.
gmehmet 1:f60eafbf009a 12 *
gmehmet 1:f60eafbf009a 13 * @returns 0 on success, negative error code on failure.
gmehmet 1:f60eafbf009a 14 */
gmehmet 1:f60eafbf009a 15 int MaximSensor::readRegister(uint8_t reg, uint8_t *data, int len){
gmehmet 1:f60eafbf009a 16 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 17 return -1;
gmehmet 1:f60eafbf009a 18 }
gmehmet 1:f60eafbf009a 19
gmehmet 1:f60eafbf009a 20 /**
gmehmet 1:f60eafbf009a 21 * @brief Writes data to Maxim Sensor register.
gmehmet 1:f60eafbf009a 22 * @details Writes data to specific Maxim Sensor register via SPI bus.
gmehmet 1:f60eafbf009a 23 *
gmehmet 1:f60eafbf009a 24 * @param[in] reg Address of a register to be wrote.
gmehmet 1:f60eafbf009a 25 * @param[in] data Data to write on register.
gmehmet 1:f60eafbf009a 26 *
gmehmet 1:f60eafbf009a 27 * @returns 0 on success, negative error code on failure.
gmehmet 1:f60eafbf009a 28 */
gmehmet 1:f60eafbf009a 29 int MaximSensor::writeRegister(uint8_t reg, const uint8_t data){
gmehmet 1:f60eafbf009a 30 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 31 return -1;
gmehmet 1:f60eafbf009a 32 }
gmehmet 1:f60eafbf009a 33
gmehmet 1:f60eafbf009a 34 /**
gmehmet 1:f60eafbf009a 35 * @brief Get Maxim Sensor part and revision info.
gmehmet 1:f60eafbf009a 36 * @details Reads Maxim Sensor part and revision info from device.
gmehmet 1:f60eafbf009a 37 *
gmehmet 1:f60eafbf009a 38 * @param[in] reg Beginning address of a register to be read.
gmehmet 1:f60eafbf009a 39 * @param[out] data Buffer space to save result value.
gmehmet 1:f60eafbf009a 40 * @param[in] len Number of consecutive bytes to be read.
gmehmet 1:f60eafbf009a 41 *
gmehmet 1:f60eafbf009a 42 * @returns 0 on success, negative error code on failure.
gmehmet 1:f60eafbf009a 43 */
gmehmet 1:f60eafbf009a 44 int MaximSensor::get_part_info(uint8_t *part_id, uint8_t *rev_id){
gmehmet 1:f60eafbf009a 45 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 46 return -1;
gmehmet 1:f60eafbf009a 47 }
gmehmet 1:f60eafbf009a 48
gmehmet 1:f60eafbf009a 49 /**
gmehmet 1:f60eafbf009a 50 * @brief Enables Maxim Sensor.
gmehmet 1:f60eafbf009a 51 * @details Enable IRQ, enable LEDs, enable AGC
gmehmet 1:f60eafbf009a 52 *
gmehmet 1:f60eafbf009a 53 * @param[in] enable Any value to enable, 0 to disable.
gmehmet 1:f60eafbf009a 54 *
gmehmet 1:f60eafbf009a 55 * @returns 0 on success, negative error code on failure.
gmehmet 1:f60eafbf009a 56 */
gmehmet 1:f60eafbf009a 57 int MaximSensor::sensor_enable(int enable){
gmehmet 1:f60eafbf009a 58 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 59 return -1;
gmehmet 1:f60eafbf009a 60 }
gmehmet 1:f60eafbf009a 61
gmehmet 1:f60eafbf009a 62 /**
gmehmet 1:f60eafbf009a 63 * @brief Enables AGC.
gmehmet 1:f60eafbf009a 64 * @details Enable Maxim Sensor automatic gain controller.
gmehmet 1:f60eafbf009a 65 * AGC automatically adjusts sampling rates and LED currents to save energy.
gmehmet 1:f60eafbf009a 66 *
gmehmet 1:f60eafbf009a 67 * @param[in] agc_enable Any value to enable, 0 to disable.
gmehmet 1:f60eafbf009a 68 *
gmehmet 1:f60eafbf009a 69 * @returns 0 on success, negative error code on failure.
gmehmet 1:f60eafbf009a 70 */
gmehmet 1:f60eafbf009a 71 int MaximSensor::agc_enable(int agc_enable){
gmehmet 1:f60eafbf009a 72 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 73 return -1;
gmehmet 1:f60eafbf009a 74 }
gmehmet 1:f60eafbf009a 75
gmehmet 1:f60eafbf009a 76 /**
gmehmet 1:f60eafbf009a 77 * @brief Get sensor part name.
gmehmet 1:f60eafbf009a 78 *
gmehmet 1:f60eafbf009a 79 * @returns Sensor part name string.
gmehmet 1:f60eafbf009a 80 */
gmehmet 1:f60eafbf009a 81 const char *MaximSensor::get_sensor_part_name(){
gmehmet 1:f60eafbf009a 82 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 83 return "";
gmehmet 1:f60eafbf009a 84 }
gmehmet 1:f60eafbf009a 85 #if 0
gmehmet 1:f60eafbf009a 86 int dump_registers(addr_val_pair *reg_values) {
gmehmet 1:f60eafbf009a 87 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 88 return 0;
gmehmet 1:f60eafbf009a 89 }
gmehmet 1:f60eafbf009a 90 #endif
gmehmet 1:f60eafbf009a 91 /**
gmehmet 1:f60eafbf009a 92 * @brief Get sensor name.
gmehmet 1:f60eafbf009a 93 *
gmehmet 1:f60eafbf009a 94 * @returns Sensor name string.
gmehmet 1:f60eafbf009a 95 */
gmehmet 1:f60eafbf009a 96 const char *MaximSensor::get_sensor_name(){
gmehmet 1:f60eafbf009a 97 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 98 return "";
gmehmet 1:f60eafbf009a 99 }
gmehmet 1:f60eafbf009a 100
gmehmet 1:f60eafbf009a 101
gmehmet 1:f60eafbf009a 102 /**
gmehmet 1:f60eafbf009a 103 * @brief Get sensor ID.
gmehmet 1:f60eafbf009a 104 *
gmehmet 1:f60eafbf009a 105 * @returns Sensor ID number.
gmehmet 1:f60eafbf009a 106 */
gmehmet 1:f60eafbf009a 107 unsigned char MaximSensor::get_sensor_id() {
gmehmet 1:f60eafbf009a 108
gmehmet 1:f60eafbf009a 109 // Base class returns 255
gmehmet 1:f60eafbf009a 110 return( 255 );
gmehmet 1:f60eafbf009a 111
gmehmet 1:f60eafbf009a 112 }
gmehmet 1:f60eafbf009a 113
gmehmet 1:f60eafbf009a 114
gmehmet 1:f60eafbf009a 115 /**
gmehmet 1:f60eafbf009a 116 * @brief Get sensor name.
gmehmet 1:f60eafbf009a 117 *
gmehmet 1:f60eafbf009a 118 * @returns Sensor name string.
gmehmet 1:f60eafbf009a 119 */
gmehmet 1:f60eafbf009a 120 const char *MaximSensor::get_sensor_algo_ver(){
gmehmet 1:f60eafbf009a 121 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 122 return "";
gmehmet 1:f60eafbf009a 123 }
gmehmet 1:f60eafbf009a 124
gmehmet 1:f60eafbf009a 125 int MaximSensor::MS_Max30001_ECG_InitStart(uint8_t En_ecg, uint8_t Openp, uint8_t Openn,
gmehmet 1:f60eafbf009a 126 uint8_t Pol, uint8_t Calp_sel, uint8_t Caln_sel,
gmehmet 1:f60eafbf009a 127 uint8_t E_fit, uint8_t Rate, uint8_t Gain,
gmehmet 1:f60eafbf009a 128 uint8_t Dhpf, uint8_t Dlpf){
gmehmet 1:f60eafbf009a 129 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 130 return -1;
gmehmet 1:f60eafbf009a 131 }
gmehmet 1:f60eafbf009a 132
gmehmet 1:f60eafbf009a 133 int MaximSensor::MS_Max30001_ECG_Stop(){
gmehmet 1:f60eafbf009a 134 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 135 return -1;
gmehmet 1:f60eafbf009a 136 }
gmehmet 1:f60eafbf009a 137
gmehmet 1:f60eafbf009a 138 int MaximSensor::MS_Max30001_RtoR_InitStart(uint8_t En_rtor, uint8_t Wndw, uint8_t Gain,
gmehmet 1:f60eafbf009a 139 uint8_t Pavg, uint8_t Ptsf, uint8_t Hoff,
gmehmet 1:f60eafbf009a 140 uint8_t Ravg, uint8_t Rhsf, uint8_t Clr_rrint){
gmehmet 1:f60eafbf009a 141 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 142 return -1;
gmehmet 1:f60eafbf009a 143 }
gmehmet 1:f60eafbf009a 144
gmehmet 1:f60eafbf009a 145 int MaximSensor::MS_Max30001_RtoR_Stop(){
gmehmet 1:f60eafbf009a 146 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 147 return -1;
gmehmet 1:f60eafbf009a 148 }
gmehmet 1:f60eafbf009a 149
gmehmet 1:f60eafbf009a 150 // Max30001 Interrupt Assignment Function
gmehmet 1:f60eafbf009a 151 int MaximSensor::MS_max30001_INT_assignment(uint8_t en_enint_loc, uint8_t en_eovf_loc, uint8_t en_fstint_loc,
gmehmet 1:f60eafbf009a 152 uint8_t en_dcloffint_loc, uint8_t en_bint_loc, uint8_t en_bovf_loc,
gmehmet 1:f60eafbf009a 153 uint8_t en_bover_loc, uint8_t en_bundr_loc, uint8_t en_bcgmon_loc,
gmehmet 1:f60eafbf009a 154 uint8_t en_pint_loc, uint8_t en_povf_loc, uint8_t en_pedge_loc,
gmehmet 1:f60eafbf009a 155 uint8_t en_lonint_loc, uint8_t en_rrint_loc, uint8_t en_samp_loc,
gmehmet 1:f60eafbf009a 156 uint8_t intb_Type, uint8_t int2b_Type){
gmehmet 1:f60eafbf009a 157 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 158 return -1;
gmehmet 1:f60eafbf009a 159 }
gmehmet 1:f60eafbf009a 160
gmehmet 1:f60eafbf009a 161 int MaximSensor::MS_max30001readRegister(uint8_t addr, uint32_t *return_data){
gmehmet 1:f60eafbf009a 162 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 163 return -1;
gmehmet 1:f60eafbf009a 164 }
gmehmet 1:f60eafbf009a 165
gmehmet 1:f60eafbf009a 166 int MaximSensor::MS_max30001writeRegister(uint8_t addr, uint32_t data){
gmehmet 1:f60eafbf009a 167 pr_err("Empty function is called");
gmehmet 1:f60eafbf009a 168 return -1;
gmehmet 1:f60eafbf009a 169 }
gmehmet 1:f60eafbf009a 170
gmehmet 1:f60eafbf009a 171 int MaximSensor::MS_max30001sync(){
gmehmet 1:f60eafbf009a 172 pr_err("Empty MS_max30001sync is called");
gmehmet 1:f60eafbf009a 173 return -1;
gmehmet 1:f60eafbf009a 174 }