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

Committer:
sandyr7
Date:
Wed Dec 27 06:47:27 2017 +0000
Revision:
7:1b0597b7ead3
Parent:
5:8c21994db8d2
test;

Who changed what in which revision?

UserRevisionLine numberNew contents of line
sandyr7 5:8c21994db8d2 1
sandyr7 5:8c21994db8d2 2 // got it from Rogers' repo, arduino for nrf51822
sandyr7 5:8c21994db8d2 3
sandyr7 5:8c21994db8d2 4
sandyr7 5:8c21994db8d2 5 #ifndef _KX22_H_
sandyr7 5:8c21994db8d2 6 #define _KX22_H_
sandyr7 5:8c21994db8d2 7
sandyr7 5:8c21994db8d2 8
sandyr7 5:8c21994db8d2 9 #include "wire.h"
sandyr7 5:8c21994db8d2 10 #include "mbed.h"
sandyr7 5:8c21994db8d2 11
sandyr7 5:8c21994db8d2 12 #define KX22_addr_w 0x3E
sandyr7 5:8c21994db8d2 13 #define KX22_addr_r 0x3F
sandyr7 5:8c21994db8d2 14 #define KX22_Accel_CNTL1_1 0x18
sandyr7 5:8c21994db8d2 15 #define KX22_Accel_CNTL1_2 0x41
sandyr7 5:8c21994db8d2 16 #define KX22_Accel_ODCNTL_1 0x1B
sandyr7 5:8c21994db8d2 17 #define KX22_Accel_ODCNTL_2 0x02
sandyr7 5:8c21994db8d2 18 #define KX22_Accel_CNTL3_1 0x1A
sandyr7 5:8c21994db8d2 19 #define KX22_Accel_CNTL3_2 0xD8
sandyr7 5:8c21994db8d2 20 #define KX22_Accel_TILT_TIMER_1 0x22
sandyr7 5:8c21994db8d2 21 #define KX22_Accel_TILT_TIMER_2 0x01
sandyr7 5:8c21994db8d2 22 #define KX22_Accel_CNTL2_1 0x18
sandyr7 5:8c21994db8d2 23 #define KX22_Accel_CNTL2_2 0xC1
sandyr7 5:8c21994db8d2 24
sandyr7 5:8c21994db8d2 25 #define DATA_OUT_BASE 0x06
sandyr7 5:8c21994db8d2 26
sandyr7 5:8c21994db8d2 27
sandyr7 5:8c21994db8d2 28 class KX22
sandyr7 5:8c21994db8d2 29 {
sandyr7 5:8c21994db8d2 30 public :
sandyr7 5:8c21994db8d2 31 KX22(uint8_t SCL, uint8_t SDA);
sandyr7 5:8c21994db8d2 32 void writeTwoBytes (int one, int two, TwoWire* wire);
sandyr7 5:8c21994db8d2 33 int getByte (int address, TwoWire* wire);
sandyr7 5:8c21994db8d2 34 int16_t getAccel(int channelNum); //returns 1000*acceleration m/s^2 value
sandyr7 5:8c21994db8d2 35
sandyr7 5:8c21994db8d2 36 private :
sandyr7 5:8c21994db8d2 37 uint8_t scl, sda;
sandyr7 5:8c21994db8d2 38
sandyr7 5:8c21994db8d2 39 };
sandyr7 5:8c21994db8d2 40
sandyr7 5:8c21994db8d2 41
sandyr7 5:8c21994db8d2 42 #endif