예제 #1
0
//*****************************************************************************
//
// Print Header Debug Info
//
//*****************************************************************************
void
DebugHeader(sNDEFMessageData sNDEFMessage)
{
    uint32_t x=0;

    UARTprintf("===== Message Header Begin =====\n");
    UARTprintf("\nDecoded Info:\n");
    UARTprintf("    StatusByte:\n");
    UARTprintf("        MB : 0x%x \n",sNDEFMessage.sStatusByte.MB);
    UARTprintf("        ME : 0x%x \n",sNDEFMessage.sStatusByte.ME);
    UARTprintf("        CF : 0x%x \n",sNDEFMessage.sStatusByte.CF);
    UARTprintf("        SR : 0x%x \n",sNDEFMessage.sStatusByte.SR);
    UARTprintf("        IL : 0x%x \n",sNDEFMessage.sStatusByte.IL);
    UARTprintf("        TNF: 0x%x \n",sNDEFMessage.sStatusByte.TNF);
    UARTprintf("    TypeLength:     0x%x \n",    sNDEFMessage.ui8TypeLength);
    UARTprintf("    PayloadLength:  0x%x , %d\n",sNDEFMessage.ui32PayloadLength,
               sNDEFMessage.ui32PayloadLength);
    UARTprintf("    IDLength:       0x%x \n",    sNDEFMessage.ui8IDLength);
    UARTprintf("    Type:           ");
    for(x=0; x<NDEF_TYPE_MAXSIZE; x++) {
        UARTprintf("%c",sNDEFMessage.pui8Type[x]);
    }
    UARTprintf("\n");
    UARTprintf("    ID:             0x");
    for(x=0; x<NDEF_ID_MAXSIZE; x++) {
        UARTprintf("%c",sNDEFMessage.pui8ID[x]);
    }
    UARTprintf("\n");
    UARTprintf("    PayloadPtr:     0x%x \n",sNDEFMessage.pui8PayloadPtr);
    UARTprintf("===== Message Header End =====\n\n");

#ifdef DEBUG_PRINT
    UARTprintf("\n=====Payload Begin =====\n");
    //
    // Wait for the UART to catch up.
    //
    UARTFlushTx(false);
    for(x=0; x<sNDEFMessage.ui32PayloadLength; x++) {
        if(x%20==0) {
            UARTFlushTx(false);
        }
        UARTprintf("        Payload[%d]=0x%x, '%c' \n",x,
                   *(sNDEFMessage.pui8PayloadPtr + x),
                   *(sNDEFMessage.pui8PayloadPtr + x));
    }

    UARTprintf("\n=====Payload End=====\n");
#endif //DEBUG_PRINT

    //
    // Wait for the UART to catch up.
    //
    UARTFlushTx(false);

    return;
}
예제 #2
0
파일: log.c 프로젝트: VENGEL/StellarisWare
//*****************************************************************************
//
// This function implements the "swupd" command.  It transfers control to the
// bootloader to update the firmware via ethernet.
//
//*****************************************************************************
int
Cmd_update(int argc, char *argv[])
{
    //
    // Tell the user what we are doing.
    //
    UARTprintf("Serial firmware update requested.\n");

    //
    // Transfer control to the bootloader.
    //
    UARTprintf("Transfering control to boot loader...\n\n");
    UARTprintf("***********************************\n");
    UARTprintf("*** Close your serial terminal ****\n");
    UARTprintf("***   before running LMFlash.  ****\n");
    UARTprintf("***********************************\n\n");
    UARTFlushTx(false);

    //
    // Signal the main loop that it should begin the software update process.
    //
    g_bFirmwareUpdate = true;

    return(0);
}
예제 #3
0
//*****************************************************************************
//
// \internal
//
// Handler for the "help" command.
//
// \param argc contains the number of entries in the argv[] array.
// \param argv is an array of pointers to each of the individual words parsed
// from the command line.  The first entry will be the command itself and later
// entries represent any parameters.
//
// This function is called by the command line parser when the user enters
// the "help", "h" or "?" commands.  It prints out a list of supported
// commands with a description of each.
//
// This handler takes no parameters.  argc and argv are ignored.
//
// \return COMMAND_OK in all cases
//
//*****************************************************************************
int
CmdHelp(int argc, char *argv[])
{
    int iLoop;

    iLoop = 0;

    UARTprintf("\nOscilloscope Test Commands:\n");
    UARTprintf("---------------------------\n\n");

    while(g_sCmdTable[iLoop].pcCmd != (const char *)0)
    {
        UARTprintf("%13s%s\n",
                         g_sCmdTable[iLoop].pcCmd,
                         g_sCmdTable[iLoop].pcHelp);
        iLoop++;

        //
        // Every 5 lines, wait for the UART to catch up with us.
        //
        if(!(iLoop % 5))
        {
            UARTFlushTx(false);
        }
    }

    return(COMMAND_OK);
}
예제 #4
0
void
configure_pins(struct header_pin pins[], uint16_t length) {
  int i;
  for(i=0; i<length; i++) {
    configure_pin(&pins[i]);
    UARTFlushTx(false);
  }
}
예제 #5
0
//*****************************************************************************
//
// Print Text Record Debug Info
//
//*****************************************************************************
void
DebugTextRecord(sNDEFTextRecord sNDEFText)
{
    uint32_t x=0;

    UARTprintf("    Tag is Text Record \n");
    UARTprintf("    Text:'");
    for(x=0; x<sNDEFText.ui32TextLength; x++) {
        if(x%20==0) {
            UARTFlushTx(false);
        }
        UARTprintf("%c",sNDEFText.pui8Text[x]);
    }
    UARTprintf("'\n");
    UARTFlushTx(false);
    return;
}
예제 #6
0
//*****************************************************************************
//
// Print Signiture Record Debug Info
//
//*****************************************************************************
void
DebugSignitureRecord(void)
{
    UARTprintf("    Tag is Signature Record \n");
    UARTprintf("    Signature Records are not fully supported yet.\n");
    UARTFlushTx(false);
    return;
}
예제 #7
0
void printPIDValues(pid_values_t *pidValues) {
    UARTprintf("PID: %d.%04u\t%d.%04u\t%d.%05u\t%d.%04u\n",
                                            (int16_t)pidValues->Kp, (uint16_t)(abs(pidValues->Kp * 10000.0f) % 10000),
                                            (int16_t)pidValues->Ki, (uint16_t)(abs(pidValues->Ki * 10000.0f) % 10000),
                                            (int16_t)pidValues->Kd, (uint16_t)(abs(pidValues->Kd * 100000.0f) % 100000),
                                            (int16_t)pidValues->integrationLimit, (uint16_t)(abs(pidValues->integrationLimit * 10000.0f) % 10000));
    UARTFlushTx(false);
}
예제 #8
0
//*****************************************************************************
//
// Print Smart Poster Debug Info
//
//*****************************************************************************
void
DebugSmartPosterRecord(sNDEFSmartPosterRecord sNDEFSmartPoster)
{
    uint32_t x=0;

    UARTprintf("    Tag is SmartPoster Record \n");
    UARTprintf("    SmartPoster Title:'");
    UARTFlushTx(false);
    for(x=0; x<sNDEFSmartPoster.sTextPayload.ui32TextLength; x++) {
        UARTprintf("%c",sNDEFSmartPoster.sTextPayload.pui8Text[x]);
    }
    UARTprintf("'\n");
    UARTprintf("    SmartPoster URI:'");
    UARTFlushTx(false);
    for(x=0; x<sNDEFSmartPoster.sURIPayload.ui32URILength; x++) {
        UARTprintf("%c",sNDEFSmartPoster.sURIPayload.puiUTF8String[x]);
    }
    UARTprintf("'\n");
    if(sNDEFSmartPoster.bActionExists) {
        switch(sNDEFSmartPoster.sActionPayload.eAction) {
            case DO_ACTION: {
                UARTprintf("    SmartPoster Action: Do Action (0x%x)\n",
                           sNDEFSmartPoster.sActionPayload.eAction);
                break;
            }
            case SAVE_FOR_LATER: {
                UARTprintf("    SmartPoster Action: Save for Later (0x%x)\n",
                           sNDEFSmartPoster.sActionPayload.eAction);
                break;
            }
            case OPEN_FOR_EDITING: {
                UARTprintf("    SmartPoster Action: Open for Editing (0x%x)\n",
                           sNDEFSmartPoster.sActionPayload.eAction);
                break;
            }
            default: {
                break;
            }
        }
    } else {
        UARTprintf("    SmartPoster Action: Not Present\n");
    }
    UARTFlushTx(false);
    return;
}
예제 #9
0
//*****************************************************************************
//
// Print URI Record Debug Info
//
//*****************************************************************************
void
DebugURIRecord(sNDEFURIRecord sNDEFURI)
{
    uint32_t x=0;

    UARTprintf("    Tag is URI Record \n");
    UARTprintf("    URI IDCode: 0x%x\n",sNDEFURI.eIDCode);
    UARTprintf("    URI:'");
    for(x=0; x<sNDEFURI.ui32URILength; x++) {
        if(x%20==0) {
            UARTFlushTx(false);
        }
        UARTprintf("%c",sNDEFURI.puiUTF8String[x]);
    }
    UARTprintf("'\n");
    UARTFlushTx(false);
    return;
}
예제 #10
0
void printSettings(void) {
    UARTprintf("Settings: %d.%02u\t%d.%02u\t%u\t%u\t%d.%02u\t%d.%02u\n",
                                            (int16_t)cfg.angleKp, (uint16_t)(abs(cfg.angleKp * 100.0f) % 100),
                                            (int16_t)cfg.headKp, (uint16_t)(abs(cfg.headKp * 100.0f) % 100),
                                            cfg.maxAngleInclination, cfg.maxAngleInclinationDistSensor,
                                            (int16_t)cfg.stickScalingRollPitch, (uint16_t)(abs(cfg.stickScalingRollPitch * 100.0f) % 100),
                                            (int16_t)cfg.stickScalingYaw, (uint16_t)(abs(cfg.stickScalingYaw * 100.0f) % 100));
    UARTFlushTx(false);
}
예제 #11
0
bool parse_path(char *path, struct header_pin **connector, uint8_t *pin,
		char *value) {
  char buf[20];
  struct header_pin *con;
  int i,l;
  for(i=0; path[i] != '\0' && path[i] != '.'; i++);

  memcpy(buf, path, i);
  buf[i] = '\0';

  printf("Port: %s\n", buf);
  l = i+1;
  if( l == '\0' ) {
    return false;
  }
  uint8_t index = (buf[0]-'0')-1;
  printf("c: %d\n", (buf[0]-'0')-1);

  UARTFlushTx(false);

  if( index > 3) {
    return false;
  }

  con = (struct header_pin*)headers[(buf[0]-'0')-1];
  printf("j1: %p\n", &j1);
  printf("j2: %p\n", &j2);
  printf("j3: %p\n", &j3);
  printf("connector: %p\n", con);
  for(; path[i] != '\0' && path[i] != '/'; i++);

  memcpy(buf, path+l, i-l);
  buf[i-l] = '\0';
  printf("Pin: %s\n", buf);

  l = i+1;
  *pin = atoi(buf)-1; //(buf[0] - '0')-1;
  if( l == '\0' ) {
    return false;
  }
  for(; path[i] != '\0'; i++);

  memcpy(value, path+l, i-l);
  value[i-l] = '\0';
  printf("pin: %d\n", *pin);
  printf("Value: '%s'\n", value);

  *connector = con;

  return true;
}
예제 #12
0
파일: starter1.c 프로젝트: manavm/Classes
//*****************************************************************************
//
// Print the help strings for all commands.
//
//*****************************************************************************
int
CMD_help(int argc, char **argv)
{
    int32_t i32Index;

    (void)argc;
    (void)argv;

    //
    // Start at the beginning of the command table.
    //
    i32Index = 0;

    //
    // Get to the start of a clean line on the serial output.
    //
    UARTprintf("\nAvailable Commands\n------------------\n\n");

    //
    // Display strings until we run out of them.
    //
    while(g_psCmdTable[i32Index].pcCmd)
    {
        //
        // Display help information for a single command.
        //
        UARTprintf("%17s %s\n", g_psCmdTable[i32Index].pcCmd,
                   g_psCmdTable[i32Index].pcHelp);
        i32Index++;

        //
        // Make sure we've sent all the UART data before we add more to the
        // buffer.
        //
        UARTFlushTx(0);
    }

    //
    // Leave a blank line after the help strings.
    //
    UARTprintf("\n");

    return(0);
}
예제 #13
0
//*****************************************************************************
// \internal
//
// Handler for the "dump" command.
//
// \param argc contains the number of entries in the argv[] array.
// \param argv is an array of pointers to each of the individual words parsed
// from the command line.  The first entry will be the command itself and later
// entries represent any parameters.
//
// This function is called by the command line parser when the user enters
// the "dump" or "d" commands.  It causes the latest captured data samples
// to be sent to the serial port unless no samples have yet been captured
// in which case the command is ignored.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
int
CmdDump(int argc, char *argv[])
{
    unsigned long ulLoop;
    tBoolean bRetcode;
    tDataAcqCaptureStatus sStatus;
    unsigned long ulSample;
    unsigned long ulInc;

    //
    // Query the capture status.
    //
    bRetcode = DataAcquisitionGetStatus(&sStatus);
    ERROR_CHECK(bRetcode, "ERROR! Can't request status!\n");

    //
    // In dual mode, we will handle 2 samples per loop.
    //
    ulInc = sStatus.bDualMode ? 2 : 1;

    //
    // Dump the samples from the start to the end, taking care of the buffer
    // wrap.
    //
    ulSample = sStatus.ulStartIndex;

    for(ulLoop = 0; ulLoop < sStatus.ulSamplesCaptured; ulLoop+=ulInc)
    {
        //
        // Allow the UART some time to flush the buffer
        //
        if((ulLoop % 32) == 0)
        {
            UARTFlushTx(false);
        }

        if(!sStatus.bDualMode)
        {
            //
            // Dump the sample to the output.
            //
            UARTprintf("%d, %d\n", ulSample,
                       sStatus.pusBuffer[ulSample]);

            //
            // Move on to the next sample.
            //
            ulSample++;

            //
            // Handle the wrap at the end of the buffer.
            //
            if(ulSample == MAX_SAMPLES_PER_TRIGGER)
            {
                ulSample = 0;
            }
        }
        else
        {
            //
            // Dump the sample to the output.
            //
            UARTprintf("%d, %d, %d\n", ulSample,
                       sStatus.pusBuffer[ulSample],
                       sStatus.pusBuffer[ulSample+1]);

            //
            // Move on to the next sample.
            //
            ulSample += 2;

            //
            // Handle the wrap at the end of the buffer.
            //
            if(ulSample >= MAX_SAMPLES_PER_TRIGGER)
            {
                ulSample = 0;
            }
        }
    }

    return(COMMAND_OK);
}