Andriy Makukha / Mbed 2 deprecated football_project_wo_output

Dependencies:   mbed

Fork of football_project by MZJ

Revision:
17:d8b901d791fd
Child:
30:c60b0d52b067
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/TA.h	Tue Nov 03 07:05:15 2015 +0000
@@ -0,0 +1,133 @@
+#ifndef TA_H
+#define TA_H
+
+#include <mbed.h>
+
+#include "ByteBuffer.h"
+#include "neopixel.h"
+
+#define DATA_SIZE 24
+#define SILENT 0x20
+
+struct Message 
+{
+    char command;
+    uint32_t value;
+    uint8_t cone;
+};
+
+class TA
+{
+private:
+// You will need to initialize the radio by telling it what ID it has and what network it's on
+// The NodeID takes values from 1-127, 0 is reserved for sending broadcast messages (send to all nodes)
+// The Network ID takes values from 0-255
+// By default the SPI-SS line used is D10 on Atmega328. You can change it by calling .SetCS(pin) where pin can be {8,9,10}
+static uint8_t node_id; //        1  //network ID used for this unit
+static uint8_t network_id;//    99  //network ID used for this network
+static uint8_t gateway_id;//     1  //the ID of the network controller
+static uint8_t ack_time;//     50  // # of ms to wait for an ack
+
+static ByteBuffer send_buffer; 
+static ByteBuffer receive_buffer;
+
+//encryption is OPTIONAL
+//to enable encryption you will need to:
+// - provide a 16-byte encryption KEY (same on all nodes that talk encrypted)
+// - to call .Encrypt(KEY) to start encrypting
+// - to stop encrypting call .Encrypt(NULL)
+static uint8_t KEY[];// = "ABCDABCDABCDABCD";
+static uint16_t interPacketDelay;// = 1000; //wait this many ms between sending packets
+
+// Need an instance of the Radio Module
+unsigned char sendSize;//=0;
+char payload[];// = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+bool requestACK;//=true;
+
+//static neopixels_spi neopixels;
+
+// LED controller
+static DigitalOut SDI;
+static DigitalOut CKI;
+
+//static uint32_t last_rgb;
+
+// outputs
+//static uint8_t buzzPin;
+//static uint8_t capPin;
+static uint8_t red;
+static uint8_t green;
+static uint8_t blue;
+
+static DigitalOut enable_1;
+static DigitalOut enable_2;
+static DigitalOut enable_3;
+
+static DigitalOut cap_enable;
+static DigitalOut buzzPin;
+
+static DigitalIn touch_1;
+static DigitalIn touch_2;
+static DigitalIn touch_3;
+
+
+// lights
+static uint8_t mask;
+
+// beeping
+bool beeping;
+unsigned long beep_start;
+unsigned long beep_duration;
+
+// pulsing
+uint32_t current_color;
+bool pulsing;
+unsigned long pulse_start;
+unsigned long pulse_period;
+unsigned long pulse_on;
+unsigned long pulse_duration;
+
+bool powering_up1;
+bool powering_up2;
+unsigned long powerup_start;
+unsigned long powerup_toggle;
+
+// private functions
+bool waitForAck(int cone);
+void ledSetup(void);
+bool _send(char *message, uint8_t cone);
+bool _recieve(void);  
+public:
+//constructor
+TA();
+
+char data[DATA_SIZE];
+//static uint8_t networkID;         // network group
+
+void post_color(uint32_t rgb);
+void mask_color(uint32_t rgb);
+void beep(uint16_t ms);
+void beep_off(void);
+void powerup(uint8_t);
+void pulse(uint16_t on_time, uint16_t period, uint16_t ms, uint32_t rgb);
+void pulse_off(void);
+int get_buffer_size(void);
+bool send(Message *m);
+void send_immediate(Message *m);
+bool sendRaw(uint8_t *message, uint8_t len, uint8_t cone);
+bool recieve(Message *m);
+void spin(void);
+bool activated(void);
+bool tripped(void);
+uint8_t buttons(void);
+void setMask(uint8_t the_mask);
+void initialize(uint8_t address);
+
+void Ram_TableDisplay(void);
+void get_free_memory(void);
+void check_mem(void);
+
+};
+
+
+#endif