An integrated code base for smart watch model using nrf51822. Used the efforts from Roger Clark, Goran Mahovlic, Nordic team SDKs and mbed repos on OLED. Programming: The watch prototype can be interfaced to Tiny Seeed BLE programmer (left of the Tiny Seeed BLE board). Connect SWDIO, SWD CLK, Vin and GND pins. For USB debugging also connect RX and TX pins. Used Roger's nice webpage to come up with the pin mapping and many other HW insights. http://www.rogerclark.net/arduino-on-the-id100hr-fitness-tracker/

Dependencies:   BLE_API SFE_MicroOLED_debugPrint mbed nRF51822

Fork of BLE_TemperatureAdvertising by xiao sun

KX022_RBL/KX22.h

Committer:
root@developer-sjc-indigo-compiler.local.mbed.org
Date:
2017-12-27
Revision:
8:c98204f59c76
Parent:
5:8c21994db8d2

File content as of revision 8:c98204f59c76:


// got it from Rogers' repo, arduino for nrf51822


#ifndef _KX22_H_
#define _KX22_H_
 

#include "wire.h"
#include "mbed.h"

#define KX22_addr_w              0x3E
#define KX22_addr_r              0x3F
#define KX22_Accel_CNTL1_1       0x18
#define KX22_Accel_CNTL1_2       0x41
#define KX22_Accel_ODCNTL_1      0x1B
#define KX22_Accel_ODCNTL_2      0x02
#define KX22_Accel_CNTL3_1       0x1A
#define KX22_Accel_CNTL3_2       0xD8
#define KX22_Accel_TILT_TIMER_1  0x22
#define KX22_Accel_TILT_TIMER_2  0x01
#define KX22_Accel_CNTL2_1       0x18
#define KX22_Accel_CNTL2_2       0xC1  

#define DATA_OUT_BASE 0x06


class KX22
{  
    public :
        KX22(uint8_t SCL, uint8_t SDA);
        void writeTwoBytes (int one, int two, TwoWire* wire);
        int getByte (int address, TwoWire* wire);
        int16_t getAccel(int channelNum); //returns 1000*acceleration m/s^2 value
   
   private :
        uint8_t scl, sda;       
        
};

 
#endif