|
|
@ -21,6 +21,7 @@ |
|
|
|
|
|
|
|
|
|
|
|
static void poll_subsystems(void); |
|
|
|
static void poll_subsystems(void); |
|
|
|
static void conf_buttons(void); |
|
|
|
static void conf_buttons(void); |
|
|
|
|
|
|
|
static void try_sbmp_hsk(void *unused); |
|
|
|
|
|
|
|
|
|
|
|
/** Main program function */ |
|
|
|
/** Main program function */ |
|
|
|
int main(void) |
|
|
|
int main(void) |
|
|
@ -43,6 +44,8 @@ int main(void) |
|
|
|
|
|
|
|
|
|
|
|
// Green LED starts flashing...
|
|
|
|
// Green LED starts flashing...
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
add_periodic_task(try_sbmp_hsk, NULL, 500, true); |
|
|
|
|
|
|
|
|
|
|
|
ms_time_t t = ms_now(); |
|
|
|
ms_time_t t = ms_now(); |
|
|
|
while (1) { |
|
|
|
while (1) { |
|
|
|
poll_subsystems(); |
|
|
|
poll_subsystems(); |
|
|
@ -54,21 +57,30 @@ int main(void) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
static void try_sbmp_hsk(void *unused) |
|
|
|
|
|
|
|
{ |
|
|
|
|
|
|
|
(void)unused; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (sbmp_ep_handshake_status(dlnk_ep) != SBMP_HSK_SUCCESS) { |
|
|
|
|
|
|
|
sbmp_ep_start_handshake(dlnk_ep); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Left button was pressed */ |
|
|
|
/** Left button was pressed */ |
|
|
|
void left_btn_click(void) |
|
|
|
static void left_btn_click(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
led_blink(LED_BUSY, 100); |
|
|
|
led_blink(LED_BUSY, 100); |
|
|
|
dSPIN_Move(FWD, STEPS_360 / 4); // rotate by 90deg
|
|
|
|
dSPIN_Move(FWD, STEPS_360 / 4); // rotate by 90deg
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Right button was pressed */ |
|
|
|
/** Right button was pressed */ |
|
|
|
void right_btn_click(void) |
|
|
|
static void right_btn_click(void) |
|
|
|
{ |
|
|
|
{ |
|
|
|
led_blink(LED_ERROR, 100); |
|
|
|
led_blink(LED_ERROR, 100); |
|
|
|
dSPIN_Move(REV, STEPS_360 / 4); // rotate by -90deg
|
|
|
|
dSPIN_Move(REV, STEPS_360 / 4); // rotate by -90deg
|
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** Datagram rx on SBMP */ |
|
|
|
/** Datagram rx on SBMP (extern declated in datalink.h) */ |
|
|
|
void dlnk_rx(SBMP_Datagram *dg) |
|
|
|
void dlnk_rx(SBMP_Datagram *dg) |
|
|
|
{ |
|
|
|
{ |
|
|
|
(void)dg; |
|
|
|
(void)dg; |
|
|
|