Science Memeseum / Mbed 2 deprecated BeaconDemo_RobotCode

Dependencies:   mbed

Fork of PsiSwarm-BeaconDemo_Bluetooth by James Wilson

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers colour.cpp Source File

colour.cpp

00001 /* University of York Robotics Laboratory PsiSwarm Library: Colour Sensors Source File
00002  * 
00003  * File: colour.cpp
00004  *
00005  * (C) Dept. Electronics & Computer Science, University of York
00006  * James Hilder, Alan Millard, Homero Elizondo, Jon Timmis
00007  *
00008  * PsiSwarm Library Version: 0.3
00009  *
00010  * October 2015
00011  *
00012  */
00013 
00014 
00015 // Base colour sensor is a TCS34725
00016 // Top colour sensor (if fitted) is a TCS34721
00017 #include "psiswarm.h"
00018 
00019 
00020 void read_base_colour_sensor_values(int * store_array){
00021     
00022 }
00023 
00024 void set_base_colour_sensor_gain(char gain){
00025     
00026 }
00027 
00028 void set_base_colour_sensor_integration_time(char int_time){
00029     
00030 }
00031 
00032 void enable_base_colour_sensor(void){
00033     
00034 }
00035 
00036 char IF_check_base_colour_sensor(void){
00037     //Reads the device ID flag of the colour sensor [0xB2]
00038     //This should equal 0x44 for both TCS34721 (top) and TCS34725 (base) sensors
00039     //Return a 1 if successful or a 0 otherwise
00040     char return_value = 0;
00041     char data[1] = {0x00};
00042     char command[1] = {0xB2};
00043     primary_i2c.write(BASE_COLOUR_ADDRESS, command, 1, false);
00044     primary_i2c.read(BASE_COLOUR_ADDRESS, data, 1, false);
00045     if(data[0] == 0x44) return_value = 1;
00046     else debug("Invalid response from colour sensor:%X\n",data[0]);
00047     return return_value;
00048 }