status.c 551 Bytes
Newer Older
1 2 3 4
#include "ch.h"
#include "hal.h"
#include "board.h"

5
#include <string.h>
6 7 8 9 10 11 12 13 14
#include "status.h"

/* STATUS THREAD
 * 
 * This thread handles the onboard LEDs and debugging ports 
 */

#define DEBUG &SD3 // UART3

15
THD_WORKING_AREA(waStatus, 1024);
16 17 18 19 20 21
THD_FUNCTION(Status, arg) {
  (void)arg;
  chRegSetThreadName("status");

  // Just blinks in sequence to test onboard LEDs
  while (true) {
22 23 24 25 26 27 28
    thread_t *tp = chMsgWait();
    const uint8_t *msg = (const uint8_t *)chMsgGet(tp);

    sdWrite(DEBUG, msg, strlen(msg));

    chMsgRelease(tp, MSG_OK);
 
29
  }
30
}