DMX DeBUG clone source code

Dependencies:   TextLCD mbed

Committer:
User_4574
Date:
Tue Dec 06 22:31:21 2011 +0000
Revision:
0:64cb39e64128
DRAFT

Who changed what in which revision?

UserRevisionLine numberNew contents of line
User_4574 0:64cb39e64128 1 #include "mbed.h"
User_4574 0:64cb39e64128 2 #include "DMXPacket.h"
User_4574 0:64cb39e64128 3 #include "iface.h"
User_4574 0:64cb39e64128 4 #include "TextLCD.h"
User_4574 0:64cb39e64128 5
User_4574 0:64cb39e64128 6 DigitalOut dmx(p20);
User_4574 0:64cb39e64128 7 InterruptIn intr(p29);
User_4574 0:64cb39e64128 8 I2C io(p28, p27);
User_4574 0:64cb39e64128 9
User_4574 0:64cb39e64128 10 TextLCD lcd(p16, p15, p13, p12, p11, p10); // rs, e, d4-d7
User_4574 0:64cb39e64128 11
User_4574 0:64cb39e64128 12 int channelPointer = 0;
User_4574 0:64cb39e64128 13 char* channelData = (char*) calloc(CHANNELCOUNT, sizeof(char));
User_4574 0:64cb39e64128 14 int waddr = 0x40;
User_4574 0:64cb39e64128 15 int raddr = waddr+1;
User_4574 0:64cb39e64128 16
User_4574 0:64cb39e64128 17 int main() {
User_4574 0:64cb39e64128 18 char byte[1];
User_4574 0:64cb39e64128 19 io.frequency(100000);
User_4574 0:64cb39e64128 20 byte[0]=0x0F;
User_4574 0:64cb39e64128 21 io.write(waddr, byte, 1);
User_4574 0:64cb39e64128 22
User_4574 0:64cb39e64128 23 intr.fall(&keypress);
User_4574 0:64cb39e64128 24
User_4574 0:64cb39e64128 25 init(&dmx);
User_4574 0:64cb39e64128 26
User_4574 0:64cb39e64128 27 lcd.cls();
User_4574 0:64cb39e64128 28 lcd.printf(" Welcome to\n ** DMXDebug! **");
User_4574 0:64cb39e64128 29 wait(2);
User_4574 0:64cb39e64128 30 lcd.cls();
User_4574 0:64cb39e64128 31
User_4574 0:64cb39e64128 32 //printf("\r\nWelcome to DMXDebug!\r\n");
User_4574 0:64cb39e64128 33 while (1) {
User_4574 0:64cb39e64128 34 //printf("\rChannel: %03d\t\tData: %03d", channelPointer, channelData[channelPointer]);
User_4574 0:64cb39e64128 35 lcd.locate(0, 0);
User_4574 0:64cb39e64128 36 lcd.printf("Channel : %03d\n Data : %03d", channelPointer, channelData[channelPointer]);
User_4574 0:64cb39e64128 37 writePacket(&dmx, channelData, CHANNELCOUNT);
User_4574 0:64cb39e64128 38 }
User_4574 0:64cb39e64128 39 }