Colour binning for Nespresso capsules using rgb_sensor (RGB LED & Photo Diode) - to detect flavour based on colour

Dependencies:   rgb_sensor_buffer

Dependents:   coffee_capsule_detection

detection.h

Committer:
bjblazkowicz
Date:
2014-07-11
Revision:
3:4eefc032a319
Parent:
1:a6c13143b151

File content as of revision 3:4eefc032a319:

#ifndef __DETECTION_H_
#define __DETECTION_H__

#include <rgb_sensor_buffer.h>

#define RGB_VALUES (50)

struct Capsule {
    const char* name;
    double r, g, b;
};

class RGB_Detection {

    public:
        RGB_Detection(PinName red, PinName green, PinName blue, PinName adc);
        ~RGB_Detection(void);
        const char *run(void);
        
    protected:
        int match_sample_to_capsule(TRGB& rgb_sample);        
        const Capsule *read_capsule(void);

        RGB_SensorBuffer m_rgb;
        Capsule const *m_last_capsule;
        
        TRGB m_buffer[RGB_VALUES];
        
//    private:
//        static bool __callback(const TRGB &color);
//        bool callback(const TRGB &color);
//        static RGB_Detection *m_global;
};

#endif // __DETECTION_H__