From 2f86a751f143d790ed267810d6b7ce0aedaad0d9 Mon Sep 17 00:00:00 2001 From: astewart-xmos Date: Mon, 23 Apr 2018 13:03:21 -0400 Subject: [PATCH 1/2] Changed mabs timer to treat MIN_POLL_TIME_US as microseconds instead of 10's of nanoseconds The mabs button and LED server was updating the LEDs every MIN_POLL_TIME_US reference clock ticks. But, the macro name implies that it should be updating the LEDs every MIN_POLL_TIME_US microseconds, rather than reference clock ticks. So, this fixes that. This also fixes an issue with the BGA167 boards where the MABS server is broken when the core clock is 500 MHz, because the timer is firing so rapidly it's never able to service any other events. --- lib_mic_array_board_support/src/board_support.xc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib_mic_array_board_support/src/board_support.xc b/lib_mic_array_board_support/src/board_support.xc index 8527a0d..6d22a5b 100644 --- a/lib_mic_array_board_support/src/board_support.xc +++ b/lib_mic_array_board_support/src/board_support.xc @@ -89,7 +89,7 @@ void mabs_button_and_led_server(server interface mabs_led_button_if lb[n_lb], } case t when timerafter(time) :> unsigned now :{ - time = now + MIN_POLL_TIME_US; + time = now + 100*MIN_POLL_TIME_US; unsigned elapsed = (now-start_of_time)&LED_MAX_COUNT; elapsed>>=(20-8); unsigned d=0; From 3f28ded42c3d74a5fd182f9862de240f21f66755 Mon Sep 17 00:00:00 2001 From: Aaron Stewart Date: Fri, 4 May 2018 13:46:58 -0400 Subject: [PATCH 2/2] Made the led client for the BGA167 board nullable. --- lib_mic_array_board_support/api/mic_array_board_support.h | 2 +- lib_mic_array_board_support/src/board_support.xc | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/lib_mic_array_board_support/api/mic_array_board_support.h b/lib_mic_array_board_support/api/mic_array_board_support.h index 47a0ab8..8cc1aec 100644 --- a/lib_mic_array_board_support/api/mic_array_board_support.h +++ b/lib_mic_array_board_support/api/mic_array_board_support.h @@ -159,7 +159,7 @@ void mabs_button_and_led_server(server interface mabs_led_button_if lb[n_lb], #ifndef MIC_BOARD_LED_STCP mabs_led_ports_t &leds, #else - client interface ma_bga167_led_if leds, + client interface ma_bga167_led_if? leds, #endif in port p_buttons); diff --git a/lib_mic_array_board_support/src/board_support.xc b/lib_mic_array_board_support/src/board_support.xc index 6d22a5b..6672c76 100644 --- a/lib_mic_array_board_support/src/board_support.xc +++ b/lib_mic_array_board_support/src/board_support.xc @@ -23,7 +23,7 @@ void mabs_button_and_led_server(server interface mabs_led_button_if lb[n_lb], #ifndef MIC_BOARD_LED_STCP mabs_led_ports_t &leds, #else - client interface ma_bga167_led_if leds, + client interface ma_bga167_led_if? leds, #endif in port p_buttons){ @@ -97,7 +97,9 @@ void mabs_button_and_led_server(server interface mabs_led_button_if lb[n_lb], for(unsigned i=0; i<13; i++) d=(d>>1)+(0x1000*(led_brightness[i]<=elapsed)); - leds.set_leds(d); + + if(!isnull(leds)) + leds.set_leds(d); #else #if defined(PORT_LED0_TO_7) for(unsigned i=0;i<8;i++)