MIDI Stop Controller V1.0 suitable for driving Hauptwerk digital organ software. Written for the KL25Z uses BusInOut and will drive up to 16 illuminated push buttons each switch uses a single I/O pin to both drive the LED and act as a switch input. Pressing a button will alternately send MIDI note on / off messages and turn the LED on or off. If corresponding MIDI note on/off messages are received these will be used to drive the LEDs in preference to the locally generated LED signals. The MIDI channel used to send can be selected by jumpers on 4 pins of the J2 header.

Dependencies:   mbed

Committer:
djbottrill
Date:
Sat Sep 14 21:32:06 2013 +0000
Revision:
0:aac55e1fc12f
V1.0 MIDI Stop Controller

Who changed what in which revision?

UserRevisionLine numberNew contents of line
djbottrill 0:aac55e1fc12f 1 /* Copyright (c) 2010-2011 mbed.org, MIT License
djbottrill 0:aac55e1fc12f 2 *
djbottrill 0:aac55e1fc12f 3 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software
djbottrill 0:aac55e1fc12f 4 * and associated documentation files (the "Software"), to deal in the Software without
djbottrill 0:aac55e1fc12f 5 * restriction, including without limitation the rights to use, copy, modify, merge, publish,
djbottrill 0:aac55e1fc12f 6 * distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the
djbottrill 0:aac55e1fc12f 7 * Software is furnished to do so, subject to the following conditions:
djbottrill 0:aac55e1fc12f 8 *
djbottrill 0:aac55e1fc12f 9 * The above copyright notice and this permission notice shall be included in all copies or
djbottrill 0:aac55e1fc12f 10 * substantial portions of the Software.
djbottrill 0:aac55e1fc12f 11 *
djbottrill 0:aac55e1fc12f 12 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING
djbottrill 0:aac55e1fc12f 13 * BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
djbottrill 0:aac55e1fc12f 14 * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
djbottrill 0:aac55e1fc12f 15 * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
djbottrill 0:aac55e1fc12f 16 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
djbottrill 0:aac55e1fc12f 17 */
djbottrill 0:aac55e1fc12f 18
djbottrill 0:aac55e1fc12f 19 #ifndef USBBUSINTERFACE_H
djbottrill 0:aac55e1fc12f 20 #define USBBUSINTERFACE_H
djbottrill 0:aac55e1fc12f 21
djbottrill 0:aac55e1fc12f 22 #include "mbed.h"
djbottrill 0:aac55e1fc12f 23 #include "USBEndpoints.h"
djbottrill 0:aac55e1fc12f 24
djbottrill 0:aac55e1fc12f 25 class USBHAL {
djbottrill 0:aac55e1fc12f 26 public:
djbottrill 0:aac55e1fc12f 27 /* Configuration */
djbottrill 0:aac55e1fc12f 28 USBHAL();
djbottrill 0:aac55e1fc12f 29 ~USBHAL();
djbottrill 0:aac55e1fc12f 30 void connect(void);
djbottrill 0:aac55e1fc12f 31 void disconnect(void);
djbottrill 0:aac55e1fc12f 32 void configureDevice(void);
djbottrill 0:aac55e1fc12f 33 void unconfigureDevice(void);
djbottrill 0:aac55e1fc12f 34 void setAddress(uint8_t address);
djbottrill 0:aac55e1fc12f 35 void remoteWakeup(void);
djbottrill 0:aac55e1fc12f 36
djbottrill 0:aac55e1fc12f 37 /* Endpoint 0 */
djbottrill 0:aac55e1fc12f 38 void EP0setup(uint8_t *buffer);
djbottrill 0:aac55e1fc12f 39 void EP0read(void);
djbottrill 0:aac55e1fc12f 40 void EP0readStage(void);
djbottrill 0:aac55e1fc12f 41 uint32_t EP0getReadResult(uint8_t *buffer);
djbottrill 0:aac55e1fc12f 42 void EP0write(uint8_t *buffer, uint32_t size);
djbottrill 0:aac55e1fc12f 43 void EP0getWriteResult(void);
djbottrill 0:aac55e1fc12f 44 void EP0stall(void);
djbottrill 0:aac55e1fc12f 45
djbottrill 0:aac55e1fc12f 46 /* Other endpoints */
djbottrill 0:aac55e1fc12f 47 EP_STATUS endpointRead(uint8_t endpoint, uint32_t maximumSize);
djbottrill 0:aac55e1fc12f 48 EP_STATUS endpointReadResult(uint8_t endpoint, uint8_t *data, uint32_t *bytesRead);
djbottrill 0:aac55e1fc12f 49 EP_STATUS endpointWrite(uint8_t endpoint, uint8_t *data, uint32_t size);
djbottrill 0:aac55e1fc12f 50 EP_STATUS endpointWriteResult(uint8_t endpoint);
djbottrill 0:aac55e1fc12f 51 void stallEndpoint(uint8_t endpoint);
djbottrill 0:aac55e1fc12f 52 void unstallEndpoint(uint8_t endpoint);
djbottrill 0:aac55e1fc12f 53 bool realiseEndpoint(uint8_t endpoint, uint32_t maxPacket, uint32_t options);
djbottrill 0:aac55e1fc12f 54 bool getEndpointStallState(unsigned char endpoint);
djbottrill 0:aac55e1fc12f 55 uint32_t endpointReadcore(uint8_t endpoint, uint8_t *buffer);
djbottrill 0:aac55e1fc12f 56
djbottrill 0:aac55e1fc12f 57 protected:
djbottrill 0:aac55e1fc12f 58 virtual void busReset(void){};
djbottrill 0:aac55e1fc12f 59 virtual void EP0setupCallback(void){};
djbottrill 0:aac55e1fc12f 60 virtual void EP0out(void){};
djbottrill 0:aac55e1fc12f 61 virtual void EP0in(void){};
djbottrill 0:aac55e1fc12f 62 virtual void connectStateChanged(unsigned int connected){};
djbottrill 0:aac55e1fc12f 63 virtual void suspendStateChanged(unsigned int suspended){};
djbottrill 0:aac55e1fc12f 64 virtual void SOF(int frameNumber){};
djbottrill 0:aac55e1fc12f 65
djbottrill 0:aac55e1fc12f 66 virtual bool EP1_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 67 virtual bool EP1_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 68 virtual bool EP2_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 69 virtual bool EP2_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 70 virtual bool EP3_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 71 virtual bool EP3_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 72 virtual bool EP4_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 73 virtual bool EP4_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 74
djbottrill 0:aac55e1fc12f 75 #if !defined(TARGET_LPC11U24)
djbottrill 0:aac55e1fc12f 76 virtual bool EP5_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 77 virtual bool EP5_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 78 virtual bool EP6_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 79 virtual bool EP6_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 80 virtual bool EP7_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 81 virtual bool EP7_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 82 virtual bool EP8_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 83 virtual bool EP8_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 84 virtual bool EP9_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 85 virtual bool EP9_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 86 virtual bool EP10_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 87 virtual bool EP10_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 88 virtual bool EP11_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 89 virtual bool EP11_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 90 virtual bool EP12_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 91 virtual bool EP12_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 92 virtual bool EP13_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 93 virtual bool EP13_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 94 virtual bool EP14_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 95 virtual bool EP14_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 96 virtual bool EP15_OUT_callback(){return false;};
djbottrill 0:aac55e1fc12f 97 virtual bool EP15_IN_callback(){return false;};
djbottrill 0:aac55e1fc12f 98 #endif
djbottrill 0:aac55e1fc12f 99
djbottrill 0:aac55e1fc12f 100 private:
djbottrill 0:aac55e1fc12f 101 void usbisr(void);
djbottrill 0:aac55e1fc12f 102 static void _usbisr(void);
djbottrill 0:aac55e1fc12f 103 static USBHAL * instance;
djbottrill 0:aac55e1fc12f 104
djbottrill 0:aac55e1fc12f 105 #if defined(TARGET_LPC11U24)
djbottrill 0:aac55e1fc12f 106 bool (USBHAL::*epCallback[10 - 2])(void);
djbottrill 0:aac55e1fc12f 107 #else
djbottrill 0:aac55e1fc12f 108 bool (USBHAL::*epCallback[32 - 2])(void);
djbottrill 0:aac55e1fc12f 109 #endif
djbottrill 0:aac55e1fc12f 110
djbottrill 0:aac55e1fc12f 111
djbottrill 0:aac55e1fc12f 112 };
djbottrill 0:aac55e1fc12f 113 #endif