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,
chanend c_midi,
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

View File

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