Nespresso coffee demo working on the Arch Pro

Dependencies:   EthernetInterface mbed-rtos mbed nsdl rgb_sensor_buffer

Fork of mbed_nsdl by Nespresso RGB Sensor

Committer:
bjblazkowicz
Date:
Fri Jul 18 10:47:23 2014 +0000
Revision:
6:8729a0db0e25
Added buffered_rgb_resource. Resource is now array of up to 300 samples.

Who changed what in which revision?

UserRevisionLine numberNew contents of line
bjblazkowicz 6:8729a0db0e25 1 /*
bjblazkowicz 6:8729a0db0e25 2 * Builds the payload to send to the server.
bjblazkowicz 6:8729a0db0e25 3 *
bjblazkowicz 6:8729a0db0e25 4 * Copyright (c) 2014 ARM Limited
bjblazkowicz 6:8729a0db0e25 5 *
bjblazkowicz 6:8729a0db0e25 6 * Licensed under the Apache License, Version 2.0 (the "License");
bjblazkowicz 6:8729a0db0e25 7 * you may not use this file except in compliance with the License.
bjblazkowicz 6:8729a0db0e25 8 * You may obtain a copy of the License at
bjblazkowicz 6:8729a0db0e25 9 *
bjblazkowicz 6:8729a0db0e25 10 * http://www.apache.org/licenses/LICENSE-2.0
bjblazkowicz 6:8729a0db0e25 11 *
bjblazkowicz 6:8729a0db0e25 12 * Unless required by applicable law or agreed to in writing, software
bjblazkowicz 6:8729a0db0e25 13 * distributed under the License is distributed on an "AS IS" BASIS,
bjblazkowicz 6:8729a0db0e25 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
bjblazkowicz 6:8729a0db0e25 15 * See the License for the specific language governing permissions and
bjblazkowicz 6:8729a0db0e25 16 * limitations under the License.
bjblazkowicz 6:8729a0db0e25 17 */
bjblazkowicz 6:8729a0db0e25 18
bjblazkowicz 6:8729a0db0e25 19 #ifndef _PAYLOAD_H
bjblazkowicz 6:8729a0db0e25 20 #define _PAYLOAD_H
bjblazkowicz 6:8729a0db0e25 21 #include "rgb_sensor.h"
bjblazkowicz 6:8729a0db0e25 22
bjblazkowicz 6:8729a0db0e25 23 // TODO: include from common file
bjblazkowicz 6:8729a0db0e25 24 #ifndef RGB_VALUES
bjblazkowicz 6:8729a0db0e25 25 #define RGB_VALUES 512
bjblazkowicz 6:8729a0db0e25 26 #endif
bjblazkowicz 6:8729a0db0e25 27
bjblazkowicz 6:8729a0db0e25 28 class Payload
bjblazkowicz 6:8729a0db0e25 29 {
bjblazkowicz 6:8729a0db0e25 30 public:
bjblazkowicz 6:8729a0db0e25 31 Payload();
bjblazkowicz 6:8729a0db0e25 32
bjblazkowicz 6:8729a0db0e25 33 void build(const TRGB *samples, int sample_count);
bjblazkowicz 6:8729a0db0e25 34 int raw_bytes_size();
bjblazkowicz 6:8729a0db0e25 35 uint8_t* raw_bytes() const;
bjblazkowicz 6:8729a0db0e25 36
bjblazkowicz 6:8729a0db0e25 37 private:
bjblazkowicz 6:8729a0db0e25 38 typedef struct
bjblazkowicz 6:8729a0db0e25 39 {
bjblazkowicz 6:8729a0db0e25 40 int sample_count;
bjblazkowicz 6:8729a0db0e25 41 int mean[3];
bjblazkowicz 6:8729a0db0e25 42 signed char deltas[RGB_VALUES][3];
bjblazkowicz 6:8729a0db0e25 43 } MeanDeltaBuffer;
bjblazkowicz 6:8729a0db0e25 44
bjblazkowicz 6:8729a0db0e25 45 MeanDeltaBuffer m_mdb;
bjblazkowicz 6:8729a0db0e25 46 int m_mdb_bytes;
bjblazkowicz 6:8729a0db0e25 47 };
bjblazkowicz 6:8729a0db0e25 48
bjblazkowicz 6:8729a0db0e25 49 #endif // _PAYLOAD_H