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-03
- Revision:
- 1:a6c13143b151
- Parent:
- 0:8a18ceffce1b
- Child:
- 3:4eefc032a319
File content as of revision 1:a6c13143b151:
#ifndef __DETECTION_H_ #define __DETECTION_H__ #include <rgb_sensor.h> #define DETECTION_VALUES (15) 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_Sensor m_rgb; Capsule const *m_last_capsule; uint32_t m_buffer_pos; TRGB m_buffer[DETECTION_VALUES]; private: static bool __callback(const TRGB &color); bool callback(const TRGB &color); static RGB_Detection *m_global; }; const char* do_detection(); #endif // __DETECTION_H__