Permalink
Browse files

Initial Commit

Beta code, still needs cleanup.
  • Loading branch information...
1 parent 01b7559 commit 8eca75d685bf9ea220e85f9d3c8cf35236fc7464 Andy Rawson committed Dec 14, 2012
Showing 587 changed files with 51,684 additions and 0 deletions.
View
@@ -0,0 +1,7 @@
+xgatt_read_temp1 21
+xgatt_read_temp2 25
+xgatt_read_temp3 29
+xgatt_read_temp4 33
+xgatt_read_temp 37
+xgatt_sensor_type 41
+xgatt_read_eeprom 44
View
@@ -0,0 +1,2 @@
+..\..\bin\bgbuild.exe project.xml
+pause
View
@@ -0,0 +1,104 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<configuration>
+
+ <service uuid="1800">
+ <description>Generic Access Profile</description>
+
+ <!-- Device Name -->
+ <!-- org.bluetooth.characteristic.gap.device_name -->
+ <characteristic uuid="2a00">
+ <properties read="true" const="true" />
+ <value>IR Camera Accessory</value>
+ </characteristic>
+
+ <!-- Appearance -->
+ <!-- org.bluetooth.characteristic.gap.appearance -->
+ <characteristic uuid="2a01">
+ <properties read="true" const="true" />
+ <value>0000</value>
+ </characteristic>
+ </service>
+
+ <service uuid="180A">
+ <description>Device Information</description>
+
+ <!-- Manufacturer Name String -->
+ <!-- org.bluetooth.characteristic.manufacturer_name_string -->
+ <characteristic uuid="2a29">
+ <properties read="true" const="true" />
+ <value>RH Workshop</value>
+ <description>Manufacturer Name String</description>
+ </characteristic>
+
+ <!-- Model Number String -->
+ <!-- org.bluetooth.characteristic.model_number_string -->
+ <characteristic uuid="2a24">
+ <properties read="true" const="true" />
+ <value>IRCam 0.9.1</value>
+ <description>Model Number String</description>
+ </characteristic>
+
+ <!-- Firmware Revision String -->
+ <!-- org.bluetooth.characteristic.firmware_revision_string -->
+ <characteristic uuid="2a26">
+ <properties read="true" const="true" />
+ <value>0.9.1</value>
+ <description>Firmware Revision String</description>
+ </characteristic>
+
+ <!-- Hardware Revision String -->
+ <!-- org.bluetooth.characteristic.hardware_revision_string -->
+ <characteristic uuid="2a27">
+ <properties read="true" const="true" />
+ <value>REV-A</value>
+ <description>Hardware Revision String</description>
+ </characteristic>
+ </service>
+
+ <service uuid="928f41ba-6e8b-4b17-90ba-3e81fcefb6d0" advertise="true">
+ <description>IR Camera Service</description>
+
+ <characteristic uuid="b9f76bcf-56f3-4c4e-8cf1-b774945f53fa" id="xgatt_read_temp1">
+ <properties read="true" notify="true"/>
+ <value length="16" value="hex" variable_length="false"></value>
+ <description>Read Temp 1</description>
+ </characteristic>
+
+ <characteristic uuid="6de465d5-7c07-4e26-a9d0-c3f444277aca" id="xgatt_read_temp2">
+ <properties read="true" notify="true"/>
+ <value length="16" value="hex" variable_length="false"></value>
+ <description>Read Temp 2</description>
+ </characteristic>
+
+ <characteristic uuid="4491508d-9295-4c90-a6fe-92b222717611" id="xgatt_read_temp3">
+ <properties read="true" notify="true"/>
+ <value length="16" value="hex" variable_length="false"></value>
+ <description>Read Temp 3</description>
+ </characteristic>
+
+ <characteristic uuid="6ba26639-73c4-4426-86c1-b6eded9c64fa" id="xgatt_read_temp4">
+ <properties read="true" notify="true"/>
+ <value length="18" value="hex" variable_length="false"></value>
+ <description>Read Temp 4</description>
+ </characteristic>
+
+ <characteristic uuid="05144cc7-e844-4516-a7c2-dc0afb613b7e" id="xgatt_read_temp">
+ <properties read="true" notify="true"/>
+ <value length="132" value="hex" variable_length="false"></value>
+ <description>Read Temp</description>
+ </characteristic>
+
+ <characteristic uuid="15a539e4-db0f-4870-90f0-42b29ca75b3d" id="xgatt_sensor_type">
+ <properties read="true" />
+ <value length="1" value="hex" variable_length="false"></value>
+ <description>Read Sensor Type</description>
+ </characteristic>
+
+ <characteristic uuid="35a8129a-a34a-421c-82bb-9a5723164b3e" id="xgatt_read_eeprom">
+ <properties read="true" />
+ <value length="255" value="hex" variable_length="false"></value>
+ <description>Read EEPROM</description>
+ </characteristic>
+ </service>
+
+</configuration>
View
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+
+<hardware>
+ <sleeposc enable="true" ppm="30" />
+ <usb enable="false" endpoint="none" />
+ <txpower power="10" bias="5" />
+ <script enable="true" />
+
+</hardware>
View
@@ -0,0 +1,138 @@
+#
+# (c) Andy Rawson 2012
+#
+# http://rhworkshop.com
+#
+
+
+dim offset
+dim i
+dim r
+dim r2
+dim r3
+dim t(32)
+dim ptat(2)
+dim vcp(2)
+dim eepromData(32)
+dim configData(5)
+dim oscTrim
+
+const eAddress=$a0
+const rAddress=$c0
+
+#init gap mod, bonding and start freerunning times on system boot
+event system_boot(major ,minor ,patch ,build ,ll_version ,protocol_version ,hw )
+ call gap_set_mode(2,2)
+ call sm_set_bondable_mode(1)
+ call hardware_set_soft_timer(8000,0,0)
+
+ # Set sensor type: 1 = MLX90620 0 = Grid-Eye
+ call attributes_write(xgatt_sensor_type,0,1,1)
+
+ call hardware_i2c_write(eAddress, 1, 1, $F7)(r)
+ call hardware_i2c_read(eAddress,1,1)(r2,r3,oscTrim)
+
+ # Set the Sensor RAM Config
+ configData(0:1)=$03
+ configData(1:1)=$b7
+ configData(2:1)=$0c
+ configData(3:1)=$1f
+ configData(4:1)=$74
+
+ # Set the Sensor RAM OSC Trim
+ call hardware_i2c_write(rAddress, 1, 5, configData(0:5))(r)
+ configData(0:1)=$04
+ configData(1:1)=oscTrim - $AA
+ configData(2:1)=oscTrim
+ configData(3:1)=$56
+ configData(4:1)=$00
+ call hardware_i2c_write(rAddress, 1, 5, configData(0:5))(r)
+
+ # Read the EEPROM Data
+ call hardware_i2c_write(eAddress, 1, 1, $00)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,0,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $20)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,32,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $40)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,64,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $60)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,96,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $80)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,128,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $A0)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,160,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $C0)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,192,32,eepromData(0:32))
+ call hardware_i2c_write(eAddress, 1, 1, $E0)(r)
+ call hardware_i2c_read(eAddress,1,32)(r2,r3,eepromData(0:32))
+ call attributes_write(xgatt_read_eeprom,224,31,eepromData(0:31))
+
+
+end
+
+#timer expired
+event hardware_soft_timer(handle)
+
+ configData(0:1)=$02
+ configData(1:1)=$00
+ configData(2:1)=$01
+ configData(3:1)=$10
+
+ # get the IR Data 1
+ call hardware_i2c_write(rAddress, 0, 4, configData(0:4))(r)
+ call hardware_i2c_read(rAddress,1,32)(r2,r3,t(0:32))
+
+ call attributes_write(xgatt_read_temp,0,32,t(0:32))
+
+ # get the IR Data 2
+ configData(1:1)=$10
+ call hardware_i2c_write(rAddress, 0, 4, configData(0:4))(r)
+ call hardware_i2c_read(rAddress,1,32)(r2,r3,t(0:32))
+
+ call attributes_write(xgatt_read_temp,32,32,t(0:32))
+
+ # get the IR Data 3
+ configData(1:1)=$20
+ call hardware_i2c_write(rAddress, 0, 4, configData(0:4))(r)
+ call hardware_i2c_read(rAddress,1,32)(r2,r3,t(0:32))
+
+ call attributes_write(xgatt_read_temp,64,32,t(0:32))
+
+ # get the IR Data 4
+ configData(1:1)=$30
+ call hardware_i2c_write(rAddress, 0, 4, configData(0:4))(r)
+ call hardware_i2c_read(rAddress,1,32)(r2,r3,t(0:32))
+
+ call attributes_write(xgatt_read_temp,96,32,t(0:32))
+
+ # Get PTAT data
+ configData(0:1)=$02
+ configData(1:1)=$90
+ configData(2:1)=$00
+ configData(3:1)=$01
+ call hardware_i2c_write(rAddress, 0, 4, configData(0:4))(r)
+ call hardware_i2c_read(rAddress,1,2)(r2,r3,ptat(0:2))
+ configData(1:1)=$91
+ call hardware_i2c_write(rAddress, 0, 4, configData(0:4))(r)
+ call hardware_i2c_read(rAddress,1,2)(r2,r3,vcp(0:2))
+
+ #call attributes_write(xgatt_ptat,0,1,ptat(0:1))
+ call attributes_write(xgatt_read_temp,128,2,ptat(0:2))
+ call attributes_write(xgatt_read_temp,130,2,vcp(0:2))
+
+end
+
+event connection_disconnected(handle,result)
+ call gap_set_mode(gap_general_discoverable,gap_undirected_connectable)
+end
+
+
+
+
Oops, something went wrong.

0 comments on commit 8eca75d

Please sign in to comment.