Modified version of the UKESF lab source which can be carried out with no knowledge of C

Fork of PsiSwarm-Headstart by UKESF Headstart Summer School

Committer:
YRL50
Date:
Fri Sep 14 16:00:48 2018 +0000
Revision:
5:f6be169e465b
Parent:
2:c6986ee3c7c5
Fixing compile warnings

Who changed what in which revision?

UserRevisionLine numberNew contents of line
jah128 0:d6269d17c8cf 1 /* University of York Robotics Laboratory PsiSwarm Library: Colour Sensors Source File
jah128 0:d6269d17c8cf 2 *
jah128 0:d6269d17c8cf 3 * File: colour.cpp
jah128 0:d6269d17c8cf 4 *
jah128 0:d6269d17c8cf 5 * (C) Dept. Electronics & Computer Science, University of York
jah128 0:d6269d17c8cf 6 * James Hilder, Alan Millard, Alexander Horsfield, Homero Elizondo, Jon Timmis
jah128 0:d6269d17c8cf 7 *
jah128 2:c6986ee3c7c5 8 * PsiSwarm Library Version: 0.41
jah128 0:d6269d17c8cf 9 *
jah128 2:c6986ee3c7c5 10 * March 2016
jah128 0:d6269d17c8cf 11 *
jah128 0:d6269d17c8cf 12 */
jah128 0:d6269d17c8cf 13
jah128 0:d6269d17c8cf 14
jah128 0:d6269d17c8cf 15 // Base colour sensor is a TCS34725
jah128 0:d6269d17c8cf 16 // Top colour sensor (if fitted) is a TCS34721
jah128 0:d6269d17c8cf 17 #include "psiswarm.h"
jah128 0:d6269d17c8cf 18
jah128 0:d6269d17c8cf 19
jah128 0:d6269d17c8cf 20 void read_base_colour_sensor_values(int * store_array){
jah128 0:d6269d17c8cf 21
jah128 0:d6269d17c8cf 22 }
jah128 0:d6269d17c8cf 23
jah128 0:d6269d17c8cf 24 void set_base_colour_sensor_gain(char gain){
jah128 0:d6269d17c8cf 25
jah128 0:d6269d17c8cf 26 }
jah128 0:d6269d17c8cf 27
jah128 0:d6269d17c8cf 28 void set_base_colour_sensor_integration_time(char int_time){
jah128 0:d6269d17c8cf 29
jah128 0:d6269d17c8cf 30 }
jah128 0:d6269d17c8cf 31
jah128 0:d6269d17c8cf 32 void enable_base_colour_sensor(void){
jah128 0:d6269d17c8cf 33
jah128 0:d6269d17c8cf 34 }
jah128 0:d6269d17c8cf 35
jah128 0:d6269d17c8cf 36 char IF_check_base_colour_sensor(void){
jah128 0:d6269d17c8cf 37 //Reads the device ID flag of the colour sensor [0xB2]
jah128 0:d6269d17c8cf 38 //This should equal 0x44 for both TCS34721 (top) and TCS34725 (base) sensors
jah128 0:d6269d17c8cf 39 //Return a 1 if successful or a 0 otherwise
jah128 0:d6269d17c8cf 40 char return_value = 0;
jah128 0:d6269d17c8cf 41 char data[1] = {0x00};
jah128 0:d6269d17c8cf 42 char command[1] = {0xB2};
jah128 0:d6269d17c8cf 43 primary_i2c.write(BASE_COLOUR_ADDRESS, command, 1, false);
jah128 0:d6269d17c8cf 44 primary_i2c.read(BASE_COLOUR_ADDRESS, data, 1, false);
jah128 0:d6269d17c8cf 45 if(data[0] == 0x44) return_value = 1;
jah128 0:d6269d17c8cf 46 else debug("Invalid response from colour sensor:%X\n",data[0]);
jah128 0:d6269d17c8cf 47 return return_value;
jah128 0:d6269d17c8cf 48 }