Changed required for new iic code API

This commit is contained in:
Ross Owen
2012-02-24 17:08:42 +00:00
parent 1b8daeef24
commit 5c9079eaa6
2 changed files with 20 additions and 15 deletions

View File

@@ -19,7 +19,8 @@ void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
clock ?clk_midi, clock ?clk_midi,
chanend c_midi, chanend c_midi,
unsigned cable_number, unsigned cable_number,
chanend c_iap, chanend ?c_i2c // iOS stuff chanend ?c_iap, chanend ?c_i2c, // iOS stuff
port ?p_scl, port ?p_sda
); );
#define MAX_USB_MIDI_PACKET_SIZE 1024 #define MAX_USB_MIDI_PACKET_SIZE 1024

View File

@@ -59,7 +59,11 @@ int uout_count = 0; // UART bytes out
int uin_count = 0; // UART bytes in int uin_count = 0; // UART bytes in
// state for iAP // state for iAP
#ifdef IAP
extern unsigned authenticating; extern unsigned authenticating;
#else
unsigned authenticating = 0;
#endif
// state for auto-selecting dock or USB B // state for auto-selecting dock or USB B
extern unsigned polltime; extern unsigned polltime;
@@ -85,10 +89,11 @@ timer iAPTimer;
#endif #endif
void usb_midi(in port ?p_midi_in, out port ?p_midi_out, void usb_midi(in port ?p_midi_in, out port ?p_midi_out,
clock ?clk_midi, clock ?clk_midi,
chanend c_midi, chanend c_midi,
unsigned cable_number, unsigned cable_number,
chanend c_iap, chanend ?c_i2c // iOS stuff chanend ?c_iap, chanend ?c_i2c, // iOS stuff
port ?p_scl, port ?p_sda
) )
{ {
unsigned symbol = 0x0; // Symbol in progress of being sent out unsigned symbol = 0x0; // Symbol in progress of being sent out
@@ -321,18 +326,17 @@ chanend c_iap, chanend ?c_i2c // iOS stuff
} }
break; break;
#ifdef IAP #ifdef IAP
case !(isTX || isRX) => iap_get_ack_or_reset_or_data(c_iap, is_ack, is_reset, datum): case !(isTX || isRX) => iap_get_ack_or_reset_or_data(c_iap, is_ack, is_reset, datum):
handle_iap_case(is_ack, is_reset, datum, c_iap, c_i2c); handle_iap_case(is_ack, is_reset, datum, c_iap, c_i2c, p_scl, p_sda);
if (!authenticating) { if (!authenticating)
{
// printstrln("Completed authentication"); // printstrln("Completed authentication");
p_midi_in :> void; // Change port around to input again after authenticating (unique to midi+iAP case) p_midi_in :> void; // Change port around to input again after authenticating (unique to midi+iAP case)
} }
break; break;
#endif case iAPTimer when timerafter(polltime) :> void:
#ifdef IAP handle_poll_dev_det(iAPTimer);
case iAPTimer when timerafter(polltime) :> void: break;
handle_poll_dev_det(iAPTimer);
break;
#endif #endif
} }
} }