Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed DMX TextLCD mbed-rtos
ArtNet.h
- Committer:
- Ayrton_L
- Date:
- 2016-03-17
- Revision:
- 27:1bd34c90e0a9
- Parent:
- 23:2ed8390eaf32
- Child:
- 28:4b327f1cb9cb
File content as of revision 27:1bd34c90e0a9:
#ifndef ARTNET_H #define ARTNET_H #include "mbed.h" #include "EthernetInterface.h" Ethernet eth; using namespace std; class ArtNet { public: ArtNet(); ~ArtNet(); void V_ArtNet(); uint32_t I32_CheckHeader(char C_Header[7]); uint32_t I32_Universes[2]; private: char C_Buf[572]; char C_ID[8]; uint16_t I16_OPCode; uint16_t I16_ProtocolVersie; uint16_t I16_Universe; uint8_t I8_Values[2][511]; }; ArtNet::ArtNet() { char C_Buf[572] = {""}; uint16_t I16_OPCode = 0x5000; uint16_t I16_ProtocolVersie = 14; uint16_t I16_Universe = 0; uint8_t I8_Values[2][511]; } ArtNet::~ArtNet() { } void ArtNet::V_ArtNet() { while(1) { int size = eth.receive(); if(size > 0) { eth.read(C_Buf, size); if(C_Buf[34] == 0x19 and C_Buf[35] == 0x36 and C_Buf[36] == 0x19 and C_Buf[37] == 0x36) { char C_ID[7]; memcpy(C_ID, &C_Buf[42], 7); if(ArtNet::I32_CheckHeader(C_ID) == 0) { if(C_Buf[50] == 0x00 and C_Buf[51]== 0x50) { if(C_Buf[52] == 0x00 and C_Buf[53]== 0x0E) { } } } } } wait(1); } } uint32_t ArtNet::I32_CheckHeader(char C_Header[6]) { if(C_Header[0] == 'A') { if(C_Header[1] == 'r') { if(C_Header[2] == 't') { if(C_Header[3] == '-') { if(C_Header[4] == 'N') { if(C_Header[5] == 'e') { if(C_Header[6] == 't') { return 0; } else { return 1; } } else { return 1; } } else { return 1; } } else { return 1; } } else { return 1; } } else { return 1; } } else { return 1; } } #endif