Control of mbed using OSC. Based on code from the Make Controller. Right now you can turn the onboard LEDs on/off and toggle 8 digital out pins. More I/O will be done in the future.
mbed_osc.h@0:439354122597, 2010-03-17 (annotated)
- Committer:
- pehrhovey
- Date:
- Wed Mar 17 03:17:38 2010 +0000
- Revision:
- 0:439354122597
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
pehrhovey | 0:439354122597 | 1 | /* |
pehrhovey | 0:439354122597 | 2 | * mbed_osc.h |
pehrhovey | 0:439354122597 | 3 | * |
pehrhovey | 0:439354122597 | 4 | * Created on: Mar 8, 2010 |
pehrhovey | 0:439354122597 | 5 | * Author: pehr |
pehrhovey | 0:439354122597 | 6 | * The functions to control the mBed using OSC |
pehrhovey | 0:439354122597 | 7 | * This includes setting up the UDP and OSC subsystem |
pehrhovey | 0:439354122597 | 8 | * And registering handlers to control mBed I/O |
pehrhovey | 0:439354122597 | 9 | */ |
pehrhovey | 0:439354122597 | 10 | /********************************************************************************* |
pehrhovey | 0:439354122597 | 11 | |
pehrhovey | 0:439354122597 | 12 | Copyright 2006-2009 MakingThings |
pehrhovey | 0:439354122597 | 13 | |
pehrhovey | 0:439354122597 | 14 | Licensed under the Apache License, |
pehrhovey | 0:439354122597 | 15 | Version 2.0 (the "License"); you may not use this file except in compliance |
pehrhovey | 0:439354122597 | 16 | with the License. You may obtain a copy of the License at |
pehrhovey | 0:439354122597 | 17 | |
pehrhovey | 0:439354122597 | 18 | http://www.apache.org/licenses/LICENSE-2.0 |
pehrhovey | 0:439354122597 | 19 | |
pehrhovey | 0:439354122597 | 20 | Unless required by applicable law or agreed to in writing, software distributed |
pehrhovey | 0:439354122597 | 21 | under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR |
pehrhovey | 0:439354122597 | 22 | CONDITIONS OF ANY KIND, either express or implied. See the License for |
pehrhovey | 0:439354122597 | 23 | the specific language governing permissions and limitations under the License. |
pehrhovey | 0:439354122597 | 24 | |
pehrhovey | 0:439354122597 | 25 | *********************************************************************************/ |
pehrhovey | 0:439354122597 | 26 | #ifndef MBED_OSC_H_ |
pehrhovey | 0:439354122597 | 27 | #define MBED_OSC_H_ |
pehrhovey | 0:439354122597 | 28 | |
pehrhovey | 0:439354122597 | 29 | #define UDP_RECV_PORT 4444 |
pehrhovey | 0:439354122597 | 30 | #define UDP_BROADCAST_PORT 5555 |
pehrhovey | 0:439354122597 | 31 | |
pehrhovey | 0:439354122597 | 32 | #include "mbed.h" |
pehrhovey | 0:439354122597 | 33 | #include "osc_sys.h" |
pehrhovey | 0:439354122597 | 34 | |
pehrhovey | 0:439354122597 | 35 | #include "lwip/udp.h" |
pehrhovey | 0:439354122597 | 36 | |
pehrhovey | 0:439354122597 | 37 | #include "NetServer.h" |
pehrhovey | 0:439354122597 | 38 | |
pehrhovey | 0:439354122597 | 39 | #include "ipv4/lwip/ip_addr.h" |
pehrhovey | 0:439354122597 | 40 | |
pehrhovey | 0:439354122597 | 41 | |
pehrhovey | 0:439354122597 | 42 | NetServer * getNetServer(); //get the netserver to do things like get hostname |
pehrhovey | 0:439354122597 | 43 | char * getScratch(); |
pehrhovey | 0:439354122597 | 44 | struct udp_pcb * getUdpPcb(); |
pehrhovey | 0:439354122597 | 45 | |
pehrhovey | 0:439354122597 | 46 | |
pehrhovey | 0:439354122597 | 47 | void osc_sendIPBroadcast(); |
pehrhovey | 0:439354122597 | 48 | int osc_init(); |
pehrhovey | 0:439354122597 | 49 | void osc_poll(); |
pehrhovey | 0:439354122597 | 50 | |
pehrhovey | 0:439354122597 | 51 | void udp_recv_callback(void *arg, struct udp_pcb *upcb, struct pbuf *p, struct ip_addr *addr, u16_t port); |
pehrhovey | 0:439354122597 | 52 | |
pehrhovey | 0:439354122597 | 53 | |
pehrhovey | 0:439354122597 | 54 | |
pehrhovey | 0:439354122597 | 55 | |
pehrhovey | 0:439354122597 | 56 | |
pehrhovey | 0:439354122597 | 57 | #endif /* MBED_OSC_H_ */ |