Pubnub demo for AT&T IoT Starter Kit. Functionally similar to the Flow demo.

Dependencies:   FXOS8700CQ MODSERIAL mbed

http://pubnub.github.io/slides/workshop/pictures/broadcast.png

Pubnub demo for AT&T IoT Starter Kit

This demo is functionally similar to the Flow demo, so you can find general information here: https://developer.mbed.org/users/JMF/code/Avnet_ATT_Cellular_IOT/.

The only difference is that we use Pubnub to publish the measurements and subscribe to receiving the instructions to set the LED.

Settings

Pubnub related settings are:

Pubnub settings in `config_me.h`

PUBNUB_SUBSCRIBE_KEY
PUBNUB_PUBLISH_KEY
PUBNUB_CHANNEL

All are documented in their respective comments.

Pubnub context class

Similar to Pubnub SDKs, we provide a Pubnub context class. It is defined in pubnub.h header file and implemented in pubnub.cpp.

It provides only the fundamental "publish" and "subscribe" methods. They are documented in the header file.

This class is reusable in other code (it is not specific to this demo), it has a very narrow interface to the AT&T IoT cellular modem code. For example of use, you can look at the main() (in main.c).

Sample of published data

Published message w/measurement data

{"serial":"vstarterkit001","temp":89.61,"humidity":35,"accelX":0.97,"accelY":0.013,"accelZ":-0.038}

Don't worry, nobody got burnt, the temperature is in degrees Fahrenheit. :)

Publish a message (from, say, the Pubnub console http://pubnub.com/console) of the form {"LED":<name-of-the-color>} on the channel that this demo listens to (default is hello_world) to turn the LED to that color on the Starter Kit:

Turn LED to red

{"LED":"Red"}

Turn LED to green

{"LED":"Green"}

Turn LED to blue

{"LED":"Blue"}
Committer:
sveljko
Date:
Fri Sep 02 17:44:55 2016 +0000
Revision:
81:a5df87708b9a
Parent:
69:5a3414cc7531
First version that works, forked from official AT&T IoT starter kit repository.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
stefanrousseau 69:5a3414cc7531 1 /* ===================================================================
stefanrousseau 69:5a3414cc7531 2 Copyright © 2016, AVNET Inc.
stefanrousseau 69:5a3414cc7531 3
stefanrousseau 69:5a3414cc7531 4 Licensed under the Apache License, Version 2.0 (the "License");
stefanrousseau 69:5a3414cc7531 5 you may not use this file except in compliance with the License.
stefanrousseau 69:5a3414cc7531 6 You may obtain a copy of the License at
stefanrousseau 69:5a3414cc7531 7
stefanrousseau 69:5a3414cc7531 8 http://www.apache.org/licenses/LICENSE-2.0
stefanrousseau 69:5a3414cc7531 9
stefanrousseau 69:5a3414cc7531 10 Unless required by applicable law or agreed to in writing,
stefanrousseau 69:5a3414cc7531 11 software distributed under the License is distributed on an
stefanrousseau 69:5a3414cc7531 12 "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
stefanrousseau 69:5a3414cc7531 13 either express or implied. See the License for the specific
stefanrousseau 69:5a3414cc7531 14 language governing permissions and limitations under the License.
stefanrousseau 69:5a3414cc7531 15
stefanrousseau 69:5a3414cc7531 16 ======================================================================== */
stefanrousseau 69:5a3414cc7531 17
stefanrousseau 69:5a3414cc7531 18 #include "mbed.h"
stefanrousseau 69:5a3414cc7531 19 #include "xadow_gps.h"
stefanrousseau 69:5a3414cc7531 20 #include "hardware.h"
stefanrousseau 69:5a3414cc7531 21
stefanrousseau 69:5a3414cc7531 22 // Xadow code based on Eclipse test project at
stefanrousseau 69:5a3414cc7531 23 // https://github.com/WayenWeng/Xadow_GPS_v2_test/
stefanrousseau 69:5a3414cc7531 24
stefanrousseau 69:5a3414cc7531 25 // These first 3 routines are to allow the mbed I2C to be used instead of what was in the Eclipse test code
stefanrousseau 69:5a3414cc7531 26 void dlc_i2c_configure(int slave_addr, int speed)
stefanrousseau 69:5a3414cc7531 27 {
stefanrousseau 69:5a3414cc7531 28 } //dlc_i2c_configure
stefanrousseau 69:5a3414cc7531 29
stefanrousseau 69:5a3414cc7531 30 unsigned char dlc_i2c_receive_byte(void)
stefanrousseau 69:5a3414cc7531 31 {
stefanrousseau 69:5a3414cc7531 32 char rxbuffer [1];
stefanrousseau 69:5a3414cc7531 33 i2c.read(GPS_DEVICE_ADDR, rxbuffer, 1 );
stefanrousseau 69:5a3414cc7531 34 return (unsigned char)rxbuffer[0];
stefanrousseau 69:5a3414cc7531 35 } //dlc_i2c_receive_byte()
stefanrousseau 69:5a3414cc7531 36
stefanrousseau 69:5a3414cc7531 37 unsigned char dlc_i2c_send_byte(unsigned char ucData)
stefanrousseau 69:5a3414cc7531 38 {
stefanrousseau 69:5a3414cc7531 39 int status;
stefanrousseau 69:5a3414cc7531 40 char txbuffer [1];
stefanrousseau 69:5a3414cc7531 41 txbuffer[0] = (char)ucData;
stefanrousseau 69:5a3414cc7531 42 status = i2c.write(GPS_DEVICE_ADDR, txbuffer, 1, false); //true: do not send stop
stefanrousseau 69:5a3414cc7531 43 return status;
stefanrousseau 69:5a3414cc7531 44 } //dlc_i2c_send_byte()
stefanrousseau 69:5a3414cc7531 45
stefanrousseau 69:5a3414cc7531 46
stefanrousseau 69:5a3414cc7531 47 unsigned char gps_check_online(void)
stefanrousseau 69:5a3414cc7531 48 {
stefanrousseau 69:5a3414cc7531 49 unsigned char data[GPS_SCAN_SIZE+2];
stefanrousseau 69:5a3414cc7531 50 unsigned char i;
stefanrousseau 69:5a3414cc7531 51
stefanrousseau 69:5a3414cc7531 52 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 53
stefanrousseau 69:5a3414cc7531 54 dlc_i2c_send_byte(GPS_SCAN_ID);
stefanrousseau 69:5a3414cc7531 55
stefanrousseau 69:5a3414cc7531 56 for(i=0;i<(GPS_SCAN_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 57 {
stefanrousseau 69:5a3414cc7531 58 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 59 }
stefanrousseau 69:5a3414cc7531 60
stefanrousseau 69:5a3414cc7531 61 if(data[5] == GPS_DEVICE_ID)
stefanrousseau 69:5a3414cc7531 62 return 1;
stefanrousseau 69:5a3414cc7531 63 else return 0;
stefanrousseau 69:5a3414cc7531 64 }
stefanrousseau 69:5a3414cc7531 65
stefanrousseau 69:5a3414cc7531 66 unsigned char gps_utc_date_time[GPS_UTC_DATE_TIME_SIZE] = {0};
stefanrousseau 69:5a3414cc7531 67
stefanrousseau 69:5a3414cc7531 68 unsigned char* gps_get_utc_date_time(void)
stefanrousseau 69:5a3414cc7531 69 {
stefanrousseau 69:5a3414cc7531 70 unsigned char data[GPS_UTC_DATE_TIME_SIZE+2];
stefanrousseau 69:5a3414cc7531 71 unsigned char i;
stefanrousseau 69:5a3414cc7531 72
stefanrousseau 69:5a3414cc7531 73 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 74
stefanrousseau 69:5a3414cc7531 75 dlc_i2c_send_byte(GPS_UTC_DATE_TIME_ID);
stefanrousseau 69:5a3414cc7531 76
stefanrousseau 69:5a3414cc7531 77 for(i=0;i<(GPS_UTC_DATE_TIME_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 78 {
stefanrousseau 69:5a3414cc7531 79 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 80 }
stefanrousseau 69:5a3414cc7531 81
stefanrousseau 69:5a3414cc7531 82 for(i=0;i<GPS_UTC_DATE_TIME_SIZE;i++)
stefanrousseau 69:5a3414cc7531 83 gps_utc_date_time[i] = data[i+2];
stefanrousseau 69:5a3414cc7531 84
stefanrousseau 69:5a3414cc7531 85 return gps_utc_date_time;
stefanrousseau 69:5a3414cc7531 86 }
stefanrousseau 69:5a3414cc7531 87
stefanrousseau 69:5a3414cc7531 88 unsigned char gps_get_status(void)
stefanrousseau 69:5a3414cc7531 89 {
stefanrousseau 69:5a3414cc7531 90 unsigned char data[GPS_STATUS_SIZE+2];
stefanrousseau 69:5a3414cc7531 91 unsigned char i;
stefanrousseau 69:5a3414cc7531 92
stefanrousseau 69:5a3414cc7531 93 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 94
stefanrousseau 69:5a3414cc7531 95 dlc_i2c_send_byte(GPS_STATUS_ID);
stefanrousseau 69:5a3414cc7531 96 for(i=0;i<(GPS_STATUS_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 97 {
stefanrousseau 69:5a3414cc7531 98 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 99 }
stefanrousseau 69:5a3414cc7531 100
stefanrousseau 69:5a3414cc7531 101 return data[2];
stefanrousseau 69:5a3414cc7531 102 }
stefanrousseau 69:5a3414cc7531 103
stefanrousseau 69:5a3414cc7531 104 float gps_get_latitude(void)
stefanrousseau 69:5a3414cc7531 105 {
stefanrousseau 69:5a3414cc7531 106 char data[GPS_LATITUDE_SIZE+2];
stefanrousseau 69:5a3414cc7531 107 unsigned char i;
stefanrousseau 69:5a3414cc7531 108
stefanrousseau 69:5a3414cc7531 109 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 110
stefanrousseau 69:5a3414cc7531 111 dlc_i2c_send_byte(GPS_LATITUDE_ID);
stefanrousseau 69:5a3414cc7531 112 for(i=0;i<(GPS_LATITUDE_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 113 {
stefanrousseau 69:5a3414cc7531 114 data[i] = (char)dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 115 }
stefanrousseau 69:5a3414cc7531 116
stefanrousseau 69:5a3414cc7531 117 return atof(&data[2]);
stefanrousseau 69:5a3414cc7531 118 }
stefanrousseau 69:5a3414cc7531 119
stefanrousseau 69:5a3414cc7531 120 unsigned char gps_get_ns(void)
stefanrousseau 69:5a3414cc7531 121 {
stefanrousseau 69:5a3414cc7531 122 unsigned char data[GPS_NS_SIZE+2];
stefanrousseau 69:5a3414cc7531 123 unsigned char i;
stefanrousseau 69:5a3414cc7531 124
stefanrousseau 69:5a3414cc7531 125 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 126
stefanrousseau 69:5a3414cc7531 127 dlc_i2c_send_byte(GPS_NS_ID);
stefanrousseau 69:5a3414cc7531 128 for(i=0;i<(GPS_NS_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 129 {
stefanrousseau 69:5a3414cc7531 130 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 131 }
stefanrousseau 69:5a3414cc7531 132
stefanrousseau 69:5a3414cc7531 133 if(data[2] == 'N' || data[2] == 'S')return data[2];
stefanrousseau 69:5a3414cc7531 134 else return data[2] = '-';
stefanrousseau 69:5a3414cc7531 135
stefanrousseau 69:5a3414cc7531 136 }
stefanrousseau 69:5a3414cc7531 137
stefanrousseau 69:5a3414cc7531 138 float gps_get_longitude(void)
stefanrousseau 69:5a3414cc7531 139 {
stefanrousseau 69:5a3414cc7531 140 char data[GPS_LONGITUDE_SIZE+2];
stefanrousseau 69:5a3414cc7531 141 unsigned char i;
stefanrousseau 69:5a3414cc7531 142
stefanrousseau 69:5a3414cc7531 143 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 144
stefanrousseau 69:5a3414cc7531 145 dlc_i2c_send_byte(GPS_LONGITUDE_ID);
stefanrousseau 69:5a3414cc7531 146 for(i=0;i<(GPS_LONGITUDE_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 147 {
stefanrousseau 69:5a3414cc7531 148 data[i] = (char)dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 149 }
stefanrousseau 69:5a3414cc7531 150
stefanrousseau 69:5a3414cc7531 151 return atof(&data[2]);
stefanrousseau 69:5a3414cc7531 152 }
stefanrousseau 69:5a3414cc7531 153
stefanrousseau 69:5a3414cc7531 154 unsigned char gps_get_ew(void)
stefanrousseau 69:5a3414cc7531 155 {
stefanrousseau 69:5a3414cc7531 156 unsigned char data[GPS_EW_SIZE+2];
stefanrousseau 69:5a3414cc7531 157 unsigned char i;
stefanrousseau 69:5a3414cc7531 158
stefanrousseau 69:5a3414cc7531 159 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 160
stefanrousseau 69:5a3414cc7531 161 dlc_i2c_send_byte(GPS_EW_ID);
stefanrousseau 69:5a3414cc7531 162 for(i=0;i<(GPS_EW_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 163 {
stefanrousseau 69:5a3414cc7531 164 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 165 }
stefanrousseau 69:5a3414cc7531 166
stefanrousseau 69:5a3414cc7531 167 if(data[2] == 'E' || data[2] == 'W')return data[2];
stefanrousseau 69:5a3414cc7531 168 else return data[2] = '-';
stefanrousseau 69:5a3414cc7531 169 }
stefanrousseau 69:5a3414cc7531 170
stefanrousseau 69:5a3414cc7531 171 float gps_get_speed(void)
stefanrousseau 69:5a3414cc7531 172 {
stefanrousseau 69:5a3414cc7531 173 char data[GPS_SPEED_SIZE+2];
stefanrousseau 69:5a3414cc7531 174 unsigned char i;
stefanrousseau 69:5a3414cc7531 175
stefanrousseau 69:5a3414cc7531 176 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 177
stefanrousseau 69:5a3414cc7531 178 dlc_i2c_send_byte(GPS_SPEED_ID);
stefanrousseau 69:5a3414cc7531 179 for(i=0;i<(GPS_SPEED_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 180 {
stefanrousseau 69:5a3414cc7531 181 data[i] = (char)dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 182 }
stefanrousseau 69:5a3414cc7531 183
stefanrousseau 69:5a3414cc7531 184 return atof(&data[2]);
stefanrousseau 69:5a3414cc7531 185 }
stefanrousseau 69:5a3414cc7531 186
stefanrousseau 69:5a3414cc7531 187 float gps_get_course(void)
stefanrousseau 69:5a3414cc7531 188 {
stefanrousseau 69:5a3414cc7531 189 char data[GPS_COURSE_SIZE+2];
stefanrousseau 69:5a3414cc7531 190 unsigned char i;
stefanrousseau 69:5a3414cc7531 191
stefanrousseau 69:5a3414cc7531 192 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 193
stefanrousseau 69:5a3414cc7531 194 dlc_i2c_send_byte(GPS_COURSE_ID);
stefanrousseau 69:5a3414cc7531 195 for(i=0;i<(GPS_COURSE_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 196 {
stefanrousseau 69:5a3414cc7531 197 data[i] = (char)dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 198 }
stefanrousseau 69:5a3414cc7531 199
stefanrousseau 69:5a3414cc7531 200 return atof(&data[2]);
stefanrousseau 69:5a3414cc7531 201 }
stefanrousseau 69:5a3414cc7531 202
stefanrousseau 69:5a3414cc7531 203 unsigned char gps_get_position_fix(void)
stefanrousseau 69:5a3414cc7531 204 {
stefanrousseau 69:5a3414cc7531 205 unsigned char data[GPS_POSITION_FIX_SIZE+2];
stefanrousseau 69:5a3414cc7531 206 unsigned char i;
stefanrousseau 69:5a3414cc7531 207
stefanrousseau 69:5a3414cc7531 208 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 209
stefanrousseau 69:5a3414cc7531 210 dlc_i2c_send_byte(GPS_POSITION_FIX_ID);
stefanrousseau 69:5a3414cc7531 211 for(i=0;i<(GPS_POSITION_FIX_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 212 {
stefanrousseau 69:5a3414cc7531 213 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 214 }
stefanrousseau 69:5a3414cc7531 215
stefanrousseau 69:5a3414cc7531 216 return data[2];
stefanrousseau 69:5a3414cc7531 217 }
stefanrousseau 69:5a3414cc7531 218
stefanrousseau 69:5a3414cc7531 219 unsigned char gps_get_sate_used(void)
stefanrousseau 69:5a3414cc7531 220 {
stefanrousseau 69:5a3414cc7531 221 unsigned char data[GPS_SATE_USED_SIZE+2];
stefanrousseau 69:5a3414cc7531 222 unsigned char i;
stefanrousseau 69:5a3414cc7531 223 unsigned char value;
stefanrousseau 69:5a3414cc7531 224
stefanrousseau 69:5a3414cc7531 225 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 226
stefanrousseau 69:5a3414cc7531 227 dlc_i2c_send_byte(GPS_SATE_USED_ID);
stefanrousseau 69:5a3414cc7531 228 for(i=0;i<(GPS_SATE_USED_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 229 {
stefanrousseau 69:5a3414cc7531 230 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 231 }
stefanrousseau 69:5a3414cc7531 232
stefanrousseau 69:5a3414cc7531 233 if(data[3] >= '0' && data[3] <= '9')value = (data[3] - '0') * 10;
stefanrousseau 69:5a3414cc7531 234 else value = 0;
stefanrousseau 69:5a3414cc7531 235 if(data[2] >= '0' && data[2] <= '9')value += (data[2] - '0');
stefanrousseau 69:5a3414cc7531 236 else value += 0;
stefanrousseau 69:5a3414cc7531 237
stefanrousseau 69:5a3414cc7531 238 return value;
stefanrousseau 69:5a3414cc7531 239 }
stefanrousseau 69:5a3414cc7531 240
stefanrousseau 69:5a3414cc7531 241 float gps_get_altitude(void)
stefanrousseau 69:5a3414cc7531 242 {
stefanrousseau 69:5a3414cc7531 243 char data[GPS_ALTITUDE_SIZE+2];
stefanrousseau 69:5a3414cc7531 244 unsigned char i;
stefanrousseau 69:5a3414cc7531 245
stefanrousseau 69:5a3414cc7531 246 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 247
stefanrousseau 69:5a3414cc7531 248 dlc_i2c_send_byte(GPS_ALTITUDE_ID);
stefanrousseau 69:5a3414cc7531 249 for(i=0;i<(GPS_ALTITUDE_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 250 {
stefanrousseau 69:5a3414cc7531 251 data[i] = (char)dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 252 }
stefanrousseau 69:5a3414cc7531 253
stefanrousseau 69:5a3414cc7531 254 return atof(&data[2]);
stefanrousseau 69:5a3414cc7531 255 }
stefanrousseau 69:5a3414cc7531 256
stefanrousseau 69:5a3414cc7531 257 unsigned char gps_get_mode(void)
stefanrousseau 69:5a3414cc7531 258 {
stefanrousseau 69:5a3414cc7531 259 unsigned char data[GPS_MODE_SIZE+2];
stefanrousseau 69:5a3414cc7531 260 unsigned char i;
stefanrousseau 69:5a3414cc7531 261
stefanrousseau 69:5a3414cc7531 262 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 263
stefanrousseau 69:5a3414cc7531 264 dlc_i2c_send_byte(GPS_MODE_ID);
stefanrousseau 69:5a3414cc7531 265 for(i=0;i<(GPS_MODE_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 266 {
stefanrousseau 69:5a3414cc7531 267 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 268 }
stefanrousseau 69:5a3414cc7531 269
stefanrousseau 69:5a3414cc7531 270 return data[2];
stefanrousseau 69:5a3414cc7531 271 }
stefanrousseau 69:5a3414cc7531 272
stefanrousseau 69:5a3414cc7531 273 unsigned char gps_get_mode2(void)
stefanrousseau 69:5a3414cc7531 274 {
stefanrousseau 69:5a3414cc7531 275 unsigned char data[GPS_MODE2_SIZE+2];
stefanrousseau 69:5a3414cc7531 276 unsigned char i;
stefanrousseau 69:5a3414cc7531 277
stefanrousseau 69:5a3414cc7531 278 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 279
stefanrousseau 69:5a3414cc7531 280 dlc_i2c_send_byte(GPS_MODE2_ID);
stefanrousseau 69:5a3414cc7531 281 for(i=0;i<(GPS_MODE2_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 282 {
stefanrousseau 69:5a3414cc7531 283 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 284 }
stefanrousseau 69:5a3414cc7531 285
stefanrousseau 69:5a3414cc7531 286 return data[2];
stefanrousseau 69:5a3414cc7531 287 }
stefanrousseau 69:5a3414cc7531 288
stefanrousseau 69:5a3414cc7531 289 unsigned char gps_get_sate_in_veiw(void)
stefanrousseau 69:5a3414cc7531 290 {
stefanrousseau 69:5a3414cc7531 291 unsigned char data[GPS_SATE_IN_VIEW_SIZE+2];
stefanrousseau 69:5a3414cc7531 292 unsigned char i;
stefanrousseau 69:5a3414cc7531 293
stefanrousseau 69:5a3414cc7531 294 dlc_i2c_configure(GPS_DEVICE_ADDR, 100);
stefanrousseau 69:5a3414cc7531 295
stefanrousseau 69:5a3414cc7531 296 dlc_i2c_send_byte(GPS_SATE_IN_VIEW_ID);
stefanrousseau 69:5a3414cc7531 297 for(i=0;i<(GPS_SATE_IN_VIEW_SIZE+2);i++)
stefanrousseau 69:5a3414cc7531 298 {
stefanrousseau 69:5a3414cc7531 299 data[i] = dlc_i2c_receive_byte();
stefanrousseau 69:5a3414cc7531 300 }
stefanrousseau 69:5a3414cc7531 301
stefanrousseau 69:5a3414cc7531 302 return data[2];
stefanrousseau 69:5a3414cc7531 303 }