implement BLEMidi as Serial to use with Arduino MIDI library

This commit is contained in:
hathach committed 2017-03-08 15:19:11 +07:00
1 parent 366416f8ac
commit 255b189605
4 files changed
+133 -129

No files matched your search

-64
View File
@@ -90,69 +90,6 @@ int dbgHeapUsed(void)
return (mallinfo()).uordblks;
}
#if 0
static void printCenter(const char* str, int width)
{
int lpad = (width-strlen(str))/2;
int rpad = width - strlen(str) - lpad;
Serial.printf("|%*c%s%*c|\n", lpad, ' ', str, rpad, ' ');
}
static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint32_t used)
{
const int WIDTH = 21;
Serial.printf(" _____________________ 0x%08lX\n", top);
Serial.printf("| |\n");
printCenter(name, WIDTH);
char buffer[30];
if ( used )
{
sprintf(buffer, "%lu / %lu (%02lu%%)", used, top-bottom, (used*100)/ (top-bottom));
}else
{
sprintf(buffer, "%lu", top-bottom);
}
printCenter(buffer, WIDTH);
Serial.printf("|_____________________| 0x%08lX\n", bottom);
}
void dbgMemInfo(void)
{
Serial.println(" Memory Map");
// Pritn SRAM used for Stack executed by S132 and ISR
printMemRegion("Stack", ((uint32_t) __StackTop), ((uint32_t) __StackLimit), 0);
// Print Heap usage overall (including memory malloced to tasks)
printMemRegion("Heap", ((uint32_t) __HeapLimit), ((uint32_t) __HeapBase), dbgHeapUsed());
// DATA + BSS
printMemRegion("Data & Bss", ((uint32_t) __bss_end__), ((uint32_t) __data_start__), 0);
// Print SRAM Used by SoftDevice
printMemRegion("S132", (uint32_t) __data_start__, 0x20000000, 0);
Serial.println();
// Print Task list
uint32_t tasknum = uxTaskGetNumberOfTasks();
char* buf = (char*) rtos_malloc(tasknum*40); // 40 bytes per task
vTaskList(buf);
Serial.println("Task State Prio Stack Num");
Serial.println("-----------------------------------");
Serial.println(buf);
rtos_free(buf);
}
#else
static void printMemRegion(const char* name, uint32_t top, uint32_t bottom, uint32_t used)
{
char buffer[30];
@@ -198,7 +135,6 @@ void dbgMemInfo(void)
Serial.println(buf);
rtos_free(buf);
}
#endif
void dbgPrintVersion(void)
{