/elec/audio-switcher

To get this branch, use:
bzr branch http://bzr.ed.am/elec/audio-switcher

« back to all changes in this revision

Viewing changes to src/VirtualSerial.c

  • Committer: Tim Marston
  • Date: 2012-11-22 22:01:52 UTC
  • Revision ID: tim@ed.am-20121122220152-paremcsc2gbccrjw
added timer utilities (wiring.c) from arduino library

Show diffs side-by-side

added added

removed removed

1
1
/*
2
 
             LUFA Library
3
 
     Copyright (C) Dean Camera, 2012.
4
 
 
5
 
  dean [at] fourwalledcubicle [dot] com
6
 
           www.lufa-lib.org
 
2
 
 
3
  AUDIO SWITCHER
 
4
 
 
5
  Based on a serial device demonstration from the LUFA project
 
6
  (www.lufa-lib.org).  LUFA is Copyright (C) Dean Camera, 2012.
 
7
 
 
8
  Changes made to the serial device demonstration program are
 
9
  Copyright (C) Tim Marston, 2012.
 
10
 
 
11
  For more information:
 
12
    * see README, or
 
13
    * visit http://ed.am/
 
14
 
7
15
*/
8
16
 
9
17
/*
35
43
 */
36
44
 
37
45
#include "VirtualSerial.h"
 
46
#include "wiring.h"
38
47
 
39
48
/** LUFA CDC Class driver interface configuration and state information. This structure is
40
49
 *  passed to all CDC Class driver functions, so that multiple instances of the same class
97
106
                if( !sent )
98
107
                {
99
108
                        sent = true;
100
 
                        fputs( "press\r\n", &USBSerialStream );
 
109
                        fprintf( &USBSerialStream, "%lu\r\n", millis() );
 
110
//                      fputs( "press\r\n", &USBSerialStream );
101
111
                }
102
112
 
103
113
                // set led
152
162
        LEDs_Init();
153
163
        USB_Init();
154
164
 
155
 
        init(); 
156
 
}
157
 
 
158
 
/** Checks for changes in the position of the board joystick, sending strings to the host upon each change. */
159
 
#if 0
160
 
void CheckJoystickMovement(void)
161
 
{
162
 
        uint8_t     JoyStatus_LCL = Joystick_GetStatus();
163
 
        char*       ReportString  = NULL;
164
 
        static bool ActionSent    = false;
165
 
 
166
 
        if (JoyStatus_LCL & JOY_UP)
167
 
          ReportString = "Joystick Up\r\n";
168
 
        else if (JoyStatus_LCL & JOY_DOWN)
169
 
          ReportString = "Joystick Down\r\n";
170
 
        else if (JoyStatus_LCL & JOY_LEFT)
171
 
          ReportString = "Joystick Left\r\n";
172
 
        else if (JoyStatus_LCL & JOY_RIGHT)
173
 
          ReportString = "Joystick Right\r\n";
174
 
        else if (JoyStatus_LCL & JOY_PRESS)
175
 
          ReportString = "Joystick Pressed\r\n";
176
 
        else
177
 
          ActionSent = false;
178
 
 
179
 
        if ((ReportString != NULL) && (ActionSent == false))
180
 
        {
181
 
                ActionSent = true;
182
 
 
183
 
                /* Write the string to the virtual COM port via the created character stream */
184
 
                fputs(ReportString, &USBSerialStream);
185
 
 
186
 
                /* Alternatively, without the stream: */
187
 
                // CDC_Device_SendString(&VirtualSerial_CDC_Interface, ReportString);
188
 
        }
189
 
}
190
 
#endif
 
165
        // do my init
 
166
        init();
 
167
 
 
168
        // set up arduino wiring.c
 
169
        init_wiring_c();
 
170
}
191
171
 
192
172
/** Event handler for the library USB Connection event. */
193
173
void EVENT_USB_Device_Connect(void)