hexsha
stringlengths 40
40
| repo
stringlengths 5
105
| path
stringlengths 3
173
| license
sequence | language
stringclasses 1
value | identifier
stringlengths 1
438
| return_type
stringlengths 1
106
⌀ | original_string
stringlengths 21
40.7k
| original_docstring
stringlengths 18
13.4k
| docstring
stringlengths 11
3.24k
| docstring_tokens
sequence | code
stringlengths 14
20.4k
| code_tokens
sequence | short_docstring
stringlengths 0
4.36k
| short_docstring_tokens
sequence | comment
sequence | parameters
list | docstring_params
dict |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
6707ff4915bd494418a4723eb517d4e8dd461498 | junyanl-code/Luminary-Micro-Library | boards/rdk-idm-l35/grlib_demo/grlib_demo.c | [
"BSD-3-Clause"
] | C | OnFirmwarePaint | void | void
OnFirmwarePaint(tWidget *pWidget, tContext *pContext)
{
//
// Display the firmware update instruction text in the canvas.
//
GrContextFontSet(pContext, g_pFontCm18);
GrContextForegroundSet(pContext, ClrSilver);
GrStringDraw(pContext, "You may replace the software image", -1, 10, 32, 0);
GrStringDraw(pContext, "flashed by pressing the \"Update\" button", -1, 10,
50, 0);
GrStringDraw(pContext, "then using the LMFlash utility to send", -1, 10,
68, 0);
GrStringDraw(pContext, "a new image via the serial interface.", -1, 10, 86,
0);
} | //*****************************************************************************
//
// Handles paint requests for the firmware update canvas widget.
//
//*****************************************************************************
| Handles paint requests for the firmware update canvas widget. | [
"Handles",
"paint",
"requests",
"for",
"the",
"firmware",
"update",
"canvas",
"widget",
"."
] | void
OnFirmwarePaint(tWidget *pWidget, tContext *pContext)
{
GrContextFontSet(pContext, g_pFontCm18);
GrContextForegroundSet(pContext, ClrSilver);
GrStringDraw(pContext, "You may replace the software image", -1, 10, 32, 0);
GrStringDraw(pContext, "flashed by pressing the \"Update\" button", -1, 10,
50, 0);
GrStringDraw(pContext, "then using the LMFlash utility to send", -1, 10,
68, 0);
GrStringDraw(pContext, "a new image via the serial interface.", -1, 10, 86,
0);
} | [
"void",
"OnFirmwarePaint",
"(",
"tWidget",
"*",
"pWidget",
",",
"tContext",
"*",
"pContext",
")",
"{",
"GrContextFontSet",
"(",
"pContext",
",",
"g_pFontCm18",
")",
";",
"GrContextForegroundSet",
"(",
"pContext",
",",
"ClrSilver",
")",
";",
"GrStringDraw",
"(",
"pContext",
",",
"\"",
"\"",
",",
"-1",
",",
"10",
",",
"32",
",",
"0",
")",
";",
"GrStringDraw",
"(",
"pContext",
",",
"\"",
"\\\"",
"\\\"",
"\"",
",",
"-1",
",",
"10",
",",
"50",
",",
"0",
")",
";",
"GrStringDraw",
"(",
"pContext",
",",
"\"",
"\"",
",",
"-1",
",",
"10",
",",
"68",
",",
"0",
")",
";",
"GrStringDraw",
"(",
"pContext",
",",
"\"",
"\"",
",",
"-1",
",",
"10",
",",
"86",
",",
"0",
")",
";",
"}"
] | Handles paint requests for the firmware update canvas widget. | [
"Handles",
"paint",
"requests",
"for",
"the",
"firmware",
"update",
"canvas",
"widget",
"."
] | [
"//\r",
"// Display the firmware update instruction text in the canvas.\r",
"//\r"
] | [
{
"param": "pWidget",
"type": "tWidget"
},
{
"param": "pContext",
"type": "tContext"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pWidget",
"type": "tWidget",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pContext",
"type": "tContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
6707ff4915bd494418a4723eb517d4e8dd461498 | junyanl-code/Luminary-Micro-Library | boards/rdk-idm-l35/grlib_demo/grlib_demo.c | [
"BSD-3-Clause"
] | C | OnFirmwareUpdate | void | void
OnFirmwareUpdate(tWidget *pWidget)
{
//
// Play the key click sound.
//
SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2);
//
// Change the button text to show that the update is starting
//
PushButtonTextSet(&g_sFirmwareUpdateBtn, "Updating...");
WidgetPaint((tWidget *)&g_sFirmwareUpdateBtn);
//
// Trigger a software update
//
g_bFirmwareUpdate = true;
} | //*****************************************************************************
//
// Handles press notifications for the push button widgets.
//
//*****************************************************************************
| Handles press notifications for the push button widgets. | [
"Handles",
"press",
"notifications",
"for",
"the",
"push",
"button",
"widgets",
"."
] | void
OnFirmwareUpdate(tWidget *pWidget)
{
SoundPlay(g_pusKeyClick, sizeof(g_pusKeyClick) / 2);
PushButtonTextSet(&g_sFirmwareUpdateBtn, "Updating...");
WidgetPaint((tWidget *)&g_sFirmwareUpdateBtn);
g_bFirmwareUpdate = true;
} | [
"void",
"OnFirmwareUpdate",
"(",
"tWidget",
"*",
"pWidget",
")",
"{",
"SoundPlay",
"(",
"g_pusKeyClick",
",",
"sizeof",
"(",
"g_pusKeyClick",
")",
"/",
"2",
")",
";",
"PushButtonTextSet",
"(",
"&",
"g_sFirmwareUpdateBtn",
",",
"\"",
"\"",
")",
";",
"WidgetPaint",
"(",
"(",
"tWidget",
"*",
")",
"&",
"g_sFirmwareUpdateBtn",
")",
";",
"g_bFirmwareUpdate",
"=",
"true",
";",
"}"
] | Handles press notifications for the push button widgets. | [
"Handles",
"press",
"notifications",
"for",
"the",
"push",
"button",
"widgets",
"."
] | [
"//\r",
"// Play the key click sound.\r",
"//\r",
"//\r",
"// Change the button text to show that the update is starting\r",
"//\r",
"//\r",
"// Trigger a software update\r",
"//\r"
] | [
{
"param": "pWidget",
"type": "tWidget"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pWidget",
"type": "tWidget",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79502c381cb72f1c9477f49a2b3e6fb3bb77b42b | junyanl-code/Luminary-Micro-Library | examples/peripherals/timer/oneshot_16bit.c | [
"BSD-3-Clause"
] | C | Timer0BIntHandler | void | void
Timer0BIntHandler(void)
{
//
// Clear the timer interrupt flag.
//
TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT);
//
// Set a flag to indicate that the interrupt occurred.
//
g_ulIntFlag = 1;
} | //*****************************************************************************
//
// The interrupt handler for the for Timer0B interrupt.
//
//*****************************************************************************
| The interrupt handler for the for Timer0B interrupt. | [
"The",
"interrupt",
"handler",
"for",
"the",
"for",
"Timer0B",
"interrupt",
"."
] | void
Timer0BIntHandler(void)
{
TimerIntClear(TIMER0_BASE, TIMER_TIMB_TIMEOUT);
g_ulIntFlag = 1;
} | [
"void",
"Timer0BIntHandler",
"(",
"void",
")",
"{",
"TimerIntClear",
"(",
"TIMER0_BASE",
",",
"TIMER_TIMB_TIMEOUT",
")",
";",
"g_ulIntFlag",
"=",
"1",
";",
"}"
] | The interrupt handler for the for Timer0B interrupt. | [
"The",
"interrupt",
"handler",
"for",
"the",
"for",
"Timer0B",
"interrupt",
"."
] | [
"//\r",
"// Clear the timer interrupt flag.\r",
"//\r",
"//\r",
"// Set a flag to indicate that the interrupt occurred.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | SELECT | void | static
void SELECT (void)
{
GPIOPinWrite(SDC_CS_GPIO_PORT_BASE, SDC_CS, 0);
} | // asserts the CS pin to the card
| asserts the CS pin to the card | [
"asserts",
"the",
"CS",
"pin",
"to",
"the",
"card"
] | static
void SELECT (void)
{
GPIOPinWrite(SDC_CS_GPIO_PORT_BASE, SDC_CS, 0);
} | [
"static",
"void",
"SELECT",
"(",
"void",
")",
"{",
"GPIOPinWrite",
"(",
"SDC_CS_GPIO_PORT_BASE",
",",
"SDC_CS",
",",
"0",
")",
";",
"}"
] | asserts the CS pin to the card | [
"asserts",
"the",
"CS",
"pin",
"to",
"the",
"card"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | DESELECT | void | static
void DESELECT (void)
{
GPIOPinWrite(SDC_CS_GPIO_PORT_BASE, SDC_CS, SDC_CS);
} | // de-asserts the CS pin to the card
| de-asserts the CS pin to the card | [
"de",
"-",
"asserts",
"the",
"CS",
"pin",
"to",
"the",
"card"
] | static
void DESELECT (void)
{
GPIOPinWrite(SDC_CS_GPIO_PORT_BASE, SDC_CS, SDC_CS);
} | [
"static",
"void",
"DESELECT",
"(",
"void",
")",
"{",
"GPIOPinWrite",
"(",
"SDC_CS_GPIO_PORT_BASE",
",",
"SDC_CS",
",",
"SDC_CS",
")",
";",
"}"
] | de-asserts the CS pin to the card | [
"de",
"-",
"asserts",
"the",
"CS",
"pin",
"to",
"the",
"card"
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | xmit_spi | void | static
void xmit_spi (BYTE dat)
{
DWORD rcvdat;
SSIDataPut(SDC_SSI_BASE, dat); /* Write the data to the tx fifo */
SSIDataGet(SDC_SSI_BASE, &rcvdat); /* flush data read during the write */
} | /*-----------------------------------------------------------------------*/
/* Transmit a byte to MMC via SPI (Platform dependent) */
/*-----------------------------------------------------------------------*/ | Transmit a byte to MMC via SPI (Platform dependent) | [
"Transmit",
"a",
"byte",
"to",
"MMC",
"via",
"SPI",
"(",
"Platform",
"dependent",
")"
] | static
void xmit_spi (BYTE dat)
{
DWORD rcvdat;
SSIDataPut(SDC_SSI_BASE, dat);
SSIDataGet(SDC_SSI_BASE, &rcvdat);
} | [
"static",
"void",
"xmit_spi",
"(",
"BYTE",
"dat",
")",
"{",
"DWORD",
"rcvdat",
";",
"SSIDataPut",
"(",
"SDC_SSI_BASE",
",",
"dat",
")",
";",
"SSIDataGet",
"(",
"SDC_SSI_BASE",
",",
"&",
"rcvdat",
")",
";",
"}"
] | Transmit a byte to MMC via SPI (Platform dependent) | [
"Transmit",
"a",
"byte",
"to",
"MMC",
"via",
"SPI",
"(",
"Platform",
"dependent",
")"
] | [
"/* Write the data to the tx fifo */",
"/* flush data read during the write */"
] | [
{
"param": "dat",
"type": "BYTE"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "dat",
"type": "BYTE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | rcvr_spi | BYTE | static
BYTE rcvr_spi (void)
{
DWORD rcvdat;
SSIDataPut(SDC_SSI_BASE, 0xFF); /* write dummy data */
SSIDataGet(SDC_SSI_BASE, &rcvdat); /* read data frm rx fifo */
return (BYTE)rcvdat;
} | /*-----------------------------------------------------------------------*/
/* Receive a byte from MMC via SPI (Platform dependent) */
/*-----------------------------------------------------------------------*/ | Receive a byte from MMC via SPI (Platform dependent) | [
"Receive",
"a",
"byte",
"from",
"MMC",
"via",
"SPI",
"(",
"Platform",
"dependent",
")"
] | static
BYTE rcvr_spi (void)
{
DWORD rcvdat;
SSIDataPut(SDC_SSI_BASE, 0xFF);
SSIDataGet(SDC_SSI_BASE, &rcvdat);
return (BYTE)rcvdat;
} | [
"static",
"BYTE",
"rcvr_spi",
"(",
"void",
")",
"{",
"DWORD",
"rcvdat",
";",
"SSIDataPut",
"(",
"SDC_SSI_BASE",
",",
"0xFF",
")",
";",
"SSIDataGet",
"(",
"SDC_SSI_BASE",
",",
"&",
"rcvdat",
")",
";",
"return",
"(",
"BYTE",
")",
"rcvdat",
";",
"}"
] | Receive a byte from MMC via SPI (Platform dependent) | [
"Receive",
"a",
"byte",
"from",
"MMC",
"via",
"SPI",
"(",
"Platform",
"dependent",
")"
] | [
"/* write dummy data */",
"/* read data frm rx fifo */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | send_initial_clock_train | void | static
void send_initial_clock_train(void)
{
unsigned int i;
DWORD dat;
/* Ensure CS is held high. */
DESELECT();
/* Switch the SSI TX line to a GPIO and drive it high too. */
GPIOPinTypeGPIOOutput(SDC_GPIO_PORT_BASE, SDC_SSI_TX);
GPIOPinWrite(SDC_GPIO_PORT_BASE, SDC_SSI_TX, SDC_SSI_TX);
/* Send 10 bytes over the SSI. This causes the clock to wiggle the */
/* required number of times. */
for(i = 0 ; i < 10 ; i++)
{
/* Write DUMMY data. SSIDataPut() waits until there is room in the */
/* FIFO. */
SSIDataPut(SDC_SSI_BASE, 0xFF);
/* Flush data read during data write. */
SSIDataGet(SDC_SSI_BASE, &dat);
}
/* Revert to hardware control of the SSI TX line. */
GPIOPinTypeSSI(SDC_GPIO_PORT_BASE, SDC_SSI_TX);
} | /*-----------------------------------------------------------------------*/
/* Send 80 or so clock transitions with CS and DI held high. This is */
/* required after card power up to get it into SPI mode */
/*-----------------------------------------------------------------------*/ | Send 80 or so clock transitions with CS and DI held high. This is
required after card power up to get it into SPI mode | [
"Send",
"80",
"or",
"so",
"clock",
"transitions",
"with",
"CS",
"and",
"DI",
"held",
"high",
".",
"This",
"is",
"required",
"after",
"card",
"power",
"up",
"to",
"get",
"it",
"into",
"SPI",
"mode"
] | static
void send_initial_clock_train(void)
{
unsigned int i;
DWORD dat;
DESELECT();
GPIOPinTypeGPIOOutput(SDC_GPIO_PORT_BASE, SDC_SSI_TX);
GPIOPinWrite(SDC_GPIO_PORT_BASE, SDC_SSI_TX, SDC_SSI_TX);
for(i = 0 ; i < 10 ; i++)
{
SSIDataPut(SDC_SSI_BASE, 0xFF);
SSIDataGet(SDC_SSI_BASE, &dat);
}
GPIOPinTypeSSI(SDC_GPIO_PORT_BASE, SDC_SSI_TX);
} | [
"static",
"void",
"send_initial_clock_train",
"(",
"void",
")",
"{",
"unsigned",
"int",
"i",
";",
"DWORD",
"dat",
";",
"DESELECT",
"(",
")",
";",
"GPIOPinTypeGPIOOutput",
"(",
"SDC_GPIO_PORT_BASE",
",",
"SDC_SSI_TX",
")",
";",
"GPIOPinWrite",
"(",
"SDC_GPIO_PORT_BASE",
",",
"SDC_SSI_TX",
",",
"SDC_SSI_TX",
")",
";",
"for",
"(",
"i",
"=",
"0",
";",
"i",
"<",
"10",
";",
"i",
"++",
")",
"{",
"SSIDataPut",
"(",
"SDC_SSI_BASE",
",",
"0xFF",
")",
";",
"SSIDataGet",
"(",
"SDC_SSI_BASE",
",",
"&",
"dat",
")",
";",
"}",
"GPIOPinTypeSSI",
"(",
"SDC_GPIO_PORT_BASE",
",",
"SDC_SSI_TX",
")",
";",
"}"
] | Send 80 or so clock transitions with CS and DI held high. | [
"Send",
"80",
"or",
"so",
"clock",
"transitions",
"with",
"CS",
"and",
"DI",
"held",
"high",
"."
] | [
"/* Ensure CS is held high. */",
"/* Switch the SSI TX line to a GPIO and drive it high too. */",
"/* Send 10 bytes over the SSI. This causes the clock to wiggle the */",
"/* required number of times. */",
"/* Write DUMMY data. SSIDataPut() waits until there is room in the */",
"/* FIFO. */",
"/* Flush data read during data write. */",
"/* Revert to hardware control of the SSI TX line. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | power_on | void | static
void power_on (void)
{
/*
* This doesn't really turn the power on, but initializes the
* SSI port and pins needed to talk to the card.
*/
/* Enable the peripherals used to drive the SDC on SSI, and the CS */
SysCtlPeripheralEnable(SDC_SSI_SYSCTL_PERIPH);
SysCtlPeripheralEnable(SDC_GPIO_SYSCTL_PERIPH);
SysCtlPeripheralEnable(SDC_CS_GPIO_SYSCTL_PERIPH);
/* Configure the appropriate pins to be SSI instead of GPIO */
GPIOPinTypeSSI(SDC_GPIO_PORT_BASE, SDC_SSI_PINS);
GPIOPinTypeGPIOOutput(SDC_CS_GPIO_PORT_BASE, SDC_CS);
GPIOPadConfigSet(SDC_GPIO_PORT_BASE, SDC_SSI_PINS, GPIO_STRENGTH_4MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SDC_CS_GPIO_PORT_BASE, SDC_CS, GPIO_STRENGTH_4MA,
GPIO_PIN_TYPE_STD_WPU);
/* Deassert the SSI0 chip select */
GPIOPinWrite(SDC_CS_GPIO_PORT_BASE, SDC_CS, SDC_CS);
/* Configure the SSI0 port */
SSIConfigSetExpClk(SDC_SSI_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 400000, 8);
SSIEnable(SDC_SSI_BASE);
/* Set DI and CS high and apply more than 74 pulses to SCLK for the card */
/* to be able to accept a native command. */
send_initial_clock_train();
PowerFlag = 1;
} | /*-----------------------------------------------------------------------*/
/* Power Control (Platform dependent) */
/*-----------------------------------------------------------------------*/
/* When the target system does not support socket power control, there */
/* is nothing to do in these functions and chk_power always returns 1. */ | Power Control (Platform dependent)
When the target system does not support socket power control, there
is nothing to do in these functions and chk_power always returns 1. | [
"Power",
"Control",
"(",
"Platform",
"dependent",
")",
"When",
"the",
"target",
"system",
"does",
"not",
"support",
"socket",
"power",
"control",
"there",
"is",
"nothing",
"to",
"do",
"in",
"these",
"functions",
"and",
"chk_power",
"always",
"returns",
"1",
"."
] | static
void power_on (void)
{
SysCtlPeripheralEnable(SDC_SSI_SYSCTL_PERIPH);
SysCtlPeripheralEnable(SDC_GPIO_SYSCTL_PERIPH);
SysCtlPeripheralEnable(SDC_CS_GPIO_SYSCTL_PERIPH);
GPIOPinTypeSSI(SDC_GPIO_PORT_BASE, SDC_SSI_PINS);
GPIOPinTypeGPIOOutput(SDC_CS_GPIO_PORT_BASE, SDC_CS);
GPIOPadConfigSet(SDC_GPIO_PORT_BASE, SDC_SSI_PINS, GPIO_STRENGTH_4MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPadConfigSet(SDC_CS_GPIO_PORT_BASE, SDC_CS, GPIO_STRENGTH_4MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPinWrite(SDC_CS_GPIO_PORT_BASE, SDC_CS, SDC_CS);
SSIConfigSetExpClk(SDC_SSI_BASE, SysCtlClockGet(), SSI_FRF_MOTO_MODE_0,
SSI_MODE_MASTER, 400000, 8);
SSIEnable(SDC_SSI_BASE);
send_initial_clock_train();
PowerFlag = 1;
} | [
"static",
"void",
"power_on",
"(",
"void",
")",
"{",
"SysCtlPeripheralEnable",
"(",
"SDC_SSI_SYSCTL_PERIPH",
")",
";",
"SysCtlPeripheralEnable",
"(",
"SDC_GPIO_SYSCTL_PERIPH",
")",
";",
"SysCtlPeripheralEnable",
"(",
"SDC_CS_GPIO_SYSCTL_PERIPH",
")",
";",
"GPIOPinTypeSSI",
"(",
"SDC_GPIO_PORT_BASE",
",",
"SDC_SSI_PINS",
")",
";",
"GPIOPinTypeGPIOOutput",
"(",
"SDC_CS_GPIO_PORT_BASE",
",",
"SDC_CS",
")",
";",
"GPIOPadConfigSet",
"(",
"SDC_GPIO_PORT_BASE",
",",
"SDC_SSI_PINS",
",",
"GPIO_STRENGTH_4MA",
",",
"GPIO_PIN_TYPE_STD_WPU",
")",
";",
"GPIOPadConfigSet",
"(",
"SDC_CS_GPIO_PORT_BASE",
",",
"SDC_CS",
",",
"GPIO_STRENGTH_4MA",
",",
"GPIO_PIN_TYPE_STD_WPU",
")",
";",
"GPIOPinWrite",
"(",
"SDC_CS_GPIO_PORT_BASE",
",",
"SDC_CS",
",",
"SDC_CS",
")",
";",
"SSIConfigSetExpClk",
"(",
"SDC_SSI_BASE",
",",
"SysCtlClockGet",
"(",
")",
",",
"SSI_FRF_MOTO_MODE_0",
",",
"SSI_MODE_MASTER",
",",
"400000",
",",
"8",
")",
";",
"SSIEnable",
"(",
"SDC_SSI_BASE",
")",
";",
"send_initial_clock_train",
"(",
")",
";",
"PowerFlag",
"=",
"1",
";",
"}"
] | Power Control (Platform dependent)
When the target system does not support socket power control, there
is nothing to do in these functions and chk_power always returns 1. | [
"Power",
"Control",
"(",
"Platform",
"dependent",
")",
"When",
"the",
"target",
"system",
"does",
"not",
"support",
"socket",
"power",
"control",
"there",
"is",
"nothing",
"to",
"do",
"in",
"these",
"functions",
"and",
"chk_power",
"always",
"returns",
"1",
"."
] | [
"/*\r\n * This doesn't really turn the power on, but initializes the\r\n * SSI port and pins needed to talk to the card.\r\n */",
"/* Enable the peripherals used to drive the SDC on SSI, and the CS */",
"/* Configure the appropriate pins to be SSI instead of GPIO */",
"/* Deassert the SSI0 chip select */",
"/* Configure the SSI0 port */",
"/* Set DI and CS high and apply more than 74 pulses to SCLK for the card */",
"/* to be able to accept a native command. */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | send_cmd | BYTE | static
BYTE send_cmd (
BYTE cmd, /* Command byte */
DWORD arg /* Argument */
)
{
BYTE n, res;
if (wait_ready() != 0xFF) return 0xFF;
/* Send command packet */
xmit_spi(cmd); /* Command */
xmit_spi((BYTE)(arg >> 24)); /* Argument[31..24] */
xmit_spi((BYTE)(arg >> 16)); /* Argument[23..16] */
xmit_spi((BYTE)(arg >> 8)); /* Argument[15..8] */
xmit_spi((BYTE)arg); /* Argument[7..0] */
n = 0xff;
if (cmd == CMD0) n = 0x95; /* CRC for CMD0(0) */
if (cmd == CMD8) n = 0x87; /* CRC for CMD8(0x1AA) */
xmit_spi(n);
/* Receive command response */
if (cmd == CMD12) rcvr_spi(); /* Skip a stuff byte when stop reading */
n = 10; /* Wait for a valid response in timeout of 10 attempts */
do
res = rcvr_spi();
while ((res & 0x80) && --n);
return res; /* Return with the response value */
} | /*-----------------------------------------------------------------------*/
/* Send a command packet to MMC */
/*-----------------------------------------------------------------------*/ | Send a command packet to MMC | [
"Send",
"a",
"command",
"packet",
"to",
"MMC"
] | static
BYTE send_cmd (
BYTE cmd,
DWORD arg
)
{
BYTE n, res;
if (wait_ready() != 0xFF) return 0xFF;
xmit_spi(cmd);
xmit_spi((BYTE)(arg >> 24));
xmit_spi((BYTE)(arg >> 16));
xmit_spi((BYTE)(arg >> 8));
xmit_spi((BYTE)arg);
n = 0xff;
if (cmd == CMD0) n = 0x95;
if (cmd == CMD8) n = 0x87;
xmit_spi(n);
if (cmd == CMD12) rcvr_spi();
n = 10;
do
res = rcvr_spi();
while ((res & 0x80) && --n);
return res;
} | [
"static",
"BYTE",
"send_cmd",
"(",
"BYTE",
"cmd",
",",
"DWORD",
"arg",
")",
"{",
"BYTE",
"n",
",",
"res",
";",
"if",
"(",
"wait_ready",
"(",
")",
"!=",
"0xFF",
")",
"return",
"0xFF",
";",
"xmit_spi",
"(",
"cmd",
")",
";",
"xmit_spi",
"(",
"(",
"BYTE",
")",
"(",
"arg",
">>",
"24",
")",
")",
";",
"xmit_spi",
"(",
"(",
"BYTE",
")",
"(",
"arg",
">>",
"16",
")",
")",
";",
"xmit_spi",
"(",
"(",
"BYTE",
")",
"(",
"arg",
">>",
"8",
")",
")",
";",
"xmit_spi",
"(",
"(",
"BYTE",
")",
"arg",
")",
";",
"n",
"=",
"0xff",
";",
"if",
"(",
"cmd",
"==",
"CMD0",
")",
"n",
"=",
"0x95",
";",
"if",
"(",
"cmd",
"==",
"CMD8",
")",
"n",
"=",
"0x87",
";",
"xmit_spi",
"(",
"n",
")",
";",
"if",
"(",
"cmd",
"==",
"CMD12",
")",
"rcvr_spi",
"(",
")",
";",
"n",
"=",
"10",
";",
"do",
"res",
"=",
"rcvr_spi",
"(",
")",
";",
"while",
"(",
"(",
"res",
"&",
"0x80",
")",
"&&",
"--",
"n",
")",
";",
"return",
"res",
";",
"}"
] | Send a command packet to MMC | [
"Send",
"a",
"command",
"packet",
"to",
"MMC"
] | [
"/* Command byte */",
"/* Argument */",
"/* Send command packet */",
"/* Command */",
"/* Argument[31..24] */",
"/* Argument[23..16] */",
"/* Argument[15..8] */",
"/* Argument[7..0] */",
"/* CRC for CMD0(0) */",
"/* CRC for CMD8(0x1AA) */",
"/* Receive command response */",
"/* Skip a stuff byte when stop reading */",
"/* Wait for a valid response in timeout of 10 attempts */",
"/* Return with the response value */"
] | [
{
"param": "cmd",
"type": "BYTE"
},
{
"param": "arg",
"type": "DWORD"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "cmd",
"type": "BYTE",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "arg",
"type": "DWORD",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79d77a704d0a3f8110457aac69ce7f08f3fcfba4 | junyanl-code/Luminary-Micro-Library | third_party/fatfs/port/mmc-ek-lm3s6965.c | [
"BSD-3-Clause"
] | C | send_cmd12 | BYTE | static
BYTE send_cmd12 (void)
{
BYTE n, res, val;
/* For CMD12, we don't wait for the card to be idle before we send
* the new command.
*/
/* Send command packet - the argument for CMD12 is ignored. */
xmit_spi(CMD12);
xmit_spi(0);
xmit_spi(0);
xmit_spi(0);
xmit_spi(0);
xmit_spi(0);
/* Read up to 10 bytes from the card, remembering the value read if it's
not 0xFF */
for(n = 0; n < 10; n++)
{
val = rcvr_spi();
if(val != 0xFF)
{
res = val;
}
}
return res; /* Return with the response value */
} | /*-----------------------------------------------------------------------*
* Send the special command used to terminate a multi-sector read.
*
* This is the only command which can be sent while the SDCard is sending
* data. The SDCard spec indicates that the data transfer will stop 2 bytes
* after the 6 byte CMD12 command is sent and that the card will then send
* 0xFF for between 2 and 6 more bytes before the R1 response byte. This
* response will be followed by another 0xFF byte. In testing, however, it
* seems that some cards don't send the 2 to 6 0xFF bytes between the end of
* data transmission and the response code. This function, therefore, merely
* reads 10 bytes and, if the last one read is 0xFF, returns the value of the
* latest non-0xFF byte as the response code.
*
*-----------------------------------------------------------------------*/ | Send the special command used to terminate a multi-sector read.
This is the only command which can be sent while the SDCard is sending
data. The SDCard spec indicates that the data transfer will stop 2 bytes
after the 6 byte CMD12 command is sent and that the card will then send
0xFF for between 2 and 6 more bytes before the R1 response byte. This
response will be followed by another 0xFF byte. In testing, however, it
seems that some cards don't send the 2 to 6 0xFF bytes between the end of
data transmission and the response code. This function, therefore, merely
reads 10 bytes and, if the last one read is 0xFF, returns the value of the
latest non-0xFF byte as the response code. | [
"Send",
"the",
"special",
"command",
"used",
"to",
"terminate",
"a",
"multi",
"-",
"sector",
"read",
".",
"This",
"is",
"the",
"only",
"command",
"which",
"can",
"be",
"sent",
"while",
"the",
"SDCard",
"is",
"sending",
"data",
".",
"The",
"SDCard",
"spec",
"indicates",
"that",
"the",
"data",
"transfer",
"will",
"stop",
"2",
"bytes",
"after",
"the",
"6",
"byte",
"CMD12",
"command",
"is",
"sent",
"and",
"that",
"the",
"card",
"will",
"then",
"send",
"0xFF",
"for",
"between",
"2",
"and",
"6",
"more",
"bytes",
"before",
"the",
"R1",
"response",
"byte",
".",
"This",
"response",
"will",
"be",
"followed",
"by",
"another",
"0xFF",
"byte",
".",
"In",
"testing",
"however",
"it",
"seems",
"that",
"some",
"cards",
"don",
"'",
"t",
"send",
"the",
"2",
"to",
"6",
"0xFF",
"bytes",
"between",
"the",
"end",
"of",
"data",
"transmission",
"and",
"the",
"response",
"code",
".",
"This",
"function",
"therefore",
"merely",
"reads",
"10",
"bytes",
"and",
"if",
"the",
"last",
"one",
"read",
"is",
"0xFF",
"returns",
"the",
"value",
"of",
"the",
"latest",
"non",
"-",
"0xFF",
"byte",
"as",
"the",
"response",
"code",
"."
] | static
BYTE send_cmd12 (void)
{
BYTE n, res, val;
xmit_spi(CMD12);
xmit_spi(0);
xmit_spi(0);
xmit_spi(0);
xmit_spi(0);
xmit_spi(0);
for(n = 0; n < 10; n++)
{
val = rcvr_spi();
if(val != 0xFF)
{
res = val;
}
}
return res;
} | [
"static",
"BYTE",
"send_cmd12",
"(",
"void",
")",
"{",
"BYTE",
"n",
",",
"res",
",",
"val",
";",
"xmit_spi",
"(",
"CMD12",
")",
";",
"xmit_spi",
"(",
"0",
")",
";",
"xmit_spi",
"(",
"0",
")",
";",
"xmit_spi",
"(",
"0",
")",
";",
"xmit_spi",
"(",
"0",
")",
";",
"xmit_spi",
"(",
"0",
")",
";",
"for",
"(",
"n",
"=",
"0",
";",
"n",
"<",
"10",
";",
"n",
"++",
")",
"{",
"val",
"=",
"rcvr_spi",
"(",
")",
";",
"if",
"(",
"val",
"!=",
"0xFF",
")",
"{",
"res",
"=",
"val",
";",
"}",
"}",
"return",
"res",
";",
"}"
] | Send the special command used to terminate a multi-sector read. | [
"Send",
"the",
"special",
"command",
"used",
"to",
"terminate",
"a",
"multi",
"-",
"sector",
"read",
"."
] | [
"/* For CMD12, we don't wait for the card to be idle before we send\r\n * the new command.\r\n */",
"/* Send command packet - the argument for CMD12 is ignored. */",
"/* Read up to 10 bytes from the card, remembering the value read if it's\r\n not 0xFF */",
"/* Return with the response value */"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
555d1d3d8714c2590994b5a7fd0e8daa9d3d2998 | junyanl-code/Luminary-Micro-Library | boards/rdk-bldc/basic-bldc/hall_ctrl.c | [
"BSD-3-Clause"
] | C | HallSpeedNewValue | void | static void
HallSpeedNewValue(unsigned long ulNewSpeed)
{
unsigned short usDelta;
//
// Compute the difference in the speed.
//
if(ulNewSpeed > g_ulHallRotorSpeed)
{
usDelta = ulNewSpeed - g_ulHallRotorSpeed;
}
else
{
usDelta = g_ulHallRotorSpeed - ulNewSpeed;
}
//
// If the speed difference is too large then return without updating the
// motor speed.
//
if(usDelta > (UI_PARAM_MAX_SPEED / 2))
{
return;
}
//
// Pass the new rotor speed reading through the low pass filter.
//
g_ulHallRotorSpeed = ((g_ulHallRotorSpeed * 3) + ulNewSpeed) / 4;
} | //*****************************************************************************
//
// Updates the current rotor speed.
//
// \param ulNewSpeed is the newly measured speed.
//
// This function takes a newly measured rotor speed and uses it to update
// the current rotor speed. If the new speed is different from the
// current speed by too large a margin, the new speed measurement is
// discarded (a noise filter). If the new speed is accepted, it is passed
// through a single-pole IIR low pass filter with a coefficient of 0.75.
//
// \return None.
//
//*****************************************************************************
| Updates the current rotor speed.
\param ulNewSpeed is the newly measured speed.
This function takes a newly measured rotor speed and uses it to update
the current rotor speed. If the new speed is different from the
current speed by too large a margin, the new speed measurement is
discarded (a noise filter). If the new speed is accepted, it is passed
through a single-pole IIR low pass filter with a coefficient of 0.75.
\return None. | [
"Updates",
"the",
"current",
"rotor",
"speed",
".",
"\\",
"param",
"ulNewSpeed",
"is",
"the",
"newly",
"measured",
"speed",
".",
"This",
"function",
"takes",
"a",
"newly",
"measured",
"rotor",
"speed",
"and",
"uses",
"it",
"to",
"update",
"the",
"current",
"rotor",
"speed",
".",
"If",
"the",
"new",
"speed",
"is",
"different",
"from",
"the",
"current",
"speed",
"by",
"too",
"large",
"a",
"margin",
"the",
"new",
"speed",
"measurement",
"is",
"discarded",
"(",
"a",
"noise",
"filter",
")",
".",
"If",
"the",
"new",
"speed",
"is",
"accepted",
"it",
"is",
"passed",
"through",
"a",
"single",
"-",
"pole",
"IIR",
"low",
"pass",
"filter",
"with",
"a",
"coefficient",
"of",
"0",
".",
"75",
".",
"\\",
"return",
"None",
"."
] | static void
HallSpeedNewValue(unsigned long ulNewSpeed)
{
unsigned short usDelta;
if(ulNewSpeed > g_ulHallRotorSpeed)
{
usDelta = ulNewSpeed - g_ulHallRotorSpeed;
}
else
{
usDelta = g_ulHallRotorSpeed - ulNewSpeed;
}
if(usDelta > (UI_PARAM_MAX_SPEED / 2))
{
return;
}
g_ulHallRotorSpeed = ((g_ulHallRotorSpeed * 3) + ulNewSpeed) / 4;
} | [
"static",
"void",
"HallSpeedNewValue",
"(",
"unsigned",
"long",
"ulNewSpeed",
")",
"{",
"unsigned",
"short",
"usDelta",
";",
"if",
"(",
"ulNewSpeed",
">",
"g_ulHallRotorSpeed",
")",
"{",
"usDelta",
"=",
"ulNewSpeed",
"-",
"g_ulHallRotorSpeed",
";",
"}",
"else",
"{",
"usDelta",
"=",
"g_ulHallRotorSpeed",
"-",
"ulNewSpeed",
";",
"}",
"if",
"(",
"usDelta",
">",
"(",
"UI_PARAM_MAX_SPEED",
"/",
"2",
")",
")",
"{",
"return",
";",
"}",
"g_ulHallRotorSpeed",
"=",
"(",
"(",
"g_ulHallRotorSpeed",
"*",
"3",
")",
"+",
"ulNewSpeed",
")",
"/",
"4",
";",
"}"
] | Updates the current rotor speed. | [
"Updates",
"the",
"current",
"rotor",
"speed",
"."
] | [
"//\r",
"// Compute the difference in the speed.\r",
"//\r",
"//\r",
"// If the speed difference is too large then return without updating the\r",
"// motor speed.\r",
"//\r",
"//\r",
"// Pass the new rotor speed reading through the low pass filter.\r",
"//\r"
] | [
{
"param": "ulNewSpeed",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ulNewSpeed",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
555d1d3d8714c2590994b5a7fd0e8daa9d3d2998 | junyanl-code/Luminary-Micro-Library | boards/rdk-bldc/basic-bldc/hall_ctrl.c | [
"BSD-3-Clause"
] | C | GPIOBIntHandler | void | void
GPIOBIntHandler(void)
{
unsigned long ulTime, ulNewTime, ulTemp;
static unsigned long ulLastHall = 1;
//
// Get the time of this edge.
//
ulNewTime = UIGetTicks();
//
// Clear the Hall GPIO pin interrupts.
//
GPIOPinIntClear(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
//
// Read the current Hall sensor data.
//
g_ulHallValue = GPIOPinRead(PIN_HALLA_PORT,
(PIN_HALLC_PIN | PIN_HALLB_PIN | PIN_HALLA_PIN)) >> 4;
//
// Invert the Hall Sensor value, if necessary.
//
if(UI_PARAM_SENSOR_POLARITY == SENSOR_POLARITY_LOW)
{
g_ulHallValue = g_ulHallValue ^ 0x07;
}
//
// Update the output waveform if running Trapezoid modulation.
//
if(UI_PARAM_MODULATION == MODULATION_TRAPEZOID)
{
TrapModulate(g_ulHallValue);
}
//
// Set the flag to indicate that we have seen an edge.
//
HWREGBITW(&g_ulHallSpeedFlags, FLAG_EDGE_BIT) = 1;
//
// Check for rising edge of Hall A.
//
if(((ulLastHall & 1) == 0) && ((g_ulHallValue & 1) == 1))
{
//
// See if this edge should be skipped.
//
if(HWREGBITW(&g_ulHallSpeedFlags, FLAG_SKIP_BIT))
{
//
// This edge should be skipped, but an edge time now exists so the
// next edge should not be skipped.
//
HWREGBITW(&g_ulHallSpeedFlags, FLAG_SKIP_BIT) = 0;
//
// Save the time of the current edge.
//
g_ulHallSpeedPrevious = ulNewTime;
//
// Save the Hall state data.
//
ulLastHall = g_ulHallValue;
//
// There is nothing further to be done.
//
return;
}
//
// Compute the time between this edge and the previous edge.
//
ulTime = ulNewTime - g_ulHallSpeedPrevious;
//
// Save the time of the current edge.
//
g_ulHallSpeedPrevious = ulNewTime;
//
// Compute the new speed from the time between edges.
//
ulTemp = (SYSTEM_CLOCK * 60U);
ulTemp = (ulTemp / ulTime);
ulTemp = (ulTemp / (UI_PARAM_NUM_POLES / 2));
HallSpeedNewValue(ulTemp);
}
//
// Save the Hall state data.
//
ulLastHall = g_ulHallValue;
} | //*****************************************************************************
//
// Handles the GPIO port B interrupt.
//
// This function is called when GPIO port B asserts its interrupt. GPIO port
// B is configured to generate an interrupt on both the rising and falling
// edges of the Hall sensor input signals.
//
// \return None.
//
//*****************************************************************************
| Handles the GPIO port B interrupt.
This function is called when GPIO port B asserts its interrupt. GPIO port
B is configured to generate an interrupt on both the rising and falling
edges of the Hall sensor input signals.
\return None. | [
"Handles",
"the",
"GPIO",
"port",
"B",
"interrupt",
".",
"This",
"function",
"is",
"called",
"when",
"GPIO",
"port",
"B",
"asserts",
"its",
"interrupt",
".",
"GPIO",
"port",
"B",
"is",
"configured",
"to",
"generate",
"an",
"interrupt",
"on",
"both",
"the",
"rising",
"and",
"falling",
"edges",
"of",
"the",
"Hall",
"sensor",
"input",
"signals",
".",
"\\",
"return",
"None",
"."
] | void
GPIOBIntHandler(void)
{
unsigned long ulTime, ulNewTime, ulTemp;
static unsigned long ulLastHall = 1;
ulNewTime = UIGetTicks();
GPIOPinIntClear(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
g_ulHallValue = GPIOPinRead(PIN_HALLA_PORT,
(PIN_HALLC_PIN | PIN_HALLB_PIN | PIN_HALLA_PIN)) >> 4;
if(UI_PARAM_SENSOR_POLARITY == SENSOR_POLARITY_LOW)
{
g_ulHallValue = g_ulHallValue ^ 0x07;
}
if(UI_PARAM_MODULATION == MODULATION_TRAPEZOID)
{
TrapModulate(g_ulHallValue);
}
HWREGBITW(&g_ulHallSpeedFlags, FLAG_EDGE_BIT) = 1;
if(((ulLastHall & 1) == 0) && ((g_ulHallValue & 1) == 1))
{
if(HWREGBITW(&g_ulHallSpeedFlags, FLAG_SKIP_BIT))
{
HWREGBITW(&g_ulHallSpeedFlags, FLAG_SKIP_BIT) = 0;
g_ulHallSpeedPrevious = ulNewTime;
ulLastHall = g_ulHallValue;
return;
}
ulTime = ulNewTime - g_ulHallSpeedPrevious;
g_ulHallSpeedPrevious = ulNewTime;
ulTemp = (SYSTEM_CLOCK * 60U);
ulTemp = (ulTemp / ulTime);
ulTemp = (ulTemp / (UI_PARAM_NUM_POLES / 2));
HallSpeedNewValue(ulTemp);
}
ulLastHall = g_ulHallValue;
} | [
"void",
"GPIOBIntHandler",
"(",
"void",
")",
"{",
"unsigned",
"long",
"ulTime",
",",
"ulNewTime",
",",
"ulTemp",
";",
"static",
"unsigned",
"long",
"ulLastHall",
"=",
"1",
";",
"ulNewTime",
"=",
"UIGetTicks",
"(",
")",
";",
"GPIOPinIntClear",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLA_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLC_PIN",
")",
")",
";",
"g_ulHallValue",
"=",
"GPIOPinRead",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLC_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLA_PIN",
")",
")",
">>",
"4",
";",
"if",
"(",
"UI_PARAM_SENSOR_POLARITY",
"==",
"SENSOR_POLARITY_LOW",
")",
"{",
"g_ulHallValue",
"=",
"g_ulHallValue",
"^",
"0x07",
";",
"}",
"if",
"(",
"UI_PARAM_MODULATION",
"==",
"MODULATION_TRAPEZOID",
")",
"{",
"TrapModulate",
"(",
"g_ulHallValue",
")",
";",
"}",
"HWREGBITW",
"(",
"&",
"g_ulHallSpeedFlags",
",",
"FLAG_EDGE_BIT",
")",
"=",
"1",
";",
"if",
"(",
"(",
"(",
"ulLastHall",
"&",
"1",
")",
"==",
"0",
")",
"&&",
"(",
"(",
"g_ulHallValue",
"&",
"1",
")",
"==",
"1",
")",
")",
"{",
"if",
"(",
"HWREGBITW",
"(",
"&",
"g_ulHallSpeedFlags",
",",
"FLAG_SKIP_BIT",
")",
")",
"{",
"HWREGBITW",
"(",
"&",
"g_ulHallSpeedFlags",
",",
"FLAG_SKIP_BIT",
")",
"=",
"0",
";",
"g_ulHallSpeedPrevious",
"=",
"ulNewTime",
";",
"ulLastHall",
"=",
"g_ulHallValue",
";",
"return",
";",
"}",
"ulTime",
"=",
"ulNewTime",
"-",
"g_ulHallSpeedPrevious",
";",
"g_ulHallSpeedPrevious",
"=",
"ulNewTime",
";",
"ulTemp",
"=",
"(",
"SYSTEM_CLOCK",
"*",
"60U",
")",
";",
"ulTemp",
"=",
"(",
"ulTemp",
"/",
"ulTime",
")",
";",
"ulTemp",
"=",
"(",
"ulTemp",
"/",
"(",
"UI_PARAM_NUM_POLES",
"/",
"2",
")",
")",
";",
"HallSpeedNewValue",
"(",
"ulTemp",
")",
";",
"}",
"ulLastHall",
"=",
"g_ulHallValue",
";",
"}"
] | Handles the GPIO port B interrupt. | [
"Handles",
"the",
"GPIO",
"port",
"B",
"interrupt",
"."
] | [
"//\r",
"// Get the time of this edge.\r",
"//\r",
"//\r",
"// Clear the Hall GPIO pin interrupts.\r",
"//\r",
"//\r",
"// Read the current Hall sensor data.\r",
"//\r",
"//\r",
"// Invert the Hall Sensor value, if necessary.\r",
"//\r",
"//\r",
"// Update the output waveform if running Trapezoid modulation.\r",
"//\r",
"//\r",
"// Set the flag to indicate that we have seen an edge.\r",
"// \r",
"//\r",
"// Check for rising edge of Hall A.\r",
"//\r",
"//\r",
"// See if this edge should be skipped.\r",
"//\r",
"//\r",
"// This edge should be skipped, but an edge time now exists so the\r",
"// next edge should not be skipped.\r",
"//\r",
"//\r",
"// Save the time of the current edge.\r",
"//\r",
"//\r",
"// Save the Hall state data.\r",
"//\r",
"//\r",
"// There is nothing further to be done.\r",
"//\r",
"//\r",
"// Compute the time between this edge and the previous edge.\r",
"//\r",
"//\r",
"// Save the time of the current edge.\r",
"//\r",
"//\r",
"// Compute the new speed from the time between edges.\r",
"//\r",
"//\r",
"// Save the Hall state data.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
555d1d3d8714c2590994b5a7fd0e8daa9d3d2998 | junyanl-code/Luminary-Micro-Library | boards/rdk-bldc/basic-bldc/hall_ctrl.c | [
"BSD-3-Clause"
] | C | HallTickHandler | void | void
HallTickHandler(void)
{
//
// See if an edge was seen during this tick period.
//
if(HWREGBITW(&g_ulHallSpeedFlags, FLAG_EDGE_BIT) == 1)
{
//
// An edge was seen, so clear the flag so the next period can be
// checked as well.
//
HWREGBITW(&g_ulHallSpeedFlags, FLAG_EDGE_BIT) = 0;
//
// There is nothing more to do here, so return.
//
return;
}
//
// Check to see if time since the last edge is to large.
//
if((UIGetTicks() - g_ulHallSpeedPrevious) > (SYSTEM_CLOCK / 5))
{
//
// No edge was seen, so set the rotor speed to zero.
//
g_ulHallRotorSpeed = 0;
//
// Since the amount of time the rotor is stopped is indeterminate,
// skip the first edge when the rotor starts rotating again.
//
HWREGBITW(&g_ulHallSpeedFlags, FLAG_SKIP_BIT) = 1;
}
} | //*****************************************************************************
//
// Handles the Hall System Tick.
//
// This function is called by the system tick handler. It's primary
// purpose is to reset the motor speed to 0 if no Hall interrupt edges have
// been detected for some period of time.
//
// \return None.
//
//*****************************************************************************
| Handles the Hall System Tick.
This function is called by the system tick handler. It's primary
purpose is to reset the motor speed to 0 if no Hall interrupt edges have
been detected for some period of time.
\return None. | [
"Handles",
"the",
"Hall",
"System",
"Tick",
".",
"This",
"function",
"is",
"called",
"by",
"the",
"system",
"tick",
"handler",
".",
"It",
"'",
"s",
"primary",
"purpose",
"is",
"to",
"reset",
"the",
"motor",
"speed",
"to",
"0",
"if",
"no",
"Hall",
"interrupt",
"edges",
"have",
"been",
"detected",
"for",
"some",
"period",
"of",
"time",
".",
"\\",
"return",
"None",
"."
] | void
HallTickHandler(void)
{
if(HWREGBITW(&g_ulHallSpeedFlags, FLAG_EDGE_BIT) == 1)
{
HWREGBITW(&g_ulHallSpeedFlags, FLAG_EDGE_BIT) = 0;
return;
}
if((UIGetTicks() - g_ulHallSpeedPrevious) > (SYSTEM_CLOCK / 5))
{
g_ulHallRotorSpeed = 0;
HWREGBITW(&g_ulHallSpeedFlags, FLAG_SKIP_BIT) = 1;
}
} | [
"void",
"HallTickHandler",
"(",
"void",
")",
"{",
"if",
"(",
"HWREGBITW",
"(",
"&",
"g_ulHallSpeedFlags",
",",
"FLAG_EDGE_BIT",
")",
"==",
"1",
")",
"{",
"HWREGBITW",
"(",
"&",
"g_ulHallSpeedFlags",
",",
"FLAG_EDGE_BIT",
")",
"=",
"0",
";",
"return",
";",
"}",
"if",
"(",
"(",
"UIGetTicks",
"(",
")",
"-",
"g_ulHallSpeedPrevious",
")",
">",
"(",
"SYSTEM_CLOCK",
"/",
"5",
")",
")",
"{",
"g_ulHallRotorSpeed",
"=",
"0",
";",
"HWREGBITW",
"(",
"&",
"g_ulHallSpeedFlags",
",",
"FLAG_SKIP_BIT",
")",
"=",
"1",
";",
"}",
"}"
] | Handles the Hall System Tick. | [
"Handles",
"the",
"Hall",
"System",
"Tick",
"."
] | [
"//\r",
"// See if an edge was seen during this tick period.\r",
"//\r",
"//\r",
"// An edge was seen, so clear the flag so the next period can be\r",
"// checked as well.\r",
"//\r",
"//\r",
"// There is nothing more to do here, so return.\r",
"//\r",
"//\r",
"// Check to see if time since the last edge is to large.\r",
"//\r",
"//\r",
"// No edge was seen, so set the rotor speed to zero.\r",
"//\r",
"//\r",
"// Since the amount of time the rotor is stopped is indeterminate,\r",
"// skip the first edge when the rotor starts rotating again.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
555d1d3d8714c2590994b5a7fd0e8daa9d3d2998 | junyanl-code/Luminary-Micro-Library | boards/rdk-bldc/basic-bldc/hall_ctrl.c | [
"BSD-3-Clause"
] | C | HallInit | void | void
HallInit(void)
{
//
// Configure the Hall effect GPIO pins as inputs.
//
GPIOPinTypeGPIOInput(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
//
// Configure the Hall effect GPIO pins as interrupts on both edges.
//
GPIOIntTypeSet(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN), GPIO_BOTH_EDGES);
} | //*****************************************************************************
//
// Initializes the Hall sensor control routines.
//
// This function will initialize the peripherals used determine the speed of
// the motor's rotor.
//
// \return None.
//
//*****************************************************************************
| Initializes the Hall sensor control routines.
This function will initialize the peripherals used determine the speed of
the motor's rotor.
\return None. | [
"Initializes",
"the",
"Hall",
"sensor",
"control",
"routines",
".",
"This",
"function",
"will",
"initialize",
"the",
"peripherals",
"used",
"determine",
"the",
"speed",
"of",
"the",
"motor",
"'",
"s",
"rotor",
".",
"\\",
"return",
"None",
"."
] | void
HallInit(void)
{
GPIOPinTypeGPIOInput(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
GPIOIntTypeSet(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN), GPIO_BOTH_EDGES);
} | [
"void",
"HallInit",
"(",
"void",
")",
"{",
"GPIOPinTypeGPIOInput",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLA_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLC_PIN",
")",
")",
";",
"GPIOIntTypeSet",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLA_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLC_PIN",
")",
",",
"GPIO_BOTH_EDGES",
")",
";",
"}"
] | Initializes the Hall sensor control routines. | [
"Initializes",
"the",
"Hall",
"sensor",
"control",
"routines",
"."
] | [
"//\r",
"// Configure the Hall effect GPIO pins as inputs.\r",
"//\r",
"//\r",
"// Configure the Hall effect GPIO pins as interrupts on both edges.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
555d1d3d8714c2590994b5a7fd0e8daa9d3d2998 | junyanl-code/Luminary-Micro-Library | boards/rdk-bldc/basic-bldc/hall_ctrl.c | [
"BSD-3-Clause"
] | C | HallConfigure | void | void
HallConfigure(void)
{
//
// If running in sensorless mode, or in Linear Hall sensor configuration,
// the Hall Sensor Interrupts should be disabled.
//
if((UI_PARAM_MODULATION == MODULATION_SENSORLESS) ||
(UI_PARAM_SENSOR_TYPE == SENSOR_TYPE_LINEAR) ||
(UI_PARAM_SENSOR_TYPE == SENSOR_TYPE_LINEAR_60))
{
//
// Disable the GPIO interrupt for Hall sensors.
//
IntDisable(INT_GPIOB);
//
// Disable the individual hall sensor interrupts.
//
GPIOPinIntDisable(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
//
// And we're done.
//
return;
}
//
// Clear any pending Hall GPIO pin interrupts.
//
GPIOPinIntClear(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
//
// (Re)Enable the Hall effect GPIO pin interrupts.
//
GPIOPinIntEnable(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
//
// (Re)Enable the Hall GPIO interrupt.
//
IntEnable(INT_GPIOB);
} | //*****************************************************************************
//
// Configure the Hall sensor control routines, based on motor drive
// parameters.
//
// This function will configure the Hall sensor routines, mainly enable/
// disable the Hall interrupt based on the motor drive configuration.
//
// \return None.
//
//*****************************************************************************
| Configure the Hall sensor control routines, based on motor drive
parameters.
This function will configure the Hall sensor routines, mainly enable
disable the Hall interrupt based on the motor drive configuration.
\return None. | [
"Configure",
"the",
"Hall",
"sensor",
"control",
"routines",
"based",
"on",
"motor",
"drive",
"parameters",
".",
"This",
"function",
"will",
"configure",
"the",
"Hall",
"sensor",
"routines",
"mainly",
"enable",
"disable",
"the",
"Hall",
"interrupt",
"based",
"on",
"the",
"motor",
"drive",
"configuration",
".",
"\\",
"return",
"None",
"."
] | void
HallConfigure(void)
{
if((UI_PARAM_MODULATION == MODULATION_SENSORLESS) ||
(UI_PARAM_SENSOR_TYPE == SENSOR_TYPE_LINEAR) ||
(UI_PARAM_SENSOR_TYPE == SENSOR_TYPE_LINEAR_60))
{
IntDisable(INT_GPIOB);
GPIOPinIntDisable(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
return;
}
GPIOPinIntClear(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
GPIOPinIntEnable(PIN_HALLA_PORT, (PIN_HALLA_PIN | PIN_HALLB_PIN |
PIN_HALLC_PIN));
IntEnable(INT_GPIOB);
} | [
"void",
"HallConfigure",
"(",
"void",
")",
"{",
"if",
"(",
"(",
"UI_PARAM_MODULATION",
"==",
"MODULATION_SENSORLESS",
")",
"||",
"(",
"UI_PARAM_SENSOR_TYPE",
"==",
"SENSOR_TYPE_LINEAR",
")",
"||",
"(",
"UI_PARAM_SENSOR_TYPE",
"==",
"SENSOR_TYPE_LINEAR_60",
")",
")",
"{",
"IntDisable",
"(",
"INT_GPIOB",
")",
";",
"GPIOPinIntDisable",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLA_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLC_PIN",
")",
")",
";",
"return",
";",
"}",
"GPIOPinIntClear",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLA_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLC_PIN",
")",
")",
";",
"GPIOPinIntEnable",
"(",
"PIN_HALLA_PORT",
",",
"(",
"PIN_HALLA_PIN",
"|",
"PIN_HALLB_PIN",
"|",
"PIN_HALLC_PIN",
")",
")",
";",
"IntEnable",
"(",
"INT_GPIOB",
")",
";",
"}"
] | Configure the Hall sensor control routines, based on motor drive
parameters. | [
"Configure",
"the",
"Hall",
"sensor",
"control",
"routines",
"based",
"on",
"motor",
"drive",
"parameters",
"."
] | [
"//\r",
"// If running in sensorless mode, or in Linear Hall sensor configuration,\r",
"// the Hall Sensor Interrupts should be disabled.\r",
"//\r",
"//\r",
"// Disable the GPIO interrupt for Hall sensors.\r",
"//\r",
"//\r",
"// Disable the individual hall sensor interrupts.\r",
"//\r",
"//\r",
"// And we're done.\r",
"//\r",
"//\r",
"// Clear any pending Hall GPIO pin interrupts.\r",
"//\r",
"//\r",
"// (Re)Enable the Hall effect GPIO pin interrupts.\r",
"//\r",
"//\r",
"// (Re)Enable the Hall GPIO interrupt.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a64099a601d3387b37cede34e081265bb1a3a903 | junyanl-code/Luminary-Micro-Library | boards/rdk-idm-sbc/drivers/wm8510.c | [
"BSD-3-Clause"
] | C | WM8510WriteRegister | tBoolean | static tBoolean
WM8510WriteRegister(unsigned char ucRegister, unsigned long ulData)
{
//
// Set the slave address.
//
ROM_I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, WM8510_I2C_ADDR_0, false);
//
// Write the next byte to the controller.
//
ROM_I2CMasterDataPut(I2C0_MASTER_BASE,
(ucRegister << 1) | ((ulData >> 8) & 1));
//
// Continue the transfer.
//
ROM_I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_START);
//
// Wait until the current byte has been transferred.
//
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false) == 0)
{
}
if(ROM_I2CMasterErr(I2C0_MASTER_BASE) != I2C_MASTER_ERR_NONE)
{
ROM_I2CMasterIntClear(I2C0_MASTER_BASE);
return(false);
}
//
// Wait until the current byte has been transferred.
//
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false))
{
ROM_I2CMasterIntClear(I2C0_MASTER_BASE);
}
//
// Write the next byte to the controller.
//
ROM_I2CMasterDataPut(I2C0_MASTER_BASE, ulData);
//
// End the transfer.
//
ROM_I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
//
// Wait until the current byte has been transferred.
//
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false) == 0)
{
}
if(ROM_I2CMasterErr(I2C0_MASTER_BASE) != I2C_MASTER_ERR_NONE)
{
return(false);
}
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false))
{
ROM_I2CMasterIntClear(I2C0_MASTER_BASE);
}
return(true);
} | //*****************************************************************************
//
// Write a register in the WM8510 DAC.
//
// \param ucRegister is the offset to the register to write.
// \param ulData is the data to be written to the DAC register.
//
// This function will write the register passed in /e ucAddr with the value
// passed in to /e ulData. The data in \e ulData is actually 9 bits and the
// value in /e ucRegister is interpreted as 7 bits.
//
// \return Returns \b true on success or \b false on error.
//
//*****************************************************************************
| Write a register in the WM8510 DAC.
\param ucRegister is the offset to the register to write.
\param ulData is the data to be written to the DAC register.
This function will write the register passed in /e ucAddr with the value
passed in to /e ulData. The data in \e ulData is actually 9 bits and the
value in /e ucRegister is interpreted as 7 bits.
\return Returns \b true on success or \b false on error. | [
"Write",
"a",
"register",
"in",
"the",
"WM8510",
"DAC",
".",
"\\",
"param",
"ucRegister",
"is",
"the",
"offset",
"to",
"the",
"register",
"to",
"write",
".",
"\\",
"param",
"ulData",
"is",
"the",
"data",
"to",
"be",
"written",
"to",
"the",
"DAC",
"register",
".",
"This",
"function",
"will",
"write",
"the",
"register",
"passed",
"in",
"/",
"e",
"ucAddr",
"with",
"the",
"value",
"passed",
"in",
"to",
"/",
"e",
"ulData",
".",
"The",
"data",
"in",
"\\",
"e",
"ulData",
"is",
"actually",
"9",
"bits",
"and",
"the",
"value",
"in",
"/",
"e",
"ucRegister",
"is",
"interpreted",
"as",
"7",
"bits",
".",
"\\",
"return",
"Returns",
"\\",
"b",
"true",
"on",
"success",
"or",
"\\",
"b",
"false",
"on",
"error",
"."
] | static tBoolean
WM8510WriteRegister(unsigned char ucRegister, unsigned long ulData)
{
ROM_I2CMasterSlaveAddrSet(I2C0_MASTER_BASE, WM8510_I2C_ADDR_0, false);
ROM_I2CMasterDataPut(I2C0_MASTER_BASE,
(ucRegister << 1) | ((ulData >> 8) & 1));
ROM_I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_START);
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false) == 0)
{
}
if(ROM_I2CMasterErr(I2C0_MASTER_BASE) != I2C_MASTER_ERR_NONE)
{
ROM_I2CMasterIntClear(I2C0_MASTER_BASE);
return(false);
}
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false))
{
ROM_I2CMasterIntClear(I2C0_MASTER_BASE);
}
ROM_I2CMasterDataPut(I2C0_MASTER_BASE, ulData);
ROM_I2CMasterControl(I2C0_MASTER_BASE, I2C_MASTER_CMD_BURST_SEND_FINISH);
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false) == 0)
{
}
if(ROM_I2CMasterErr(I2C0_MASTER_BASE) != I2C_MASTER_ERR_NONE)
{
return(false);
}
while(ROM_I2CMasterIntStatus(I2C0_MASTER_BASE, false))
{
ROM_I2CMasterIntClear(I2C0_MASTER_BASE);
}
return(true);
} | [
"static",
"tBoolean",
"WM8510WriteRegister",
"(",
"unsigned",
"char",
"ucRegister",
",",
"unsigned",
"long",
"ulData",
")",
"{",
"ROM_I2CMasterSlaveAddrSet",
"(",
"I2C0_MASTER_BASE",
",",
"WM8510_I2C_ADDR_0",
",",
"false",
")",
";",
"ROM_I2CMasterDataPut",
"(",
"I2C0_MASTER_BASE",
",",
"(",
"ucRegister",
"<<",
"1",
")",
"|",
"(",
"(",
"ulData",
">>",
"8",
")",
"&",
"1",
")",
")",
";",
"ROM_I2CMasterControl",
"(",
"I2C0_MASTER_BASE",
",",
"I2C_MASTER_CMD_BURST_SEND_START",
")",
";",
"while",
"(",
"ROM_I2CMasterIntStatus",
"(",
"I2C0_MASTER_BASE",
",",
"false",
")",
"==",
"0",
")",
"{",
"}",
"if",
"(",
"ROM_I2CMasterErr",
"(",
"I2C0_MASTER_BASE",
")",
"!=",
"I2C_MASTER_ERR_NONE",
")",
"{",
"ROM_I2CMasterIntClear",
"(",
"I2C0_MASTER_BASE",
")",
";",
"return",
"(",
"false",
")",
";",
"}",
"while",
"(",
"ROM_I2CMasterIntStatus",
"(",
"I2C0_MASTER_BASE",
",",
"false",
")",
")",
"{",
"ROM_I2CMasterIntClear",
"(",
"I2C0_MASTER_BASE",
")",
";",
"}",
"ROM_I2CMasterDataPut",
"(",
"I2C0_MASTER_BASE",
",",
"ulData",
")",
";",
"ROM_I2CMasterControl",
"(",
"I2C0_MASTER_BASE",
",",
"I2C_MASTER_CMD_BURST_SEND_FINISH",
")",
";",
"while",
"(",
"ROM_I2CMasterIntStatus",
"(",
"I2C0_MASTER_BASE",
",",
"false",
")",
"==",
"0",
")",
"{",
"}",
"if",
"(",
"ROM_I2CMasterErr",
"(",
"I2C0_MASTER_BASE",
")",
"!=",
"I2C_MASTER_ERR_NONE",
")",
"{",
"return",
"(",
"false",
")",
";",
"}",
"while",
"(",
"ROM_I2CMasterIntStatus",
"(",
"I2C0_MASTER_BASE",
",",
"false",
")",
")",
"{",
"ROM_I2CMasterIntClear",
"(",
"I2C0_MASTER_BASE",
")",
";",
"}",
"return",
"(",
"true",
")",
";",
"}"
] | Write a register in the WM8510 DAC. | [
"Write",
"a",
"register",
"in",
"the",
"WM8510",
"DAC",
"."
] | [
"//\r",
"// Set the slave address.\r",
"//\r",
"//\r",
"// Write the next byte to the controller.\r",
"//\r",
"//\r",
"// Continue the transfer.\r",
"//\r",
"//\r",
"// Wait until the current byte has been transferred.\r",
"//\r",
"//\r",
"// Wait until the current byte has been transferred.\r",
"//\r",
"//\r",
"// Write the next byte to the controller.\r",
"//\r",
"//\r",
"// End the transfer.\r",
"//\r",
"//\r",
"// Wait until the current byte has been transferred.\r",
"//\r"
] | [
{
"param": "ucRegister",
"type": "unsigned char"
},
{
"param": "ulData",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ucRegister",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulData",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a64099a601d3387b37cede34e081265bb1a3a903 | junyanl-code/Luminary-Micro-Library | boards/rdk-idm-sbc/drivers/wm8510.c | [
"BSD-3-Clause"
] | C | WM8510Init | void | void
WM8510Init(void)
{
//
// Configure the I2C SCL and SDA pins for I2C operation.
//
ROM_SysCtlPeripheralEnable(I2C0SCL_PERIPH);
ROM_GPIOPinTypeI2C(I2C0SCL_PORT, I2C0SCL_PIN | I2C0SDA_PIN);
//
// Enable the I2C peripheral.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
//
// Initialize the I2C master.
//
ROM_I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), 0);
//
// Allow the rest of the public APIs to make hardware changes.
//
g_ucEnabled = 1;
//
// Reset the audio codec. This sets all registers to their default values.
//
WM8510WriteRegister(WM8510_RESET_REG, 0);
//
// 32 bit I2S slave mode.
//
WM8510WriteRegister(WM8510_AUD_IF_REG, (AUD_IF_FMT_I2S |
AUD_IF_32_BIT_WORDS));
//
// Set the GPIO/CSB pin to a mode where it is an output. The pin is not
// connected on the basic board so we don't want it to be configured as
// an input (the default) since it's not clear (to me) whether it is pulled
// up or down within the device and we don't want a floating input muting
// the output occasionally.
//
WM8510WriteRegister(WM8510_GPIO_REG, GPIO_SEL_AMUTE_ACTIVE);
//
// We want to use MCLK to clock the device rather than its PLL.
//
WM8510WriteRegister(WM8510_CLK_CTRL_REG, (CLOCK_SLAVE |
CLOCK_MCLK_DIVIDE_1 | CLOCK_BCLK_DIVIDE_1));
//
// Enable 1.5x boost for the speaker outputs.
//
WM8510WriteRegister(WM8510_OUTPUT_CTRL_REG, (OUTPUT_SPKR_BOOST_EN |
OUTPUT_THERMAL_SHUTDN_EN));
//
// Set power options.
//
WM8510WriteRegister(WM8510_POWER1_REG, (POWER1_VMID_50K | POWER1_BUFIO_EN |
POWER1_BIAS_EN | POWER1_BUFDCOP_EN));
//
// Wait 500mS for the supply voltage to settle after turning on VMID.
//
SysCtlDelay(SysCtlClockGet() / 6);
//
// Disable the microphone input path.
//
WM8510WriteRegister(WM8510_INPUT_CTRL_REG, 0);
//
// Enable the DAC
//
WM8510WriteRegister(WM8510_POWER3_REG, POWER3_DAC_EN);
//
// Enable the speaker and mono mixers.
//
WM8510WriteRegister(WM8510_POWER3_REG, (POWER3_SPKR_MIX_EN |
POWER3_MONO_MIX_EN | POWER3_DAC_EN));
//
// Enable the speaker and mono outputs.
//
WM8510WriteRegister(WM8510_POWER3_REG, (POWER3_SPKR_MIX_EN |
POWER3_MONO_MIX_EN | POWER3_SPKR_P_EN |
POWER3_SPKR_N_EN | POWER3_MONO_EN | POWER3_DAC_EN));
//
// Set the speaker volume but leave it muted for now.
//
WM8510WriteRegister(WM8510_SPKR_VOL_CTRL_REG,
(SPKR_VOL_0DB | SPKR_VOL_MUTE));
//
// Set the initial digital volume.
//
WM8510VolumeSet(100);
//
// Ensure that the DAC output is routed to the speaker.
//
WM8510WriteRegister(WM8510_SPKR_MIX_CTRL_REG, SPKR_MIX_DAC_TO_SPK);
//
// Set the mono output mixer but leave it muted.
//
WM8510WriteRegister(WM8510_MONO_MIX_CTRL_REG, (MONO_MIX_DAC_TO_MONO |
MONO_MIX_MUTE));
//
// Unmute the DAC. DEBUG - Turn on AMUTE to check whether this is
// reflected in the GPIO output when playback stops. This will give us
// some indication that I2S data is being read correctly.
//
WM8510WriteRegister(WM8510_DAC_CTRL_REG, (DAC_OVERSAMPLE_64X |
DAC_DEEMPHASIS_NONE | DAC_AUTO_MUTE_EN));
//
// Unmute the speaker now that everything else is set up.
//
WM8510WriteRegister(WM8510_SPKR_VOL_CTRL_REG, SPKR_VOL_0DB);
//
// Unmute the mono output.
//
WM8510WriteRegister(WM8510_MONO_MIX_CTRL_REG, MONO_MIX_DAC_TO_MONO);
} | //*****************************************************************************
//
//! Initialize the WM8510 DAC.
//!
//! This function initializes the I2C interface and the WM8510 DAC.
//!
//! \return None
//
//*****************************************************************************
| Initialize the WM8510 DAC.
This function initializes the I2C interface and the WM8510 DAC.
\return None | [
"Initialize",
"the",
"WM8510",
"DAC",
".",
"This",
"function",
"initializes",
"the",
"I2C",
"interface",
"and",
"the",
"WM8510",
"DAC",
".",
"\\",
"return",
"None"
] | void
WM8510Init(void)
{
ROM_SysCtlPeripheralEnable(I2C0SCL_PERIPH);
ROM_GPIOPinTypeI2C(I2C0SCL_PORT, I2C0SCL_PIN | I2C0SDA_PIN);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_I2C0);
ROM_I2CMasterInitExpClk(I2C0_MASTER_BASE, SysCtlClockGet(), 0);
g_ucEnabled = 1;
WM8510WriteRegister(WM8510_RESET_REG, 0);
WM8510WriteRegister(WM8510_AUD_IF_REG, (AUD_IF_FMT_I2S |
AUD_IF_32_BIT_WORDS));
WM8510WriteRegister(WM8510_GPIO_REG, GPIO_SEL_AMUTE_ACTIVE);
WM8510WriteRegister(WM8510_CLK_CTRL_REG, (CLOCK_SLAVE |
CLOCK_MCLK_DIVIDE_1 | CLOCK_BCLK_DIVIDE_1));
WM8510WriteRegister(WM8510_OUTPUT_CTRL_REG, (OUTPUT_SPKR_BOOST_EN |
OUTPUT_THERMAL_SHUTDN_EN));
WM8510WriteRegister(WM8510_POWER1_REG, (POWER1_VMID_50K | POWER1_BUFIO_EN |
POWER1_BIAS_EN | POWER1_BUFDCOP_EN));
SysCtlDelay(SysCtlClockGet() / 6);
WM8510WriteRegister(WM8510_INPUT_CTRL_REG, 0);
WM8510WriteRegister(WM8510_POWER3_REG, POWER3_DAC_EN);
WM8510WriteRegister(WM8510_POWER3_REG, (POWER3_SPKR_MIX_EN |
POWER3_MONO_MIX_EN | POWER3_DAC_EN));
WM8510WriteRegister(WM8510_POWER3_REG, (POWER3_SPKR_MIX_EN |
POWER3_MONO_MIX_EN | POWER3_SPKR_P_EN |
POWER3_SPKR_N_EN | POWER3_MONO_EN | POWER3_DAC_EN));
WM8510WriteRegister(WM8510_SPKR_VOL_CTRL_REG,
(SPKR_VOL_0DB | SPKR_VOL_MUTE));
WM8510VolumeSet(100);
WM8510WriteRegister(WM8510_SPKR_MIX_CTRL_REG, SPKR_MIX_DAC_TO_SPK);
WM8510WriteRegister(WM8510_MONO_MIX_CTRL_REG, (MONO_MIX_DAC_TO_MONO |
MONO_MIX_MUTE));
WM8510WriteRegister(WM8510_DAC_CTRL_REG, (DAC_OVERSAMPLE_64X |
DAC_DEEMPHASIS_NONE | DAC_AUTO_MUTE_EN));
WM8510WriteRegister(WM8510_SPKR_VOL_CTRL_REG, SPKR_VOL_0DB);
WM8510WriteRegister(WM8510_MONO_MIX_CTRL_REG, MONO_MIX_DAC_TO_MONO);
} | [
"void",
"WM8510Init",
"(",
"void",
")",
"{",
"ROM_SysCtlPeripheralEnable",
"(",
"I2C0SCL_PERIPH",
")",
";",
"ROM_GPIOPinTypeI2C",
"(",
"I2C0SCL_PORT",
",",
"I2C0SCL_PIN",
"|",
"I2C0SDA_PIN",
")",
";",
"ROM_SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_I2C0",
")",
";",
"ROM_I2CMasterInitExpClk",
"(",
"I2C0_MASTER_BASE",
",",
"SysCtlClockGet",
"(",
")",
",",
"0",
")",
";",
"g_ucEnabled",
"=",
"1",
";",
"WM8510WriteRegister",
"(",
"WM8510_RESET_REG",
",",
"0",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_AUD_IF_REG",
",",
"(",
"AUD_IF_FMT_I2S",
"|",
"AUD_IF_32_BIT_WORDS",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_GPIO_REG",
",",
"GPIO_SEL_AMUTE_ACTIVE",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_CLK_CTRL_REG",
",",
"(",
"CLOCK_SLAVE",
"|",
"CLOCK_MCLK_DIVIDE_1",
"|",
"CLOCK_BCLK_DIVIDE_1",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_OUTPUT_CTRL_REG",
",",
"(",
"OUTPUT_SPKR_BOOST_EN",
"|",
"OUTPUT_THERMAL_SHUTDN_EN",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_POWER1_REG",
",",
"(",
"POWER1_VMID_50K",
"|",
"POWER1_BUFIO_EN",
"|",
"POWER1_BIAS_EN",
"|",
"POWER1_BUFDCOP_EN",
")",
")",
";",
"SysCtlDelay",
"(",
"SysCtlClockGet",
"(",
")",
"/",
"6",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_INPUT_CTRL_REG",
",",
"0",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_POWER3_REG",
",",
"POWER3_DAC_EN",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_POWER3_REG",
",",
"(",
"POWER3_SPKR_MIX_EN",
"|",
"POWER3_MONO_MIX_EN",
"|",
"POWER3_DAC_EN",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_POWER3_REG",
",",
"(",
"POWER3_SPKR_MIX_EN",
"|",
"POWER3_MONO_MIX_EN",
"|",
"POWER3_SPKR_P_EN",
"|",
"POWER3_SPKR_N_EN",
"|",
"POWER3_MONO_EN",
"|",
"POWER3_DAC_EN",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_SPKR_VOL_CTRL_REG",
",",
"(",
"SPKR_VOL_0DB",
"|",
"SPKR_VOL_MUTE",
")",
")",
";",
"WM8510VolumeSet",
"(",
"100",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_SPKR_MIX_CTRL_REG",
",",
"SPKR_MIX_DAC_TO_SPK",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_MONO_MIX_CTRL_REG",
",",
"(",
"MONO_MIX_DAC_TO_MONO",
"|",
"MONO_MIX_MUTE",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_DAC_CTRL_REG",
",",
"(",
"DAC_OVERSAMPLE_64X",
"|",
"DAC_DEEMPHASIS_NONE",
"|",
"DAC_AUTO_MUTE_EN",
")",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_SPKR_VOL_CTRL_REG",
",",
"SPKR_VOL_0DB",
")",
";",
"WM8510WriteRegister",
"(",
"WM8510_MONO_MIX_CTRL_REG",
",",
"MONO_MIX_DAC_TO_MONO",
")",
";",
"}"
] | Initialize the WM8510 DAC. | [
"Initialize",
"the",
"WM8510",
"DAC",
"."
] | [
"//\r",
"// Configure the I2C SCL and SDA pins for I2C operation.\r",
"//\r",
"//\r",
"// Enable the I2C peripheral.\r",
"//\r",
"//\r",
"// Initialize the I2C master.\r",
"//\r",
"//\r",
"// Allow the rest of the public APIs to make hardware changes.\r",
"//\r",
"//\r",
"// Reset the audio codec. This sets all registers to their default values.\r",
"//\r",
"//\r",
"// 32 bit I2S slave mode.\r",
"//\r",
"//\r",
"// Set the GPIO/CSB pin to a mode where it is an output. The pin is not\r",
"// connected on the basic board so we don't want it to be configured as\r",
"// an input (the default) since it's not clear (to me) whether it is pulled\r",
"// up or down within the device and we don't want a floating input muting\r",
"// the output occasionally.\r",
"//\r",
"//\r",
"// We want to use MCLK to clock the device rather than its PLL.\r",
"//\r",
"//\r",
"// Enable 1.5x boost for the speaker outputs.\r",
"//\r",
"//\r",
"// Set power options.\r",
"//\r",
"//\r",
"// Wait 500mS for the supply voltage to settle after turning on VMID.\r",
"//\r",
"//\r",
"// Disable the microphone input path.\r",
"//\r",
"//\r",
"// Enable the DAC\r",
"//\r",
"//\r",
"// Enable the speaker and mono mixers.\r",
"//\r",
"//\r",
"// Enable the speaker and mono outputs.\r",
"//\r",
"//\r",
"// Set the speaker volume but leave it muted for now.\r",
"//\r",
"//\r",
"// Set the initial digital volume.\r",
"//\r",
"//\r",
"// Ensure that the DAC output is routed to the speaker.\r",
"//\r",
"//\r",
"// Set the mono output mixer but leave it muted.\r",
"//\r",
"//\r",
"// Unmute the DAC. DEBUG - Turn on AMUTE to check whether this is\r",
"// reflected in the GPIO output when playback stops. This will give us\r",
"// some indication that I2S data is being read correctly.\r",
"//\r",
"//\r",
"// Unmute the speaker now that everything else is set up.\r",
"//\r",
"//\r",
"// Unmute the mono output.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a64099a601d3387b37cede34e081265bb1a3a903 | junyanl-code/Luminary-Micro-Library | boards/rdk-idm-sbc/drivers/wm8510.c | [
"BSD-3-Clause"
] | C | WM8510VolumeSet | void | void
WM8510VolumeSet(unsigned long ulVolume)
{
unsigned long ulDACVolume;
g_ulVolume = ulVolume;
//
// Cap the volume at 100%
//
if(g_ulVolume >= 100)
{
g_ulVolume = 100;
}
if(g_ucEnabled == 1)
{
//
// Scale and translate the percentage volume supplied into the valid
// range for the DAC.
//
if(ulVolume == 0)
{
ulDACVolume = DAC_VOLUME_MUTE;
}
else
{
//
// We are not muted so scale the 1-100% passed into the volume
// range between 0dB (100%) and -50dB (1%).
//
ulDACVolume = (((unsigned long) g_ulVolume *
(DAC_VOLUME_0DB - DAC_VOLUME_LOWER_LIMIT)) / 100) +
DAC_VOLUME_LOWER_LIMIT;
}
//
// Set the left and right volumes with zero cross detect.
//
WM8510WriteRegister(WM8510_DAC_VOL_REG, ulDACVolume);
}
} | //*****************************************************************************
//
//! Sets the volume on the DAC.
//!
//! \param ulVolume is the volume level to set, specified as a percentage
//! between 0% (silence) and 100% (full volume), inclusive.
//!
//! This function adjusts the audio output up by the specified percentage. The
//! adjusted volume will not go above 100% (full volume). The volume is scaled
//! linearly in the range 0db to -50dB with the DAC muted if 0% is passed.
//!
//! \return None
//
//*****************************************************************************
| Sets the volume on the DAC.
\param ulVolume is the volume level to set, specified as a percentage
between 0% (silence) and 100% (full volume), inclusive.
This function adjusts the audio output up by the specified percentage. The
adjusted volume will not go above 100% (full volume). The volume is scaled
linearly in the range 0db to -50dB with the DAC muted if 0% is passed.
\return None | [
"Sets",
"the",
"volume",
"on",
"the",
"DAC",
".",
"\\",
"param",
"ulVolume",
"is",
"the",
"volume",
"level",
"to",
"set",
"specified",
"as",
"a",
"percentage",
"between",
"0%",
"(",
"silence",
")",
"and",
"100%",
"(",
"full",
"volume",
")",
"inclusive",
".",
"This",
"function",
"adjusts",
"the",
"audio",
"output",
"up",
"by",
"the",
"specified",
"percentage",
".",
"The",
"adjusted",
"volume",
"will",
"not",
"go",
"above",
"100%",
"(",
"full",
"volume",
")",
".",
"The",
"volume",
"is",
"scaled",
"linearly",
"in",
"the",
"range",
"0db",
"to",
"-",
"50dB",
"with",
"the",
"DAC",
"muted",
"if",
"0%",
"is",
"passed",
".",
"\\",
"return",
"None"
] | void
WM8510VolumeSet(unsigned long ulVolume)
{
unsigned long ulDACVolume;
g_ulVolume = ulVolume;
if(g_ulVolume >= 100)
{
g_ulVolume = 100;
}
if(g_ucEnabled == 1)
{
if(ulVolume == 0)
{
ulDACVolume = DAC_VOLUME_MUTE;
}
else
{
ulDACVolume = (((unsigned long) g_ulVolume *
(DAC_VOLUME_0DB - DAC_VOLUME_LOWER_LIMIT)) / 100) +
DAC_VOLUME_LOWER_LIMIT;
}
WM8510WriteRegister(WM8510_DAC_VOL_REG, ulDACVolume);
}
} | [
"void",
"WM8510VolumeSet",
"(",
"unsigned",
"long",
"ulVolume",
")",
"{",
"unsigned",
"long",
"ulDACVolume",
";",
"g_ulVolume",
"=",
"ulVolume",
";",
"if",
"(",
"g_ulVolume",
">=",
"100",
")",
"{",
"g_ulVolume",
"=",
"100",
";",
"}",
"if",
"(",
"g_ucEnabled",
"==",
"1",
")",
"{",
"if",
"(",
"ulVolume",
"==",
"0",
")",
"{",
"ulDACVolume",
"=",
"DAC_VOLUME_MUTE",
";",
"}",
"else",
"{",
"ulDACVolume",
"=",
"(",
"(",
"(",
"unsigned",
"long",
")",
"g_ulVolume",
"*",
"(",
"DAC_VOLUME_0DB",
"-",
"DAC_VOLUME_LOWER_LIMIT",
")",
")",
"/",
"100",
")",
"+",
"DAC_VOLUME_LOWER_LIMIT",
";",
"}",
"WM8510WriteRegister",
"(",
"WM8510_DAC_VOL_REG",
",",
"ulDACVolume",
")",
";",
"}",
"}"
] | Sets the volume on the DAC. | [
"Sets",
"the",
"volume",
"on",
"the",
"DAC",
"."
] | [
"//\r",
"// Cap the volume at 100%\r",
"//\r",
"//\r",
"// Scale and translate the percentage volume supplied into the valid\r",
"// range for the DAC.\r",
"//\r",
"//\r",
"// We are not muted so scale the 1-100% passed into the volume\r",
"// range between 0dB (100%) and -50dB (1%).\r",
"//\r",
"//\r",
"// Set the left and right volumes with zero cross detect.\r",
"//\r"
] | [
{
"param": "ulVolume",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ulVolume",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a64099a601d3387b37cede34e081265bb1a3a903 | junyanl-code/Luminary-Micro-Library | boards/rdk-idm-sbc/drivers/wm8510.c | [
"BSD-3-Clause"
] | C | WM8510VolumeGet | null | unsigned long
WM8510VolumeGet(void)
{
return(g_ulVolume);
} | //*****************************************************************************
//
//! Returns the volume on the DAC.
//!
//! This function returns the current volume, specified as a percentage between
//! 0% (silence) and 100% (full volume), inclusive.
//!
//! \return Returns the current volume.
//
//*****************************************************************************
| Returns the volume on the DAC.
This function returns the current volume, specified as a percentage between
0% (silence) and 100% (full volume), inclusive.
\return Returns the current volume. | [
"Returns",
"the",
"volume",
"on",
"the",
"DAC",
".",
"This",
"function",
"returns",
"the",
"current",
"volume",
"specified",
"as",
"a",
"percentage",
"between",
"0%",
"(",
"silence",
")",
"and",
"100%",
"(",
"full",
"volume",
")",
"inclusive",
".",
"\\",
"return",
"Returns",
"the",
"current",
"volume",
"."
] | unsigned long
WM8510VolumeGet(void)
{
return(g_ulVolume);
} | [
"unsigned",
"long",
"WM8510VolumeGet",
"(",
"void",
")",
"{",
"return",
"(",
"g_ulVolume",
")",
";",
"}"
] | Returns the volume on the DAC. | [
"Returns",
"the",
"volume",
"on",
"the",
"DAC",
"."
] | [] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | TriggerToString | char | static char *
TriggerToString(tTriggerType eType)
{
char *pcTrig = 0;
unsigned long ulLoop;
//
// Get a description string for the trigger type.
//
for(ulLoop = 0; ulLoop < NUM_TRIGGER_MAP_ENTRIES; ulLoop++)
{
if(g_psTriggerMap[ulLoop].eTrigger == eType)
{
pcTrig = g_psTriggerMap[ulLoop].pcString;
break;
}
}
//
// Catch cases where we end up with an unknown trigger type.
//
if(ulLoop == NUM_TRIGGER_MAP_ENTRIES)
{
pcTrig = "**UNKNOWN**";
}
//
// Pass the string pointer back to the caller.
//
return(pcTrig);
} | //*****************************************************************************
//
// Map a trigger type to a human-readable string.
//
//*****************************************************************************
| Map a trigger type to a human-readable string. | [
"Map",
"a",
"trigger",
"type",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | static char *
TriggerToString(tTriggerType eType)
{
char *pcTrig = 0;
unsigned long ulLoop;
for(ulLoop = 0; ulLoop < NUM_TRIGGER_MAP_ENTRIES; ulLoop++)
{
if(g_psTriggerMap[ulLoop].eTrigger == eType)
{
pcTrig = g_psTriggerMap[ulLoop].pcString;
break;
}
}
if(ulLoop == NUM_TRIGGER_MAP_ENTRIES)
{
pcTrig = "**UNKNOWN**";
}
return(pcTrig);
} | [
"static",
"char",
"*",
"TriggerToString",
"(",
"tTriggerType",
"eType",
")",
"{",
"char",
"*",
"pcTrig",
"=",
"0",
";",
"unsigned",
"long",
"ulLoop",
";",
"for",
"(",
"ulLoop",
"=",
"0",
";",
"ulLoop",
"<",
"NUM_TRIGGER_MAP_ENTRIES",
";",
"ulLoop",
"++",
")",
"{",
"if",
"(",
"g_psTriggerMap",
"[",
"ulLoop",
"]",
".",
"eTrigger",
"==",
"eType",
")",
"{",
"pcTrig",
"=",
"g_psTriggerMap",
"[",
"ulLoop",
"]",
".",
"pcString",
";",
"break",
";",
"}",
"}",
"if",
"(",
"ulLoop",
"==",
"NUM_TRIGGER_MAP_ENTRIES",
")",
"{",
"pcTrig",
"=",
"\"",
"\"",
";",
"}",
"return",
"(",
"pcTrig",
")",
";",
"}"
] | Map a trigger type to a human-readable string. | [
"Map",
"a",
"trigger",
"type",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | [
"//\r",
"// Get a description string for the trigger type.\r",
"//\r",
"//\r",
"// Catch cases where we end up with an unknown trigger type.\r",
"//\r",
"//\r",
"// Pass the string pointer back to the caller.\r",
"//\r"
] | [
{
"param": "eType",
"type": "tTriggerType"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eType",
"type": "tTriggerType",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | StateToString | char | static char *
StateToString(tDataAcqState eState)
{
char *pcState = 0;
unsigned long ulLoop;
//
// Get a description string for the state.
//
for(ulLoop = 0; ulLoop < NUM_STATE_MAP_ENTRIES; ulLoop++)
{
if(g_psStateMap[ulLoop].eState == eState)
{
pcState = g_psStateMap[ulLoop].pcString;
break;
}
}
//
// Catch cases where we end up with an unknown trigger type.
//
if(ulLoop == NUM_STATE_MAP_ENTRIES)
{
pcState = "**UNKNOWN**";
}
//
// Pass the string pointer back to the caller.
//
return(pcState);
} | //*****************************************************************************
//
// Map a data acquisition state to a human-readable string.
//
//*****************************************************************************
| Map a data acquisition state to a human-readable string. | [
"Map",
"a",
"data",
"acquisition",
"state",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | static char *
StateToString(tDataAcqState eState)
{
char *pcState = 0;
unsigned long ulLoop;
for(ulLoop = 0; ulLoop < NUM_STATE_MAP_ENTRIES; ulLoop++)
{
if(g_psStateMap[ulLoop].eState == eState)
{
pcState = g_psStateMap[ulLoop].pcString;
break;
}
}
if(ulLoop == NUM_STATE_MAP_ENTRIES)
{
pcState = "**UNKNOWN**";
}
return(pcState);
} | [
"static",
"char",
"*",
"StateToString",
"(",
"tDataAcqState",
"eState",
")",
"{",
"char",
"*",
"pcState",
"=",
"0",
";",
"unsigned",
"long",
"ulLoop",
";",
"for",
"(",
"ulLoop",
"=",
"0",
";",
"ulLoop",
"<",
"NUM_STATE_MAP_ENTRIES",
";",
"ulLoop",
"++",
")",
"{",
"if",
"(",
"g_psStateMap",
"[",
"ulLoop",
"]",
".",
"eState",
"==",
"eState",
")",
"{",
"pcState",
"=",
"g_psStateMap",
"[",
"ulLoop",
"]",
".",
"pcString",
";",
"break",
";",
"}",
"}",
"if",
"(",
"ulLoop",
"==",
"NUM_STATE_MAP_ENTRIES",
")",
"{",
"pcState",
"=",
"\"",
"\"",
";",
"}",
"return",
"(",
"pcState",
")",
";",
"}"
] | Map a data acquisition state to a human-readable string. | [
"Map",
"a",
"data",
"acquisition",
"state",
"to",
"a",
"human",
"-",
"readable",
"string",
"."
] | [
"//\r",
"// Get a description string for the state.\r",
"//\r",
"//\r",
"// Catch cases where we end up with an unknown trigger type.\r",
"//\r",
"//\r",
"// Pass the string pointer back to the caller.\r",
"//\r"
] | [
{
"param": "eState",
"type": "tDataAcqState"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "eState",
"type": "tDataAcqState",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CommandReadAndProcess | void | void
CommandReadAndProcess(void)
{
int iCount;
//
// Check to see if there is a string available in the UART receive
// buffer.
//
iCount = UARTPeek('\r');
//
// A negative return code indicates that there is no '\r' character in
// the receive buffer and, hence, no complete string entered by the user
// so just return.
//
if(iCount < 0)
{
return;
}
//
// Here, we know that a string is available so read it.
//
iCount = UARTgets(g_pcCmdLine, COMMAND_BUFFER_LEN);
//
// If something sensible was entered, go ahead and process the command
// line.
//
if(iCount)
{
//
// Process the command entered by the user
//
iCount = CmdLineProcess(g_pcCmdLine);
switch(iCount)
{
//
// The command was not recognized
//
case CMDLINE_BAD_CMD:
{
UARTprintf("ERROR: Unrecognized command\n");
break;
}
//
// The command contained too many arguments for the command
// line processor to handle.
//
case CMDLINE_TOO_MANY_ARGS:
{
UARTprintf("ERROR: Too many arguments\n");
break;
}
}
//
// Display a prompt
//
UARTprintf(">");
}
} | //*****************************************************************************
//
// Read a command line from the user and process it.
//
//*****************************************************************************
| Read a command line from the user and process it. | [
"Read",
"a",
"command",
"line",
"from",
"the",
"user",
"and",
"process",
"it",
"."
] | void
CommandReadAndProcess(void)
{
int iCount;
iCount = UARTPeek('\r');
if(iCount < 0)
{
return;
}
iCount = UARTgets(g_pcCmdLine, COMMAND_BUFFER_LEN);
if(iCount)
{
iCount = CmdLineProcess(g_pcCmdLine);
switch(iCount)
{
case CMDLINE_BAD_CMD:
{
UARTprintf("ERROR: Unrecognized command\n");
break;
}
case CMDLINE_TOO_MANY_ARGS:
{
UARTprintf("ERROR: Too many arguments\n");
break;
}
}
UARTprintf(">");
}
} | [
"void",
"CommandReadAndProcess",
"(",
"void",
")",
"{",
"int",
"iCount",
";",
"iCount",
"=",
"UARTPeek",
"(",
"'",
"\\r",
"'",
")",
";",
"if",
"(",
"iCount",
"<",
"0",
")",
"{",
"return",
";",
"}",
"iCount",
"=",
"UARTgets",
"(",
"g_pcCmdLine",
",",
"COMMAND_BUFFER_LEN",
")",
";",
"if",
"(",
"iCount",
")",
"{",
"iCount",
"=",
"CmdLineProcess",
"(",
"g_pcCmdLine",
")",
";",
"switch",
"(",
"iCount",
")",
"{",
"case",
"CMDLINE_BAD_CMD",
":",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"break",
";",
"}",
"case",
"CMDLINE_TOO_MANY_ARGS",
":",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"break",
";",
"}",
"}",
"UARTprintf",
"(",
"\"",
"\"",
")",
";",
"}",
"}"
] | Read a command line from the user and process it. | [
"Read",
"a",
"command",
"line",
"from",
"the",
"user",
"and",
"process",
"it",
"."
] | [
"//\r",
"// Check to see if there is a string available in the UART receive\r",
"// buffer.\r",
"//\r",
"//\r",
"// A negative return code indicates that there is no '\\r' character in\r",
"// the receive buffer and, hence, no complete string entered by the user\r",
"// so just return.\r",
"//\r",
"//\r",
"// Here, we know that a string is available so read it.\r",
"//\r",
"//\r",
"// If something sensible was entered, go ahead and process the command\r",
"// line.\r",
"//\r",
"//\r",
"// Process the command entered by the user\r",
"//\r",
"//\r",
"// The command was not recognized\r",
"//\r",
"//\r",
"// The command contained too many arguments for the command\r",
"// line processor to handle.\r",
"//\r",
"//\r",
"// Display a prompt\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdHelp | int | 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);
} | //*****************************************************************************
//
// \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
//
//*****************************************************************************
| \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 handler takes no parameters. argc and argv are ignored.
\return COMMAND_OK in all cases | [
"\\",
"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",
"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++;
if(!(iLoop % 5))
{
UARTFlushTx(false);
}
}
return(COMMAND_OK);
} | [
"int",
"CmdHelp",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"int",
"iLoop",
";",
"iLoop",
"=",
"0",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"while",
"(",
"g_sCmdTable",
"[",
"iLoop",
"]",
".",
"pcCmd",
"!=",
"(",
"const",
"char",
"*",
")",
"0",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"g_sCmdTable",
"[",
"iLoop",
"]",
".",
"pcCmd",
",",
"g_sCmdTable",
"[",
"iLoop",
"]",
".",
"pcHelp",
")",
";",
"iLoop",
"++",
";",
"if",
"(",
"!",
"(",
"iLoop",
"%",
"5",
")",
")",
"{",
"UARTFlushTx",
"(",
"false",
")",
";",
"}",
"}",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "help" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"help",
"\"",
"command",
"."
] | [
"//\r",
"// Every 5 lines, wait for the UART to catch up with us.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdVScale | int | int
CmdVScale(int argc, char *argv[])
{
unsigned long ulVoltage;
unsigned long ulChannel;
const char *pcPos;
//
// Make sure we were passed the command and exactly 2 extra arguments
//
if(argc < 3)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 3)
{
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Now extract numbers from the two command parameters.
//
ulVoltage = ustrtoul(argv[1], &pcPos, 0);
ulChannel = ustrtoul(argv[2], &pcPos, 0);
//
// Make sure we were passed a valid channel number
//
if(ulChannel < 2)
{
//
// Set the scaling for this channel. This will take effect the next
// time the display is updated.
//
UARTprintf("Setting scale for channel %d to %dmV/division.\n",
ulChannel, ulVoltage);
g_sRender.ulmVPerDivision[ulChannel] = ulVoltage;
return(COMMAND_OK);
}
else
{
//
// Illegal channel number
//
UARTprintf("Channel %d is invalid.\n", ulChannel);
return(COMMAND_INVALID_ARG);
}
} | //*****************************************************************************
// \internal
//
// Handler for the "scale" 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 "scale" command. It sets the voltage scale for one of the oscilloscope
// channels
//
// This handler takes two parameters. The first is the voltage scale expressed
// in millivolts per division and the second is the channel number, 0 or 1.
//
// \return Returns COMMAND_OK if all is well or other return codes on failure.
//
//*****************************************************************************
| \internal
Handler for the "scale" 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 "scale" command. It sets the voltage scale for one of the oscilloscope
channels
This handler takes two parameters. The first is the voltage scale expressed
in millivolts per division and the second is the channel number, 0 or 1.
\return Returns COMMAND_OK if all is well or other return codes on failure. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"scale",
"\"",
"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",
"\"",
"scale",
"\"",
"command",
".",
"It",
"sets",
"the",
"voltage",
"scale",
"for",
"one",
"of",
"the",
"oscilloscope",
"channels",
"This",
"handler",
"takes",
"two",
"parameters",
".",
"The",
"first",
"is",
"the",
"voltage",
"scale",
"expressed",
"in",
"millivolts",
"per",
"division",
"and",
"the",
"second",
"is",
"the",
"channel",
"number",
"0",
"or",
"1",
".",
"\\",
"return",
"Returns",
"COMMAND_OK",
"if",
"all",
"is",
"well",
"or",
"other",
"return",
"codes",
"on",
"failure",
"."
] | int
CmdVScale(int argc, char *argv[])
{
unsigned long ulVoltage;
unsigned long ulChannel;
const char *pcPos;
if(argc < 3)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 3)
{
return(CMDLINE_TOO_MANY_ARGS);
}
ulVoltage = ustrtoul(argv[1], &pcPos, 0);
ulChannel = ustrtoul(argv[2], &pcPos, 0);
if(ulChannel < 2)
{
UARTprintf("Setting scale for channel %d to %dmV/division.\n",
ulChannel, ulVoltage);
g_sRender.ulmVPerDivision[ulChannel] = ulVoltage;
return(COMMAND_OK);
}
else
{
UARTprintf("Channel %d is invalid.\n", ulChannel);
return(COMMAND_INVALID_ARG);
}
} | [
"int",
"CmdVScale",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"unsigned",
"long",
"ulVoltage",
";",
"unsigned",
"long",
"ulChannel",
";",
"const",
"char",
"*",
"pcPos",
";",
"if",
"(",
"argc",
"<",
"3",
")",
"{",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"3",
")",
"{",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"ulVoltage",
"=",
"ustrtoul",
"(",
"argv",
"[",
"1",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"ulChannel",
"=",
"ustrtoul",
"(",
"argv",
"[",
"2",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"if",
"(",
"ulChannel",
"<",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulChannel",
",",
"ulVoltage",
")",
";",
"g_sRender",
".",
"ulmVPerDivision",
"[",
"ulChannel",
"]",
"=",
"ulVoltage",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}",
"else",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulChannel",
")",
";",
"return",
"(",
"COMMAND_INVALID_ARG",
")",
";",
"}",
"}"
] | \internal
Handler for the "scale" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"scale",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 2 extra arguments\r",
"//\r",
"//\r",
"// Now extract numbers from the two command parameters.\r",
"//\r",
"//\r",
"// Make sure we were passed a valid channel number\r",
"//\r",
"//\r",
"// Set the scaling for this channel. This will take effect the next\r",
"// time the display is updated.\r",
"//\r",
"//\r",
"// Illegal channel number\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdVOffset | int | int
CmdVOffset(int argc, char *argv[])
{
long lVoltage;
unsigned long ulChannel;
const char *pcPos;
//
// Make sure we were passed the command and exactly 2 extra arguments
//
if(argc < 3)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 3)
{
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Now extract numbers from the two command parameters.
//
lVoltage = (long)ustrtoul(argv[1], &pcPos, 0);
ulChannel = ustrtoul(argv[2], &pcPos, 0);
//
// Make sure we were passed a valid channel number
//
if(ulChannel < 2)
{
//
// Set the scaling for this channel. This will take effect the next
// time the display is updated.
//
UARTprintf("Setting offset for channel %d to %dmV.\n",
ulChannel, lVoltage);
COMMAND_FLAG_WRITE((ulChannel == 0) ? SCOPE_CH1_POS : SCOPE_CH2_POS,
(unsigned long)lVoltage);
return(COMMAND_OK);
}
else
{
//
// Illegal channel number
//
UARTprintf("Channel %d is invalid.\n", ulChannel);
return(COMMAND_INVALID_ARG);
}
} | //*****************************************************************************
// \internal
//
// Handler for the "voff" 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 "voff" command. It sets the voltage offset for one of the oscilloscope
// channels
//
// This handler takes two parameters. The first is the voltage offset
// expressed in millivolts and the second is the channel number, 0 or 1.
// Positive offset values cause the waveform to move towards the top of
// the display and negative values move it towards the bottom.
//
// \return Returns COMMAND_OK if all is well or other return codes on failure.
//
//*****************************************************************************
| \internal
Handler for the "voff" 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 "voff" command. It sets the voltage offset for one of the oscilloscope
channels
This handler takes two parameters. The first is the voltage offset
expressed in millivolts and the second is the channel number, 0 or 1.
Positive offset values cause the waveform to move towards the top of
the display and negative values move it towards the bottom.
\return Returns COMMAND_OK if all is well or other return codes on failure. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"voff",
"\"",
"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",
"\"",
"voff",
"\"",
"command",
".",
"It",
"sets",
"the",
"voltage",
"offset",
"for",
"one",
"of",
"the",
"oscilloscope",
"channels",
"This",
"handler",
"takes",
"two",
"parameters",
".",
"The",
"first",
"is",
"the",
"voltage",
"offset",
"expressed",
"in",
"millivolts",
"and",
"the",
"second",
"is",
"the",
"channel",
"number",
"0",
"or",
"1",
".",
"Positive",
"offset",
"values",
"cause",
"the",
"waveform",
"to",
"move",
"towards",
"the",
"top",
"of",
"the",
"display",
"and",
"negative",
"values",
"move",
"it",
"towards",
"the",
"bottom",
".",
"\\",
"return",
"Returns",
"COMMAND_OK",
"if",
"all",
"is",
"well",
"or",
"other",
"return",
"codes",
"on",
"failure",
"."
] | int
CmdVOffset(int argc, char *argv[])
{
long lVoltage;
unsigned long ulChannel;
const char *pcPos;
if(argc < 3)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 3)
{
return(CMDLINE_TOO_MANY_ARGS);
}
lVoltage = (long)ustrtoul(argv[1], &pcPos, 0);
ulChannel = ustrtoul(argv[2], &pcPos, 0);
if(ulChannel < 2)
{
UARTprintf("Setting offset for channel %d to %dmV.\n",
ulChannel, lVoltage);
COMMAND_FLAG_WRITE((ulChannel == 0) ? SCOPE_CH1_POS : SCOPE_CH2_POS,
(unsigned long)lVoltage);
return(COMMAND_OK);
}
else
{
UARTprintf("Channel %d is invalid.\n", ulChannel);
return(COMMAND_INVALID_ARG);
}
} | [
"int",
"CmdVOffset",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"long",
"lVoltage",
";",
"unsigned",
"long",
"ulChannel",
";",
"const",
"char",
"*",
"pcPos",
";",
"if",
"(",
"argc",
"<",
"3",
")",
"{",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"3",
")",
"{",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"lVoltage",
"=",
"(",
"long",
")",
"ustrtoul",
"(",
"argv",
"[",
"1",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"ulChannel",
"=",
"ustrtoul",
"(",
"argv",
"[",
"2",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"if",
"(",
"ulChannel",
"<",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulChannel",
",",
"lVoltage",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"(",
"ulChannel",
"==",
"0",
")",
"?",
"SCOPE_CH1_POS",
":",
"SCOPE_CH2_POS",
",",
"(",
"unsigned",
"long",
")",
"lVoltage",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}",
"else",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulChannel",
")",
";",
"return",
"(",
"COMMAND_INVALID_ARG",
")",
";",
"}",
"}"
] | \internal
Handler for the "voff" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"voff",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 2 extra arguments\r",
"//\r",
"//\r",
"// Now extract numbers from the two command parameters.\r",
"//\r",
"//\r",
"// Make sure we were passed a valid channel number\r",
"//\r",
"//\r",
"// Set the scaling for this channel. This will take effect the next\r",
"// time the display is updated.\r",
"//\r",
"//\r",
"// Illegal channel number\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdStop | int | int
CmdStop(int argc, char *argv[])
{
//
// Stop continuous capture.
//
UARTprintf("Stopping continuous capture.\n");
COMMAND_FLAG_WRITE(SCOPE_STOP, 0);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "stop" 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 "stop" command. It sets a flag to tell the main loop to stop capturing
// oscilloscope samples continuously.
//
// This handler takes no parameters. argc and argv are ignored.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "stop" 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 "stop" command. It sets a flag to tell the main loop to stop capturing
oscilloscope samples continuously.
This handler takes no parameters. argc and argv are ignored.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"stop",
"\"",
"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",
"\"",
"stop",
"\"",
"command",
".",
"It",
"sets",
"a",
"flag",
"to",
"tell",
"the",
"main",
"loop",
"to",
"stop",
"capturing",
"oscilloscope",
"samples",
"continuously",
".",
"This",
"handler",
"takes",
"no",
"parameters",
".",
"argc",
"and",
"argv",
"are",
"ignored",
"."
] | int
CmdStop(int argc, char *argv[])
{
UARTprintf("Stopping continuous capture.\n");
COMMAND_FLAG_WRITE(SCOPE_STOP, 0);
return(COMMAND_OK);
} | [
"int",
"CmdStop",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_STOP",
",",
"0",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "stop" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"stop",
"\"",
"command",
"."
] | [
"//\r",
"// Stop continuous capture.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdStart | int | int
CmdStart(int argc, char *argv[])
{
//
// Start continuous capture.
//
UARTprintf("Starting continuous capture.\n");
COMMAND_FLAG_WRITE(SCOPE_START, 0);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "start" 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 "start" command. It sets a flag to tell the main loop to start
// capturing oscilloscope samples continuously.
//
// This handler takes no parameters. argc and argv are ignored.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "start" 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 "start" command. It sets a flag to tell the main loop to start
capturing oscilloscope samples continuously.
This handler takes no parameters. argc and argv are ignored.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"start",
"\"",
"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",
"\"",
"start",
"\"",
"command",
".",
"It",
"sets",
"a",
"flag",
"to",
"tell",
"the",
"main",
"loop",
"to",
"start",
"capturing",
"oscilloscope",
"samples",
"continuously",
".",
"This",
"handler",
"takes",
"no",
"parameters",
".",
"argc",
"and",
"argv",
"are",
"ignored",
"."
] | int
CmdStart(int argc, char *argv[])
{
UARTprintf("Starting continuous capture.\n");
COMMAND_FLAG_WRITE(SCOPE_START, 0);
return(COMMAND_OK);
} | [
"int",
"CmdStart",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_START",
",",
"0",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "start" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"start",
"\"",
"command",
"."
] | [
"//\r",
"// Start continuous capture.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdToggleCh2 | int | int
CmdToggleCh2(int argc, char *argv[])
{
unsigned long ulOnOff;
const char *pcPos;
//
// Make sure we were passed the command and exactly 1 extra arguments
//
if(argc < 2)
{
UARTprintf("This command requires 1 argument.\n");
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
UARTprintf("This command requires 1 argument.\n");
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Now extract the on/off flag.
//
ulOnOff = ustrtoul(argv[1], &pcPos, 0);
//
// Stop continuous capture.
//
UARTprintf("$abling channel 2.\n", ulOnOff ? "En" : "Dis");
//
// Tell the main loop to enable or disable channel 2.
//
COMMAND_FLAG_WRITE(SCOPE_CH2_DISPLAY, ulOnOff);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "ch2" 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 "ch2" command. It sets a flag to tell the main loop to enabled or
// disable channel 2.
//
// This handler takes a single parameter, 0 to turn channel 2 off and 1 to
// turn it on.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "ch2" 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 "ch2" command. It sets a flag to tell the main loop to enabled or
disable channel 2.
This handler takes a single parameter, 0 to turn channel 2 off and 1 to
turn it on.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"ch2",
"\"",
"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",
"\"",
"ch2",
"\"",
"command",
".",
"It",
"sets",
"a",
"flag",
"to",
"tell",
"the",
"main",
"loop",
"to",
"enabled",
"or",
"disable",
"channel",
"2",
".",
"This",
"handler",
"takes",
"a",
"single",
"parameter",
"0",
"to",
"turn",
"channel",
"2",
"off",
"and",
"1",
"to",
"turn",
"it",
"on",
"."
] | int
CmdToggleCh2(int argc, char *argv[])
{
unsigned long ulOnOff;
const char *pcPos;
if(argc < 2)
{
UARTprintf("This command requires 1 argument.\n");
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
UARTprintf("This command requires 1 argument.\n");
return(CMDLINE_TOO_MANY_ARGS);
}
ulOnOff = ustrtoul(argv[1], &pcPos, 0);
UARTprintf("$abling channel 2.\n", ulOnOff ? "En" : "Dis");
COMMAND_FLAG_WRITE(SCOPE_CH2_DISPLAY, ulOnOff);
return(COMMAND_OK);
} | [
"int",
"CmdToggleCh2",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"unsigned",
"long",
"ulOnOff",
";",
"const",
"char",
"*",
"pcPos",
";",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"ulOnOff",
"=",
"ustrtoul",
"(",
"argv",
"[",
"1",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulOnOff",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_CH2_DISPLAY",
",",
"ulOnOff",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "ch2" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"ch2",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 1 extra arguments\r",
"//\r",
"//\r",
"// Now extract the on/off flag.\r",
"//\r",
"//\r",
"// Stop continuous capture.\r",
"//\r",
"//\r",
"// Tell the main loop to enable or disable channel 2.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdSaveCSV | int | int
CmdSaveCSV(int argc, char *argv[])
{
//
// Ensure we were passed the correct number of arguments
//
if(argc < 2)
{
UARTprintf("This command requires 1 argument.\n");
return(COMMAND_TOO_FEW_ARGS);
}
//
// Tell the main loop to save the data in CSV format to the appropriate
// drive.
//
COMMAND_FLAG_WRITE(SCOPE_SAVE, ((argv[1][0] == '0') ?
SCOPE_SAVE_CSV | SCOPE_SAVE_SD :
SCOPE_SAVE_CSV | SCOPE_SAVE_USB));
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "savecsv" 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 "savecsv" command. It sends a command to the main loop to save the
// latest captured data in CSV format to either the SD card or USB stick,
// depending upon which is connected.
//
// This handler takes a single parameter, 0 to save to the SD card or anything
// else to save to a USB flash stick.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "savecsv" 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 "savecsv" command. It sends a command to the main loop to save the
latest captured data in CSV format to either the SD card or USB stick,
depending upon which is connected.
This handler takes a single parameter, 0 to save to the SD card or anything
else to save to a USB flash stick.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"savecsv",
"\"",
"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",
"\"",
"savecsv",
"\"",
"command",
".",
"It",
"sends",
"a",
"command",
"to",
"the",
"main",
"loop",
"to",
"save",
"the",
"latest",
"captured",
"data",
"in",
"CSV",
"format",
"to",
"either",
"the",
"SD",
"card",
"or",
"USB",
"stick",
"depending",
"upon",
"which",
"is",
"connected",
".",
"This",
"handler",
"takes",
"a",
"single",
"parameter",
"0",
"to",
"save",
"to",
"the",
"SD",
"card",
"or",
"anything",
"else",
"to",
"save",
"to",
"a",
"USB",
"flash",
"stick",
"."
] | int
CmdSaveCSV(int argc, char *argv[])
{
if(argc < 2)
{
UARTprintf("This command requires 1 argument.\n");
return(COMMAND_TOO_FEW_ARGS);
}
COMMAND_FLAG_WRITE(SCOPE_SAVE, ((argv[1][0] == '0') ?
SCOPE_SAVE_CSV | SCOPE_SAVE_SD :
SCOPE_SAVE_CSV | SCOPE_SAVE_USB));
return(COMMAND_OK);
} | [
"int",
"CmdSaveCSV",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_SAVE",
",",
"(",
"(",
"argv",
"[",
"1",
"]",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"?",
"SCOPE_SAVE_CSV",
"|",
"SCOPE_SAVE_SD",
":",
"SCOPE_SAVE_CSV",
"|",
"SCOPE_SAVE_USB",
")",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "savecsv" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"savecsv",
"\"",
"command",
"."
] | [
"//\r",
"// Ensure we were passed the correct number of arguments\r",
"//\r",
"//\r",
"// Tell the main loop to save the data in CSV format to the appropriate\r",
"// drive.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdSaveBMP | int | int
CmdSaveBMP(int argc, char *argv[])
{
//
// Tell the main loop to save the data in BMP format
//
COMMAND_FLAG_WRITE(SCOPE_SAVE, ((argv[1][0] == '0') ?
SCOPE_SAVE_BMP | SCOPE_SAVE_SD :
SCOPE_SAVE_BMP | SCOPE_SAVE_USB));
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "savebmp" 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 "savebmp" command. It sends a command to the main loop to save the
// latest captured data in Windows bitmap format to either the SD card or USB
// stick, depending upon which is connected.
//
// This handler takes a single parameter, 0 to save to the SD card or anything
// else to save to a USB flash stick.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "savebmp" 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 "savebmp" command. It sends a command to the main loop to save the
latest captured data in Windows bitmap format to either the SD card or USB
stick, depending upon which is connected.
This handler takes a single parameter, 0 to save to the SD card or anything
else to save to a USB flash stick.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"savebmp",
"\"",
"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",
"\"",
"savebmp",
"\"",
"command",
".",
"It",
"sends",
"a",
"command",
"to",
"the",
"main",
"loop",
"to",
"save",
"the",
"latest",
"captured",
"data",
"in",
"Windows",
"bitmap",
"format",
"to",
"either",
"the",
"SD",
"card",
"or",
"USB",
"stick",
"depending",
"upon",
"which",
"is",
"connected",
".",
"This",
"handler",
"takes",
"a",
"single",
"parameter",
"0",
"to",
"save",
"to",
"the",
"SD",
"card",
"or",
"anything",
"else",
"to",
"save",
"to",
"a",
"USB",
"flash",
"stick",
"."
] | int
CmdSaveBMP(int argc, char *argv[])
{
COMMAND_FLAG_WRITE(SCOPE_SAVE, ((argv[1][0] == '0') ?
SCOPE_SAVE_BMP | SCOPE_SAVE_SD :
SCOPE_SAVE_BMP | SCOPE_SAVE_USB));
return(COMMAND_OK);
} | [
"int",
"CmdSaveBMP",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_SAVE",
",",
"(",
"(",
"argv",
"[",
"1",
"]",
"[",
"0",
"]",
"==",
"'",
"'",
")",
"?",
"SCOPE_SAVE_BMP",
"|",
"SCOPE_SAVE_SD",
":",
"SCOPE_SAVE_BMP",
"|",
"SCOPE_SAVE_USB",
")",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "savebmp" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"savebmp",
"\"",
"command",
"."
] | [
"//\r",
"// Tell the main loop to save the data in BMP format\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdCat | int | int
CmdCat(int argc, char *argv[])
{
//
// Make sure we were passed the command and exactly 1 extra arguments
//
if(argc < 2)
{
UARTprintf("This command requires 1 argument.\n");
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
UARTprintf("This command requires 1 argument.\n");
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Tell the file module to cat the requested file.
//
FileCatToUART(argv[1]);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "cat" 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 "cat" command. It opens the file whose base filename is passed in
// the first argument and echoes the file contents to UART0.
//
// This handler takes a single parameter, the filename of the file to
// dump. This will typically be "scopexxx.csv" where "xxx" is a 3 digit
// decimal number.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "cat" 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 "cat" command. It opens the file whose base filename is passed in
the first argument and echoes the file contents to UART0.
This handler takes a single parameter, the filename of the file to
dump. This will typically be "scopexxx.csv" where "xxx" is a 3 digit
decimal number.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"cat",
"\"",
"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",
"\"",
"cat",
"\"",
"command",
".",
"It",
"opens",
"the",
"file",
"whose",
"base",
"filename",
"is",
"passed",
"in",
"the",
"first",
"argument",
"and",
"echoes",
"the",
"file",
"contents",
"to",
"UART0",
".",
"This",
"handler",
"takes",
"a",
"single",
"parameter",
"the",
"filename",
"of",
"the",
"file",
"to",
"dump",
".",
"This",
"will",
"typically",
"be",
"\"",
"scopexxx",
".",
"csv",
"\"",
"where",
"\"",
"xxx",
"\"",
"is",
"a",
"3",
"digit",
"decimal",
"number",
"."
] | int
CmdCat(int argc, char *argv[])
{
if(argc < 2)
{
UARTprintf("This command requires 1 argument.\n");
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
UARTprintf("This command requires 1 argument.\n");
return(CMDLINE_TOO_MANY_ARGS);
}
FileCatToUART(argv[1]);
return(COMMAND_OK);
} | [
"int",
"CmdCat",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"FileCatToUART",
"(",
"argv",
"[",
"1",
"]",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "cat" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"cat",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 1 extra arguments\r",
"//\r",
"//\r",
"// Tell the file module to cat the requested file.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdLs | int | int
CmdLs(int argc, char *argv[])
{
//
// Tell the file module to show the directory listing.
//
if(argc == 1)
{
FileLsToUART("/");
}
else
{
FileLsToUART(argv[1]);
}
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "ls" 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 "ls" command. It calls the file module to have it dump a list of the
// files in the current directory of the SD card or flash stick depending
// upon which is installed.
//
// This handler takes one optional parameter. If no parameters are specified,
// the root directory of logical drive 0 (the SD card) is listed. If a single
// parameter is given, it is assumed to be a directory name and is passed to
// FileLsToUART() as the directory to be listed. To list a particular logical
// drive, use the format "n:/" where 'n' is the drive number, 0 or 1.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "ls" 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 "ls" command. It calls the file module to have it dump a list of the
files in the current directory of the SD card or flash stick depending
upon which is installed.
This handler takes one optional parameter. If no parameters are specified,
the root directory of logical drive 0 (the SD card) is listed. If a single
parameter is given, it is assumed to be a directory name and is passed to
FileLsToUART() as the directory to be listed. To list a particular logical
drive, use the format "n:/" where 'n' is the drive number, 0 or 1.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"ls",
"\"",
"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",
"\"",
"ls",
"\"",
"command",
".",
"It",
"calls",
"the",
"file",
"module",
"to",
"have",
"it",
"dump",
"a",
"list",
"of",
"the",
"files",
"in",
"the",
"current",
"directory",
"of",
"the",
"SD",
"card",
"or",
"flash",
"stick",
"depending",
"upon",
"which",
"is",
"installed",
".",
"This",
"handler",
"takes",
"one",
"optional",
"parameter",
".",
"If",
"no",
"parameters",
"are",
"specified",
"the",
"root",
"directory",
"of",
"logical",
"drive",
"0",
"(",
"the",
"SD",
"card",
")",
"is",
"listed",
".",
"If",
"a",
"single",
"parameter",
"is",
"given",
"it",
"is",
"assumed",
"to",
"be",
"a",
"directory",
"name",
"and",
"is",
"passed",
"to",
"FileLsToUART",
"()",
"as",
"the",
"directory",
"to",
"be",
"listed",
".",
"To",
"list",
"a",
"particular",
"logical",
"drive",
"use",
"the",
"format",
"\"",
"n",
":",
"/",
"\"",
"where",
"'",
"n",
"'",
"is",
"the",
"drive",
"number",
"0",
"or",
"1",
"."
] | int
CmdLs(int argc, char *argv[])
{
if(argc == 1)
{
FileLsToUART("/");
}
else
{
FileLsToUART(argv[1]);
}
return(COMMAND_OK);
} | [
"int",
"CmdLs",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"if",
"(",
"argc",
"==",
"1",
")",
"{",
"FileLsToUART",
"(",
"\"",
"\"",
")",
";",
"}",
"else",
"{",
"FileLsToUART",
"(",
"argv",
"[",
"1",
"]",
")",
";",
"}",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "ls" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"ls",
"\"",
"command",
"."
] | [
"//\r",
"// Tell the file module to show the directory listing.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdQuit | int | int
CmdQuit(int argc, char *argv[])
{
//
// Exit the application.
//
UARTprintf("Bye!\n");
while(1)
{
}
} | //*****************************************************************************
// \internal
//
// Handler for the "quit" 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 "quit" or "q" commands. It prints a cheerful message then exits the
// application.
//
// This handler takes no parameters. argc and argv are ignored.
//
// \return Does not return.
//
//*****************************************************************************
| \internal
Handler for the "quit" 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 "quit" or "q" commands. It prints a cheerful message then exits the
application.
This handler takes no parameters. argc and argv are ignored.
\return Does not return. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"quit",
"\"",
"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",
"\"",
"quit",
"\"",
"or",
"\"",
"q",
"\"",
"commands",
".",
"It",
"prints",
"a",
"cheerful",
"message",
"then",
"exits",
"the",
"application",
".",
"This",
"handler",
"takes",
"no",
"parameters",
".",
"argc",
"and",
"argv",
"are",
"ignored",
".",
"\\",
"return",
"Does",
"not",
"return",
"."
] | int
CmdQuit(int argc, char *argv[])
{
UARTprintf("Bye!\n");
while(1)
{
}
} | [
"int",
"CmdQuit",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"while",
"(",
"1",
")",
"{",
"}",
"}"
] | \internal
Handler for the "quit" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"quit",
"\"",
"command",
"."
] | [
"//\r",
"// Exit the application.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdTimebase | int | int
CmdTimebase(int argc, char *argv[])
{
unsigned long ulTimebase;
const char *pcPos;
//
// Make sure we were passed the command and exactly 1 extra argument
//
if(argc < 2)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Now extract a number from the first command parameter.
//
ulTimebase = ustrtoul(argv[1], &pcPos, 0);
//
// Tell the main loop to update the timebase on the next iteration.
//
COMMAND_FLAG_WRITE(SCOPE_CHANGE_TIMEBASE, ulTimebase);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "time" 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 "time" command. It expects a single parameter which will be a
// string containing a decimal number representing the number of microseconds
// per division on the waveform display.
//
// \return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
// COMMAND_INVALID_ARG on failure.
//
//*****************************************************************************
| \internal
Handler for the "time" 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 "time" command. It expects a single parameter which will be a
string containing a decimal number representing the number of microseconds
per division on the waveform display.
\return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
COMMAND_INVALID_ARG on failure. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"time",
"\"",
"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",
"\"",
"time",
"\"",
"command",
".",
"It",
"expects",
"a",
"single",
"parameter",
"which",
"will",
"be",
"a",
"string",
"containing",
"a",
"decimal",
"number",
"representing",
"the",
"number",
"of",
"microseconds",
"per",
"division",
"on",
"the",
"waveform",
"display",
".",
"\\",
"return",
"Returns",
"COMMAND_OK",
"on",
"success",
"or",
"COMMAND_TOO_FEW_ARGS",
"or",
"COMMAND_INVALID_ARG",
"on",
"failure",
"."
] | int
CmdTimebase(int argc, char *argv[])
{
unsigned long ulTimebase;
const char *pcPos;
if(argc < 2)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
return(CMDLINE_TOO_MANY_ARGS);
}
ulTimebase = ustrtoul(argv[1], &pcPos, 0);
COMMAND_FLAG_WRITE(SCOPE_CHANGE_TIMEBASE, ulTimebase);
return(COMMAND_OK);
} | [
"int",
"CmdTimebase",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"unsigned",
"long",
"ulTimebase",
";",
"const",
"char",
"*",
"pcPos",
";",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"2",
")",
"{",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"ulTimebase",
"=",
"ustrtoul",
"(",
"argv",
"[",
"1",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_CHANGE_TIMEBASE",
",",
"ulTimebase",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "time" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"time",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 1 extra argument\r",
"//\r",
"//\r",
"// Now extract a number from the first command parameter.\r",
"//\r",
"//\r",
"// Tell the main loop to update the timebase on the next iteration.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdHOffset | int | int
CmdHOffset(int argc, char *argv[])
{
long lPos;
const char *pcPos;
//
// Make sure we were passed the command and exactly 1 extra argument
//
if(argc < 2)
{
UARTprintf("Command requires 1 parameter\n");
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
UARTprintf("Command requires 1 parameter\n");
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Now extract a number from the first command parameter.
//
lPos = (long)ustrtoul(argv[1], &pcPos, 0);
//
// Pass the new position to the main command processor.
//
COMMAND_FLAG_WRITE(SCOPE_TRIGGER_POS, (unsigned long)lPos);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "hoff" 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 "hoff" command. It expects a single parameter which will be a
// string containing a decimal number representing the number of pixels to
// offset the waveform display in the X direction. Positive numbers move
// the trigger position to the right.
//
// \return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
// COMMAND_INVALID_ARG on failure.
//
//*****************************************************************************
| \internal
Handler for the "hoff" 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 "hoff" command. It expects a single parameter which will be a
string containing a decimal number representing the number of pixels to
offset the waveform display in the X direction. Positive numbers move
the trigger position to the right.
\return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
COMMAND_INVALID_ARG on failure. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"hoff",
"\"",
"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",
"\"",
"hoff",
"\"",
"command",
".",
"It",
"expects",
"a",
"single",
"parameter",
"which",
"will",
"be",
"a",
"string",
"containing",
"a",
"decimal",
"number",
"representing",
"the",
"number",
"of",
"pixels",
"to",
"offset",
"the",
"waveform",
"display",
"in",
"the",
"X",
"direction",
".",
"Positive",
"numbers",
"move",
"the",
"trigger",
"position",
"to",
"the",
"right",
".",
"\\",
"return",
"Returns",
"COMMAND_OK",
"on",
"success",
"or",
"COMMAND_TOO_FEW_ARGS",
"or",
"COMMAND_INVALID_ARG",
"on",
"failure",
"."
] | int
CmdHOffset(int argc, char *argv[])
{
long lPos;
const char *pcPos;
if(argc < 2)
{
UARTprintf("Command requires 1 parameter\n");
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
UARTprintf("Command requires 1 parameter\n");
return(CMDLINE_TOO_MANY_ARGS);
}
lPos = (long)ustrtoul(argv[1], &pcPos, 0);
COMMAND_FLAG_WRITE(SCOPE_TRIGGER_POS, (unsigned long)lPos);
return(COMMAND_OK);
} | [
"int",
"CmdHOffset",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"long",
"lPos",
";",
"const",
"char",
"*",
"pcPos",
";",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"2",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"lPos",
"=",
"(",
"long",
")",
"ustrtoul",
"(",
"argv",
"[",
"1",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_TRIGGER_POS",
",",
"(",
"unsigned",
"long",
")",
"lPos",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "hoff" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"hoff",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 1 extra argument\r",
"//\r",
"//\r",
"// Now extract a number from the first command parameter.\r",
"//\r",
"//\r",
"// Pass the new position to the main command processor.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdTrigger | int | int
CmdTrigger(int argc, char *argv[])
{
tTriggerType eType;
unsigned long ulTrigPos;
unsigned short usLevel;
unsigned long ulLoop;
//
// Make sure we were passed the command and exactly 1 extra argument
//
if(argc < 2)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Get the existing trigger parameters.
//
DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel);
//
// Determine the new trigger type from the parameter passed.
//
for(ulLoop = 0; ulLoop < NUM_TRIGGER_MAP_ENTRIES; ulLoop++)
{
if(strcmp(argv[1], g_psTriggerMap[ulLoop].pcString) == 0)
{
eType = g_psTriggerMap[ulLoop].eTrigger;
break;
}
}
//
// Did we find a match?
//
if(ulLoop == NUM_TRIGGER_MAP_ENTRIES)
{
UARTprintf("Trigger type %s is not recognized.\n", argv[1]);
return(COMMAND_INVALID_ARG);
}
//
// All is well, so set the new trigger type and signal the main loop to
// process the trigger change.
//
COMMAND_FLAG_WRITE(SCOPE_CHANGE_TRIGGER, eType);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "trigger" 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 "trigger" or "t" commands. It expects a single parameter which will be
// a string containing RISE, FALL, ALWAYS or LEVEL to indicate the desired
// trigger mode.
//
// \return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
// COMMAND_INVALID_ARG on failure.
//
//*****************************************************************************
| \internal
Handler for the "trigger" 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 "trigger" or "t" commands. It expects a single parameter which will be
a string containing RISE, FALL, ALWAYS or LEVEL to indicate the desired
trigger mode.
\return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
COMMAND_INVALID_ARG on failure. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"trigger",
"\"",
"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",
"\"",
"trigger",
"\"",
"or",
"\"",
"t",
"\"",
"commands",
".",
"It",
"expects",
"a",
"single",
"parameter",
"which",
"will",
"be",
"a",
"string",
"containing",
"RISE",
"FALL",
"ALWAYS",
"or",
"LEVEL",
"to",
"indicate",
"the",
"desired",
"trigger",
"mode",
".",
"\\",
"return",
"Returns",
"COMMAND_OK",
"on",
"success",
"or",
"COMMAND_TOO_FEW_ARGS",
"or",
"COMMAND_INVALID_ARG",
"on",
"failure",
"."
] | int
CmdTrigger(int argc, char *argv[])
{
tTriggerType eType;
unsigned long ulTrigPos;
unsigned short usLevel;
unsigned long ulLoop;
if(argc < 2)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
return(CMDLINE_TOO_MANY_ARGS);
}
DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel);
for(ulLoop = 0; ulLoop < NUM_TRIGGER_MAP_ENTRIES; ulLoop++)
{
if(strcmp(argv[1], g_psTriggerMap[ulLoop].pcString) == 0)
{
eType = g_psTriggerMap[ulLoop].eTrigger;
break;
}
}
if(ulLoop == NUM_TRIGGER_MAP_ENTRIES)
{
UARTprintf("Trigger type %s is not recognized.\n", argv[1]);
return(COMMAND_INVALID_ARG);
}
COMMAND_FLAG_WRITE(SCOPE_CHANGE_TRIGGER, eType);
return(COMMAND_OK);
} | [
"int",
"CmdTrigger",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"tTriggerType",
"eType",
";",
"unsigned",
"long",
"ulTrigPos",
";",
"unsigned",
"short",
"usLevel",
";",
"unsigned",
"long",
"ulLoop",
";",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"2",
")",
"{",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"DataAcquisitionGetTrigger",
"(",
"&",
"eType",
",",
"&",
"ulTrigPos",
",",
"&",
"usLevel",
")",
";",
"for",
"(",
"ulLoop",
"=",
"0",
";",
"ulLoop",
"<",
"NUM_TRIGGER_MAP_ENTRIES",
";",
"ulLoop",
"++",
")",
"{",
"if",
"(",
"strcmp",
"(",
"argv",
"[",
"1",
"]",
",",
"g_psTriggerMap",
"[",
"ulLoop",
"]",
".",
"pcString",
")",
"==",
"0",
")",
"{",
"eType",
"=",
"g_psTriggerMap",
"[",
"ulLoop",
"]",
".",
"eTrigger",
";",
"break",
";",
"}",
"}",
"if",
"(",
"ulLoop",
"==",
"NUM_TRIGGER_MAP_ENTRIES",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"argv",
"[",
"1",
"]",
")",
";",
"return",
"(",
"COMMAND_INVALID_ARG",
")",
";",
"}",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_CHANGE_TRIGGER",
",",
"eType",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "trigger" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"trigger",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 1 extra argument\r",
"//\r",
"//\r",
"// Get the existing trigger parameters.\r",
"//\r",
"//\r",
"// Determine the new trigger type from the parameter passed.\r",
"//\r",
"//\r",
"// Did we find a match?\r",
"//\r",
"//\r",
"// All is well, so set the new trigger type and signal the main loop to\r",
"// process the trigger change.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdLevel | int | int
CmdLevel(int argc, char *argv[])
{
const char *pcPos;
unsigned long ulLevel;
//
// Make sure we were passed the command and exactly 1 extra argument
//
if(argc < 2)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
return(CMDLINE_TOO_MANY_ARGS);
}
//
// Extract a number from the first command parameter.
//
ulLevel = ustrtoul(argv[1], &pcPos, 0);
//
// Pass the command to the main handler for action.
//
COMMAND_FLAG_WRITE(SCOPE_TRIGGER_LEVEL, ulLevel);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "level" 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 "level" or "l" commands. It expects a single parameter which will be a
// string containing a decimal number representing the ADC sample level at
// which to trigger capture.
//
// \return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
// COMMAND_INVALID_ARG on failure.
//
//*****************************************************************************
| \internal
Handler for the "level" 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 "level" or "l" commands. It expects a single parameter which will be a
string containing a decimal number representing the ADC sample level at
which to trigger capture.
\return Returns COMMAND_OK on success or COMMAND_TOO_FEW_ARGS or
COMMAND_INVALID_ARG on failure. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"level",
"\"",
"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",
"\"",
"level",
"\"",
"or",
"\"",
"l",
"\"",
"commands",
".",
"It",
"expects",
"a",
"single",
"parameter",
"which",
"will",
"be",
"a",
"string",
"containing",
"a",
"decimal",
"number",
"representing",
"the",
"ADC",
"sample",
"level",
"at",
"which",
"to",
"trigger",
"capture",
".",
"\\",
"return",
"Returns",
"COMMAND_OK",
"on",
"success",
"or",
"COMMAND_TOO_FEW_ARGS",
"or",
"COMMAND_INVALID_ARG",
"on",
"failure",
"."
] | int
CmdLevel(int argc, char *argv[])
{
const char *pcPos;
unsigned long ulLevel;
if(argc < 2)
{
return(COMMAND_TOO_FEW_ARGS);
}
if(argc > 2)
{
return(CMDLINE_TOO_MANY_ARGS);
}
ulLevel = ustrtoul(argv[1], &pcPos, 0);
COMMAND_FLAG_WRITE(SCOPE_TRIGGER_LEVEL, ulLevel);
return(COMMAND_OK);
} | [
"int",
"CmdLevel",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"const",
"char",
"*",
"pcPos",
";",
"unsigned",
"long",
"ulLevel",
";",
"if",
"(",
"argc",
"<",
"2",
")",
"{",
"return",
"(",
"COMMAND_TOO_FEW_ARGS",
")",
";",
"}",
"if",
"(",
"argc",
">",
"2",
")",
"{",
"return",
"(",
"CMDLINE_TOO_MANY_ARGS",
")",
";",
"}",
"ulLevel",
"=",
"ustrtoul",
"(",
"argv",
"[",
"1",
"]",
",",
"&",
"pcPos",
",",
"0",
")",
";",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_TRIGGER_LEVEL",
",",
"ulLevel",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "level" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"level",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we were passed the command and exactly 1 extra argument\r",
"//\r",
"//\r",
"// Extract a number from the first command parameter.\r",
"//\r",
"//\r",
"// Pass the command to the main handler for action.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdCapture | int | int
CmdCapture(int argc, char *argv[])
{
//
// Make sure we are not currently capturing data.
//
if(!DataAcquisitionIsComplete())
{
UARTprintf("Capture pending.\n");
return(COMMAND_OK);
}
//
// Tell the main loop to initiate a single trigger capture.
//
COMMAND_FLAG_WRITE(SCOPE_CAPTURE, 0);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "capture" 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 "capture" or "c" commands. The handler expects no parameters.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "capture" 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 "capture" or "c" commands. The handler expects no parameters.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"capture",
"\"",
"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",
"\"",
"capture",
"\"",
"or",
"\"",
"c",
"\"",
"commands",
".",
"The",
"handler",
"expects",
"no",
"parameters",
"."
] | int
CmdCapture(int argc, char *argv[])
{
if(!DataAcquisitionIsComplete())
{
UARTprintf("Capture pending.\n");
return(COMMAND_OK);
}
COMMAND_FLAG_WRITE(SCOPE_CAPTURE, 0);
return(COMMAND_OK);
} | [
"int",
"CmdCapture",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"if",
"(",
"!",
"DataAcquisitionIsComplete",
"(",
")",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}",
"COMMAND_FLAG_WRITE",
"(",
"SCOPE_CAPTURE",
",",
"0",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "capture" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"capture",
"\"",
"command",
"."
] | [
"//\r",
"// Make sure we are not currently capturing data.\r",
"//\r",
"//\r",
"// Tell the main loop to initiate a single trigger capture.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdDump | int | 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);
} | //*****************************************************************************
// \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.
//
//*****************************************************************************
| \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.
| [
"\\",
"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",
"."
] | int
CmdDump(int argc, char *argv[])
{
unsigned long ulLoop;
tBoolean bRetcode;
tDataAcqCaptureStatus sStatus;
unsigned long ulSample;
unsigned long ulInc;
bRetcode = DataAcquisitionGetStatus(&sStatus);
ERROR_CHECK(bRetcode, "ERROR! Can't request status!\n");
ulInc = sStatus.bDualMode ? 2 : 1;
ulSample = sStatus.ulStartIndex;
for(ulLoop = 0; ulLoop < sStatus.ulSamplesCaptured; ulLoop+=ulInc)
{
if((ulLoop % 32) == 0)
{
UARTFlushTx(false);
}
if(!sStatus.bDualMode)
{
UARTprintf("%d, %d\n", ulSample,
sStatus.pusBuffer[ulSample]);
ulSample++;
if(ulSample == MAX_SAMPLES_PER_TRIGGER)
{
ulSample = 0;
}
}
else
{
UARTprintf("%d, %d, %d\n", ulSample,
sStatus.pusBuffer[ulSample],
sStatus.pusBuffer[ulSample+1]);
ulSample += 2;
if(ulSample >= MAX_SAMPLES_PER_TRIGGER)
{
ulSample = 0;
}
}
}
return(COMMAND_OK);
} | [
"int",
"CmdDump",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"unsigned",
"long",
"ulLoop",
";",
"tBoolean",
"bRetcode",
";",
"tDataAcqCaptureStatus",
"sStatus",
";",
"unsigned",
"long",
"ulSample",
";",
"unsigned",
"long",
"ulInc",
";",
"bRetcode",
"=",
"DataAcquisitionGetStatus",
"(",
"&",
"sStatus",
")",
";",
"ERROR_CHECK",
"(",
"bRetcode",
",",
"\"",
"\\n",
"\"",
")",
";",
"ulInc",
"=",
"sStatus",
".",
"bDualMode",
"?",
"2",
":",
"1",
";",
"ulSample",
"=",
"sStatus",
".",
"ulStartIndex",
";",
"for",
"(",
"ulLoop",
"=",
"0",
";",
"ulLoop",
"<",
"sStatus",
".",
"ulSamplesCaptured",
";",
"ulLoop",
"+=",
"ulInc",
")",
"{",
"if",
"(",
"(",
"ulLoop",
"%",
"32",
")",
"==",
"0",
")",
"{",
"UARTFlushTx",
"(",
"false",
")",
";",
"}",
"if",
"(",
"!",
"sStatus",
".",
"bDualMode",
")",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulSample",
",",
"sStatus",
".",
"pusBuffer",
"[",
"ulSample",
"]",
")",
";",
"ulSample",
"++",
";",
"if",
"(",
"ulSample",
"==",
"MAX_SAMPLES_PER_TRIGGER",
")",
"{",
"ulSample",
"=",
"0",
";",
"}",
"}",
"else",
"{",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulSample",
",",
"sStatus",
".",
"pusBuffer",
"[",
"ulSample",
"]",
",",
"sStatus",
".",
"pusBuffer",
"[",
"ulSample",
"+",
"1",
"]",
")",
";",
"ulSample",
"+=",
"2",
";",
"if",
"(",
"ulSample",
">=",
"MAX_SAMPLES_PER_TRIGGER",
")",
"{",
"ulSample",
"=",
"0",
";",
"}",
"}",
"}",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "dump" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"dump",
"\"",
"command",
"."
] | [
"//\r",
"// Query the capture status.\r",
"//\r",
"//\r",
"// In dual mode, we will handle 2 samples per loop.\r",
"//\r",
"//\r",
"// Dump the samples from the start to the end, taking care of the buffer\r",
"// wrap.\r",
"//\r",
"//\r",
"// Allow the UART some time to flush the buffer\r",
"//\r",
"//\r",
"// Dump the sample to the output.\r",
"//\r",
"//\r",
"// Move on to the next sample.\r",
"//\r",
"//\r",
"// Handle the wrap at the end of the buffer.\r",
"//\r",
"//\r",
"// Dump the sample to the output.\r",
"//\r",
"//\r",
"// Move on to the next sample.\r",
"//\r",
"//\r",
"// Handle the wrap at the end of the buffer.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdInfo | int | int
CmdInfo(int argc, char *argv[])
{
tTriggerType eType;
unsigned long ulTrigPos;
unsigned short usLevel;
tDataAcqCaptureStatus sStatus;
//
// Get the existing trigger parameters.
//
DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel);
//
// Print out the trigger info.
//
UARTprintf("\nTrigger\n");
UARTprintf("-------\n");
UARTprintf("Type: %s (%d)\n", TriggerToString(eType), eType);
UARTprintf("Level: %d\n", usLevel);
UARTprintf("Position: %d\n", ulTrigPos);
//
// Print out channel 1 status
//
DataAcquisitionGetStatus(&sStatus);
UARTprintf("\nStatus\n");
UARTprintf("------\n");
UARTprintf("State: %s (%d)\n",
StateToString(sStatus.eState), sStatus.eState);
UARTprintf("Captured: %d\n", sStatus.ulSamplesCaptured);
UARTprintf("Buffer: 0x%08x\n", sStatus.pusBuffer);
UARTprintf("Data start: %d\n", sStatus.ulStartIndex);
UARTprintf("Trigger: %d\n", sStatus.ulTriggerIndex);
UARTprintf("Mode: %s\n",
sStatus.bDualMode ? "Dual" : "Single");
UARTprintf("CH2 offset: %duS\n", sStatus.ulSampleOffsetuS);
UARTprintf("Period: %duS\n", sStatus.ulSamplePerioduS);
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "info" 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 "info" or "i" commands. It prints information on the current trigger
// setting and the status of the latest capture request on UART0.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "info" 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 "info" or "i" commands. It prints information on the current trigger
setting and the status of the latest capture request on UART0.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"info",
"\"",
"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",
"\"",
"info",
"\"",
"or",
"\"",
"i",
"\"",
"commands",
".",
"It",
"prints",
"information",
"on",
"the",
"current",
"trigger",
"setting",
"and",
"the",
"status",
"of",
"the",
"latest",
"capture",
"request",
"on",
"UART0",
"."
] | int
CmdInfo(int argc, char *argv[])
{
tTriggerType eType;
unsigned long ulTrigPos;
unsigned short usLevel;
tDataAcqCaptureStatus sStatus;
DataAcquisitionGetTrigger(&eType, &ulTrigPos, &usLevel);
UARTprintf("\nTrigger\n");
UARTprintf("-------\n");
UARTprintf("Type: %s (%d)\n", TriggerToString(eType), eType);
UARTprintf("Level: %d\n", usLevel);
UARTprintf("Position: %d\n", ulTrigPos);
DataAcquisitionGetStatus(&sStatus);
UARTprintf("\nStatus\n");
UARTprintf("------\n");
UARTprintf("State: %s (%d)\n",
StateToString(sStatus.eState), sStatus.eState);
UARTprintf("Captured: %d\n", sStatus.ulSamplesCaptured);
UARTprintf("Buffer: 0x%08x\n", sStatus.pusBuffer);
UARTprintf("Data start: %d\n", sStatus.ulStartIndex);
UARTprintf("Trigger: %d\n", sStatus.ulTriggerIndex);
UARTprintf("Mode: %s\n",
sStatus.bDualMode ? "Dual" : "Single");
UARTprintf("CH2 offset: %duS\n", sStatus.ulSampleOffsetuS);
UARTprintf("Period: %duS\n", sStatus.ulSamplePerioduS);
return(COMMAND_OK);
} | [
"int",
"CmdInfo",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"tTriggerType",
"eType",
";",
"unsigned",
"long",
"ulTrigPos",
";",
"unsigned",
"short",
"usLevel",
";",
"tDataAcqCaptureStatus",
"sStatus",
";",
"DataAcquisitionGetTrigger",
"(",
"&",
"eType",
",",
"&",
"ulTrigPos",
",",
"&",
"usLevel",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"TriggerToString",
"(",
"eType",
")",
",",
"eType",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"usLevel",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulTrigPos",
")",
";",
"DataAcquisitionGetStatus",
"(",
"&",
"sStatus",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"StateToString",
"(",
"sStatus",
".",
"eState",
")",
",",
"sStatus",
".",
"eState",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"ulSamplesCaptured",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"pusBuffer",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"ulStartIndex",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"ulTriggerIndex",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"bDualMode",
"?",
"\"",
"\"",
":",
"\"",
"\"",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"ulSampleOffsetuS",
")",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"sStatus",
".",
"ulSamplePerioduS",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "info" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"info",
"\"",
"command",
"."
] | [
"//\r",
"// Get the existing trigger parameters.\r",
"//\r",
"//\r",
"// Print out the trigger info.\r",
"//\r",
"//\r",
"// Print out channel 1 status\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
79c5209afa4ff280ce65f8a2616a548f9a8f2ad8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/qs-scope/commands.c | [
"BSD-3-Clause"
] | C | CmdCls | int | int
CmdCls(int argc, char *argv[])
{
//
// Clear the frame buffer.
//
RendererFillRect((tRectangle *)0, 0);
//
// Update the display from the newly cleared frame buffer.
//
RendererUpdate();
return(COMMAND_OK);
} | //*****************************************************************************
// \internal
//
// Handler for the "cls" 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 "cls" command. It clears the display.
//
// \return Returns COMMAND_OK.
//
//*****************************************************************************
| \internal
Handler for the "cls" 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 "cls" command. It clears the display.
| [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"cls",
"\"",
"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",
"\"",
"cls",
"\"",
"command",
".",
"It",
"clears",
"the",
"display",
"."
] | int
CmdCls(int argc, char *argv[])
{
RendererFillRect((tRectangle *)0, 0);
RendererUpdate();
return(COMMAND_OK);
} | [
"int",
"CmdCls",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"RendererFillRect",
"(",
"(",
"tRectangle",
"*",
")",
"0",
",",
"0",
")",
";",
"RendererUpdate",
"(",
")",
";",
"return",
"(",
"COMMAND_OK",
")",
";",
"}"
] | \internal
Handler for the "cls" command. | [
"\\",
"internal",
"Handler",
"for",
"the",
"\"",
"cls",
"\"",
"command",
"."
] | [
"//\r",
"// Clear the frame buffer.\r",
"//\r",
"//\r",
"// Update the display from the newly cleared frame buffer.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
d7f6158783481209d7508c6f2a4498db10eaf7fc | junyanl-code/Luminary-Micro-Library | boards/dk-lm3s9b96/drivers/touch.c | [
"BSD-3-Clause"
] | C | TouchScreenDebouncer | void | static void
TouchScreenDebouncer(void)
{
long lX, lY, lTemp;
//
// Convert the ADC readings into pixel values on the screen.
//
lX = g_sTouchX;
lY = g_sTouchY;
lTemp = (((lX * g_plParmSet[0]) + (lY * g_plParmSet[1]) + g_plParmSet[2]) /
g_plParmSet[6]);
lY = (((lX * g_plParmSet[3]) + (lY * g_plParmSet[4]) + g_plParmSet[5]) /
g_plParmSet[6]);
lX = lTemp;
//
// See if the touch screen is being touched.
//
if((g_sTouchX < g_sTouchMin) || (g_sTouchY < g_sTouchMin))
{
//
// See if the pen is not up right now.
//
if(g_cState != 0x00)
{
//
// Decrement the state count.
//
g_cState--;
//
// See if the pen has been detected as up three times in a row.
//
if(g_cState == 0x80)
{
//
// Indicate that the pen is up.
//
g_cState = 0x00;
//
// See if there is a touch screen event handler.
//
if(g_pfnTSHandler)
{
//
// Send the pen up message to the touch screen event
// handler.
//
g_pfnTSHandler(WIDGET_MSG_PTR_UP, g_psSamples[g_cIndex],
g_psSamples[g_cIndex + 1]);
}
}
}
}
else
{
//
// See if the pen is not down right now.
//
if(g_cState != 0x83)
{
//
// Increment the state count.
//
g_cState++;
//
// See if the pen has been detected as down three times in a row.
//
if(g_cState == 0x03)
{
//
// Indicate that the pen is up.
//
g_cState = 0x83;
//
// Set the index to -8, so that the next 3 samples are stored
// into the sample buffer before sending anything back to the
// touch screen event handler.
//
g_cIndex = -8;
//
// Store this sample into the sample buffer.
//
g_psSamples[0] = lX;
g_psSamples[1] = lY;
}
}
else
{
//
// See if the sample buffer pre-fill has completed.
//
if(g_cIndex == -2)
{
//
// See if there is a touch screen event handler.
//
if(g_pfnTSHandler)
{
//
// Send the pen down message to the touch screen event
// handler.
//
g_pfnTSHandler(WIDGET_MSG_PTR_DOWN, g_psSamples[0],
g_psSamples[1]);
}
//
// Store this sample into the sample buffer.
//
g_psSamples[0] = lX;
g_psSamples[1] = lY;
//
// Set the index to the next sample to send.
//
g_cIndex = 2;
}
//
// Otherwise, see if the sample buffer pre-fill is in progress.
//
else if(g_cIndex < 0)
{
//
// Store this sample into the sample buffer.
//
g_psSamples[g_cIndex + 10] = lX;
g_psSamples[g_cIndex + 11] = lY;
//
// Increment the index.
//
g_cIndex += 2;
}
//
// Otherwise, the sample buffer is full.
//
else
{
//
// See if there is a touch screen event handler.
//
if(g_pfnTSHandler)
{
//
// Send the pen move message to the touch screen event
// handler.
//
g_pfnTSHandler(WIDGET_MSG_PTR_MOVE, g_psSamples[g_cIndex],
g_psSamples[g_cIndex + 1]);
}
//
// Store this sample into the sample buffer.
//
g_psSamples[g_cIndex] = lX;
g_psSamples[g_cIndex + 1] = lY;
//
// Increment the index.
//
g_cIndex = (g_cIndex + 2) & 7;
}
}
}
} | //*****************************************************************************
//
//! Debounces presses of the touch screen.
//!
//! This function is called when a new X/Y sample pair has been captured in
//! order to perform debouncing of the touch screen.
//!
//! \return None.
//
//*****************************************************************************
| Debounces presses of the touch screen.
This function is called when a new X/Y sample pair has been captured in
order to perform debouncing of the touch screen.
\return None. | [
"Debounces",
"presses",
"of",
"the",
"touch",
"screen",
".",
"This",
"function",
"is",
"called",
"when",
"a",
"new",
"X",
"/",
"Y",
"sample",
"pair",
"has",
"been",
"captured",
"in",
"order",
"to",
"perform",
"debouncing",
"of",
"the",
"touch",
"screen",
".",
"\\",
"return",
"None",
"."
] | static void
TouchScreenDebouncer(void)
{
long lX, lY, lTemp;
lX = g_sTouchX;
lY = g_sTouchY;
lTemp = (((lX * g_plParmSet[0]) + (lY * g_plParmSet[1]) + g_plParmSet[2]) /
g_plParmSet[6]);
lY = (((lX * g_plParmSet[3]) + (lY * g_plParmSet[4]) + g_plParmSet[5]) /
g_plParmSet[6]);
lX = lTemp;
if((g_sTouchX < g_sTouchMin) || (g_sTouchY < g_sTouchMin))
{
if(g_cState != 0x00)
{
g_cState--;
if(g_cState == 0x80)
{
g_cState = 0x00;
if(g_pfnTSHandler)
{
g_pfnTSHandler(WIDGET_MSG_PTR_UP, g_psSamples[g_cIndex],
g_psSamples[g_cIndex + 1]);
}
}
}
}
else
{
if(g_cState != 0x83)
{
g_cState++;
if(g_cState == 0x03)
{
g_cState = 0x83;
g_cIndex = -8;
g_psSamples[0] = lX;
g_psSamples[1] = lY;
}
}
else
{
if(g_cIndex == -2)
{
if(g_pfnTSHandler)
{
g_pfnTSHandler(WIDGET_MSG_PTR_DOWN, g_psSamples[0],
g_psSamples[1]);
}
g_psSamples[0] = lX;
g_psSamples[1] = lY;
g_cIndex = 2;
}
else if(g_cIndex < 0)
{
g_psSamples[g_cIndex + 10] = lX;
g_psSamples[g_cIndex + 11] = lY;
g_cIndex += 2;
}
else
{
if(g_pfnTSHandler)
{
g_pfnTSHandler(WIDGET_MSG_PTR_MOVE, g_psSamples[g_cIndex],
g_psSamples[g_cIndex + 1]);
}
g_psSamples[g_cIndex] = lX;
g_psSamples[g_cIndex + 1] = lY;
g_cIndex = (g_cIndex + 2) & 7;
}
}
}
} | [
"static",
"void",
"TouchScreenDebouncer",
"(",
"void",
")",
"{",
"long",
"lX",
",",
"lY",
",",
"lTemp",
";",
"lX",
"=",
"g_sTouchX",
";",
"lY",
"=",
"g_sTouchY",
";",
"lTemp",
"=",
"(",
"(",
"(",
"lX",
"*",
"g_plParmSet",
"[",
"0",
"]",
")",
"+",
"(",
"lY",
"*",
"g_plParmSet",
"[",
"1",
"]",
")",
"+",
"g_plParmSet",
"[",
"2",
"]",
")",
"/",
"g_plParmSet",
"[",
"6",
"]",
")",
";",
"lY",
"=",
"(",
"(",
"(",
"lX",
"*",
"g_plParmSet",
"[",
"3",
"]",
")",
"+",
"(",
"lY",
"*",
"g_plParmSet",
"[",
"4",
"]",
")",
"+",
"g_plParmSet",
"[",
"5",
"]",
")",
"/",
"g_plParmSet",
"[",
"6",
"]",
")",
";",
"lX",
"=",
"lTemp",
";",
"if",
"(",
"(",
"g_sTouchX",
"<",
"g_sTouchMin",
")",
"||",
"(",
"g_sTouchY",
"<",
"g_sTouchMin",
")",
")",
"{",
"if",
"(",
"g_cState",
"!=",
"0x00",
")",
"{",
"g_cState",
"--",
";",
"if",
"(",
"g_cState",
"==",
"0x80",
")",
"{",
"g_cState",
"=",
"0x00",
";",
"if",
"(",
"g_pfnTSHandler",
")",
"{",
"g_pfnTSHandler",
"(",
"WIDGET_MSG_PTR_UP",
",",
"g_psSamples",
"[",
"g_cIndex",
"]",
",",
"g_psSamples",
"[",
"g_cIndex",
"+",
"1",
"]",
")",
";",
"}",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"g_cState",
"!=",
"0x83",
")",
"{",
"g_cState",
"++",
";",
"if",
"(",
"g_cState",
"==",
"0x03",
")",
"{",
"g_cState",
"=",
"0x83",
";",
"g_cIndex",
"=",
"-8",
";",
"g_psSamples",
"[",
"0",
"]",
"=",
"lX",
";",
"g_psSamples",
"[",
"1",
"]",
"=",
"lY",
";",
"}",
"}",
"else",
"{",
"if",
"(",
"g_cIndex",
"==",
"-2",
")",
"{",
"if",
"(",
"g_pfnTSHandler",
")",
"{",
"g_pfnTSHandler",
"(",
"WIDGET_MSG_PTR_DOWN",
",",
"g_psSamples",
"[",
"0",
"]",
",",
"g_psSamples",
"[",
"1",
"]",
")",
";",
"}",
"g_psSamples",
"[",
"0",
"]",
"=",
"lX",
";",
"g_psSamples",
"[",
"1",
"]",
"=",
"lY",
";",
"g_cIndex",
"=",
"2",
";",
"}",
"else",
"if",
"(",
"g_cIndex",
"<",
"0",
")",
"{",
"g_psSamples",
"[",
"g_cIndex",
"+",
"10",
"]",
"=",
"lX",
";",
"g_psSamples",
"[",
"g_cIndex",
"+",
"11",
"]",
"=",
"lY",
";",
"g_cIndex",
"+=",
"2",
";",
"}",
"else",
"{",
"if",
"(",
"g_pfnTSHandler",
")",
"{",
"g_pfnTSHandler",
"(",
"WIDGET_MSG_PTR_MOVE",
",",
"g_psSamples",
"[",
"g_cIndex",
"]",
",",
"g_psSamples",
"[",
"g_cIndex",
"+",
"1",
"]",
")",
";",
"}",
"g_psSamples",
"[",
"g_cIndex",
"]",
"=",
"lX",
";",
"g_psSamples",
"[",
"g_cIndex",
"+",
"1",
"]",
"=",
"lY",
";",
"g_cIndex",
"=",
"(",
"g_cIndex",
"+",
"2",
")",
"&",
"7",
";",
"}",
"}",
"}",
"}"
] | Debounces presses of the touch screen. | [
"Debounces",
"presses",
"of",
"the",
"touch",
"screen",
"."
] | [
"//\r",
"// Convert the ADC readings into pixel values on the screen.\r",
"//\r",
"//\r",
"// See if the touch screen is being touched.\r",
"//\r",
"//\r",
"// See if the pen is not up right now.\r",
"//\r",
"//\r",
"// Decrement the state count.\r",
"//\r",
"//\r",
"// See if the pen has been detected as up three times in a row.\r",
"//\r",
"//\r",
"// Indicate that the pen is up.\r",
"//\r",
"//\r",
"// See if there is a touch screen event handler.\r",
"//\r",
"//\r",
"// Send the pen up message to the touch screen event\r",
"// handler.\r",
"//\r",
"//\r",
"// See if the pen is not down right now.\r",
"//\r",
"//\r",
"// Increment the state count.\r",
"//\r",
"//\r",
"// See if the pen has been detected as down three times in a row.\r",
"//\r",
"//\r",
"// Indicate that the pen is up.\r",
"//\r",
"//\r",
"// Set the index to -8, so that the next 3 samples are stored\r",
"// into the sample buffer before sending anything back to the\r",
"// touch screen event handler.\r",
"//\r",
"//\r",
"// Store this sample into the sample buffer.\r",
"//\r",
"//\r",
"// See if the sample buffer pre-fill has completed.\r",
"//\r",
"//\r",
"// See if there is a touch screen event handler.\r",
"//\r",
"//\r",
"// Send the pen down message to the touch screen event\r",
"// handler.\r",
"//\r",
"//\r",
"// Store this sample into the sample buffer.\r",
"//\r",
"//\r",
"// Set the index to the next sample to send.\r",
"//\r",
"//\r",
"// Otherwise, see if the sample buffer pre-fill is in progress.\r",
"//\r",
"//\r",
"// Store this sample into the sample buffer.\r",
"//\r",
"//\r",
"// Increment the index.\r",
"//\r",
"//\r",
"// Otherwise, the sample buffer is full.\r",
"//\r",
"//\r",
"// See if there is a touch screen event handler.\r",
"//\r",
"//\r",
"// Send the pen move message to the touch screen event\r",
"// handler.\r",
"//\r",
"//\r",
"// Store this sample into the sample buffer.\r",
"//\r",
"//\r",
"// Increment the index.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d7f6158783481209d7508c6f2a4498db10eaf7fc | junyanl-code/Luminary-Micro-Library | boards/dk-lm3s9b96/drivers/touch.c | [
"BSD-3-Clause"
] | C | TouchScreenIntHandler | void | void
TouchScreenIntHandler(void)
{
//
// Clear the ADC sample sequence interrupt.
//
HWREG(ADC0_BASE + ADC_O_ISC) = 1 << 3;
//
// Determine what to do based on the current state of the state machine.
//
switch(g_ulTSState)
{
//
// The new sample is an X axis sample that should be discarded.
//
case TS_STATE_SKIP_X:
{
//
// Read and throw away the ADC sample.
//
HWREG(ADC0_BASE + ADC_O_SSFIFO3);
//
// Set the analog mode select for the YP pin.
//
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) | TS_YP_PIN;
//
// Configure the Y axis touch layer pins as inputs.
//
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) & ~TS_YP_PIN;
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_SET_REG) = LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_SET_REG) = LCD_CONTROL_YN;
}
else
{
//
// Default case with no daughter, SDRAM board or any other
// daughter which doesn't mess with the touchscreen interface.
//
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) & ~TS_YN_PIN;
}
//
// The next sample will be a valid X axis sample.
//
g_ulTSState = TS_STATE_READ_X;
//
// This state has been handled.
//
break;
}
//
// The new sample is an X axis sample that should be processed.
//
case TS_STATE_READ_X:
{
//
// Read the raw ADC sample.
//
g_sTouchX = HWREG(ADC0_BASE + ADC_O_SSFIFO3);
//
// Clear the analog mode select for the YP pin.
//
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) & ~TS_YP_PIN;
//
// Configure the X and Y axis touch layers as outputs.
//
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) | TS_XP_PIN | TS_YP_PIN;
if((g_eDaughterType != DAUGHTER_SRAM_FLASH) &&
(g_eDaughterType != DAUGHTER_FPGA))
{
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) | TS_XN_PIN | TS_YN_PIN;
}
//
// Drive the positive side of the Y axis touch layer with VDD and
// the negative side with GND. Also, drive both sides of the X
// axis layer with GND to discharge any residual voltage (so that
// a no-touch condition can be properly detected).
//
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_CLR_REG) = (LCD_CONTROL_XN |
LCD_CONTROL_YN);
}
else
{
//
// Default case - any daughter which doesn't muck with the
// touchscreen signals.
//
HWREG(TS_N_BASE + GPIO_O_DATA +
((TS_XN_PIN | TS_YN_PIN) << 2)) = 0;
}
HWREG(TS_P_BASE + GPIO_O_DATA + ((TS_XP_PIN | TS_YP_PIN) << 2)) =
TS_YP_PIN;
//
// Configure the sample sequence to capture the X axis value.
//
HWREG(ADC0_BASE + ADC_O_SSMUX3) = ADC_CTL_CH_XP;
//
// The next sample will be an invalid Y axis sample.
//
g_ulTSState = TS_STATE_SKIP_Y;
//
// This state has been handled.
//
break;
}
//
// The new sample is a Y axis sample that should be discarded.
//
case TS_STATE_SKIP_Y:
{
//
// Read and throw away the ADC sample.
//
HWREG(ADC0_BASE + ADC_O_SSFIFO3);
//
// Set the analog mode select for the XP pin.
//
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) | TS_XP_PIN;
//
// Configure the X axis touch layer pins as inputs.
//
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) & ~TS_XP_PIN;
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_SET_REG) = LCD_CONTROL_XN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_SET_REG) = LCD_CONTROL_XN;
}
else
{
//
// Default case - any daughter which doesn't muck with the
// touchscreen signals.
//
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) & ~TS_XN_PIN;
}
//
// The next sample will be a valid Y axis sample.
//
g_ulTSState = TS_STATE_READ_Y;
//
// This state has been handled.
//
break;
}
//
// The new sample is a Y axis sample that should be processed.
//
case TS_STATE_READ_Y:
{
//
// Read the raw ADC sample.
//
g_sTouchY = HWREG(ADC0_BASE + ADC_O_SSFIFO3);
//
// The next configuration is the same as the initial configuration.
// Therefore, fall through into the initialization state to avoid
// duplicating the code.
//
}
//
// The state machine is in its initial state
//
case TS_STATE_INIT:
{
//
// Clear the analog mode select for the XP pin.
//
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) & ~TS_XP_PIN;
//
// Configure the X and Y axis touch layers as outputs.
//
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) | TS_XP_PIN | TS_YP_PIN;
if((g_eDaughterType != DAUGHTER_SRAM_FLASH) &&
(g_eDaughterType != DAUGHTER_FPGA))
{
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) | TS_XN_PIN | TS_YN_PIN;
}
//
// Drive one side of the X axis touch layer with VDD and the other
// with GND. Also, drive both sides of the Y axis layer with GND
// to discharge any residual voltage (so that a no-touch condition
// can be properly detected).
//
HWREG(TS_P_BASE + GPIO_O_DATA + ((TS_XP_PIN | TS_YP_PIN) << 2)) =
TS_XP_PIN;
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_CLR_REG) = (LCD_CONTROL_XN |
LCD_CONTROL_YN);
}
else
{
//
// Default case - any daughter which does not muck with the
// touchscreen signals.
//
HWREG(TS_N_BASE + GPIO_O_DATA +
((TS_XN_PIN | TS_YN_PIN) << 2)) = 0;
}
//
// Configure the sample sequence to capture the Y axis value.
//
HWREG(ADC0_BASE + ADC_O_SSMUX3) = ADC_CTL_CH_YP;
//
// If this is the valid Y sample state, then there is a new X/Y
// sample pair. In that case, run the touch screen debouncer.
//
if(g_ulTSState == TS_STATE_READ_Y)
{
TouchScreenDebouncer();
}
//
// The next sample will be an invalid X axis sample.
//
g_ulTSState = TS_STATE_SKIP_X;
//
// This state has been handled.
//
break;
}
}
} | //*****************************************************************************
//
//! Handles the ADC interrupt for the touch screen.
//!
//! This function is called when the ADC sequence that samples the touch screen
//! has completed its acquisition. The touch screen state machine is advanced
//! and the acquired ADC sample is processed appropriately.
//!
//! It is the responsibility of the application using the touch screen driver
//! to ensure that this function is installed in the interrupt vector table for
//! the ADC3 interrupt.
//!
//! \return None.
//
//*****************************************************************************
| Handles the ADC interrupt for the touch screen.
This function is called when the ADC sequence that samples the touch screen
has completed its acquisition. The touch screen state machine is advanced
and the acquired ADC sample is processed appropriately.
It is the responsibility of the application using the touch screen driver
to ensure that this function is installed in the interrupt vector table for
the ADC3 interrupt.
\return None. | [
"Handles",
"the",
"ADC",
"interrupt",
"for",
"the",
"touch",
"screen",
".",
"This",
"function",
"is",
"called",
"when",
"the",
"ADC",
"sequence",
"that",
"samples",
"the",
"touch",
"screen",
"has",
"completed",
"its",
"acquisition",
".",
"The",
"touch",
"screen",
"state",
"machine",
"is",
"advanced",
"and",
"the",
"acquired",
"ADC",
"sample",
"is",
"processed",
"appropriately",
".",
"It",
"is",
"the",
"responsibility",
"of",
"the",
"application",
"using",
"the",
"touch",
"screen",
"driver",
"to",
"ensure",
"that",
"this",
"function",
"is",
"installed",
"in",
"the",
"interrupt",
"vector",
"table",
"for",
"the",
"ADC3",
"interrupt",
".",
"\\",
"return",
"None",
"."
] | void
TouchScreenIntHandler(void)
{
HWREG(ADC0_BASE + ADC_O_ISC) = 1 << 3;
switch(g_ulTSState)
{
case TS_STATE_SKIP_X:
{
HWREG(ADC0_BASE + ADC_O_SSFIFO3);
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) | TS_YP_PIN;
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) & ~TS_YP_PIN;
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_SET_REG) = LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_SET_REG) = LCD_CONTROL_YN;
}
else
{
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) & ~TS_YN_PIN;
}
g_ulTSState = TS_STATE_READ_X;
break;
}
case TS_STATE_READ_X:
{
g_sTouchX = HWREG(ADC0_BASE + ADC_O_SSFIFO3);
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) & ~TS_YP_PIN;
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) | TS_XP_PIN | TS_YP_PIN;
if((g_eDaughterType != DAUGHTER_SRAM_FLASH) &&
(g_eDaughterType != DAUGHTER_FPGA))
{
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) | TS_XN_PIN | TS_YN_PIN;
}
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_CLR_REG) = (LCD_CONTROL_XN |
LCD_CONTROL_YN);
}
else
{
HWREG(TS_N_BASE + GPIO_O_DATA +
((TS_XN_PIN | TS_YN_PIN) << 2)) = 0;
}
HWREG(TS_P_BASE + GPIO_O_DATA + ((TS_XP_PIN | TS_YP_PIN) << 2)) =
TS_YP_PIN;
HWREG(ADC0_BASE + ADC_O_SSMUX3) = ADC_CTL_CH_XP;
g_ulTSState = TS_STATE_SKIP_Y;
break;
}
case TS_STATE_SKIP_Y:
{
HWREG(ADC0_BASE + ADC_O_SSFIFO3);
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) | TS_XP_PIN;
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) & ~TS_XP_PIN;
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_SET_REG) = LCD_CONTROL_XN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_SET_REG) = LCD_CONTROL_XN;
}
else
{
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) & ~TS_XN_PIN;
}
g_ulTSState = TS_STATE_READ_Y;
break;
}
case TS_STATE_READ_Y:
{
g_sTouchY = HWREG(ADC0_BASE + ADC_O_SSFIFO3);
}
case TS_STATE_INIT:
{
HWREG(TS_P_BASE + GPIO_O_AMSEL) =
HWREG(TS_P_BASE + GPIO_O_AMSEL) & ~TS_XP_PIN;
HWREG(TS_P_BASE + GPIO_O_DIR) =
HWREG(TS_P_BASE + GPIO_O_DIR) | TS_XP_PIN | TS_YP_PIN;
if((g_eDaughterType != DAUGHTER_SRAM_FLASH) &&
(g_eDaughterType != DAUGHTER_FPGA))
{
HWREG(TS_N_BASE + GPIO_O_DIR) =
HWREG(TS_N_BASE + GPIO_O_DIR) | TS_XN_PIN | TS_YN_PIN;
}
HWREG(TS_P_BASE + GPIO_O_DATA + ((TS_XP_PIN | TS_YP_PIN) << 2)) =
TS_XP_PIN;
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_CLR_REG) = (LCD_CONTROL_XN |
LCD_CONTROL_YN);
}
else
{
HWREG(TS_N_BASE + GPIO_O_DATA +
((TS_XN_PIN | TS_YN_PIN) << 2)) = 0;
}
HWREG(ADC0_BASE + ADC_O_SSMUX3) = ADC_CTL_CH_YP;
if(g_ulTSState == TS_STATE_READ_Y)
{
TouchScreenDebouncer();
}
g_ulTSState = TS_STATE_SKIP_X;
break;
}
}
} | [
"void",
"TouchScreenIntHandler",
"(",
"void",
")",
"{",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_ISC",
")",
"=",
"1",
"<<",
"3",
";",
"switch",
"(",
"g_ulTSState",
")",
"{",
"case",
"TS_STATE_SKIP_X",
":",
"{",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_SSFIFO3",
")",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"|",
"TS_YP_PIN",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"&",
"~",
"TS_YP_PIN",
";",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_SRAM_FLASH",
")",
"{",
"HWREGB",
"(",
"LCD_CONTROL_SET_REG",
")",
"=",
"LCD_CONTROL_YN",
";",
"}",
"else",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_FPGA",
")",
"{",
"HWREGH",
"(",
"LCD_FPGA_CONTROL_SET_REG",
")",
"=",
"LCD_CONTROL_YN",
";",
"}",
"else",
"{",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"&",
"~",
"TS_YN_PIN",
";",
"}",
"g_ulTSState",
"=",
"TS_STATE_READ_X",
";",
"break",
";",
"}",
"case",
"TS_STATE_READ_X",
":",
"{",
"g_sTouchX",
"=",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_SSFIFO3",
")",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"&",
"~",
"TS_YP_PIN",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"|",
"TS_XP_PIN",
"|",
"TS_YP_PIN",
";",
"if",
"(",
"(",
"g_eDaughterType",
"!=",
"DAUGHTER_SRAM_FLASH",
")",
"&&",
"(",
"g_eDaughterType",
"!=",
"DAUGHTER_FPGA",
")",
")",
"{",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"|",
"TS_XN_PIN",
"|",
"TS_YN_PIN",
";",
"}",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_SRAM_FLASH",
")",
"{",
"HWREGB",
"(",
"LCD_CONTROL_CLR_REG",
")",
"=",
"LCD_CONTROL_XN",
"|",
"LCD_CONTROL_YN",
";",
"}",
"else",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_FPGA",
")",
"{",
"HWREGH",
"(",
"LCD_FPGA_CONTROL_CLR_REG",
")",
"=",
"(",
"LCD_CONTROL_XN",
"|",
"LCD_CONTROL_YN",
")",
";",
"}",
"else",
"{",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DATA",
"+",
"(",
"(",
"TS_XN_PIN",
"|",
"TS_YN_PIN",
")",
"<<",
"2",
")",
")",
"=",
"0",
";",
"}",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DATA",
"+",
"(",
"(",
"TS_XP_PIN",
"|",
"TS_YP_PIN",
")",
"<<",
"2",
")",
")",
"=",
"TS_YP_PIN",
";",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_SSMUX3",
")",
"=",
"ADC_CTL_CH_XP",
";",
"g_ulTSState",
"=",
"TS_STATE_SKIP_Y",
";",
"break",
";",
"}",
"case",
"TS_STATE_SKIP_Y",
":",
"{",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_SSFIFO3",
")",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"|",
"TS_XP_PIN",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"&",
"~",
"TS_XP_PIN",
";",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_SRAM_FLASH",
")",
"{",
"HWREGB",
"(",
"LCD_CONTROL_SET_REG",
")",
"=",
"LCD_CONTROL_XN",
";",
"}",
"else",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_FPGA",
")",
"{",
"HWREGH",
"(",
"LCD_FPGA_CONTROL_SET_REG",
")",
"=",
"LCD_CONTROL_XN",
";",
"}",
"else",
"{",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"&",
"~",
"TS_XN_PIN",
";",
"}",
"g_ulTSState",
"=",
"TS_STATE_READ_Y",
";",
"break",
";",
"}",
"case",
"TS_STATE_READ_Y",
":",
"{",
"g_sTouchY",
"=",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_SSFIFO3",
")",
";",
"}",
"case",
"TS_STATE_INIT",
":",
"{",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_AMSEL",
")",
"&",
"~",
"TS_XP_PIN",
";",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DIR",
")",
"|",
"TS_XP_PIN",
"|",
"TS_YP_PIN",
";",
"if",
"(",
"(",
"g_eDaughterType",
"!=",
"DAUGHTER_SRAM_FLASH",
")",
"&&",
"(",
"g_eDaughterType",
"!=",
"DAUGHTER_FPGA",
")",
")",
"{",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"=",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DIR",
")",
"|",
"TS_XN_PIN",
"|",
"TS_YN_PIN",
";",
"}",
"HWREG",
"(",
"TS_P_BASE",
"+",
"GPIO_O_DATA",
"+",
"(",
"(",
"TS_XP_PIN",
"|",
"TS_YP_PIN",
")",
"<<",
"2",
")",
")",
"=",
"TS_XP_PIN",
";",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_SRAM_FLASH",
")",
"{",
"HWREGB",
"(",
"LCD_CONTROL_CLR_REG",
")",
"=",
"LCD_CONTROL_XN",
"|",
"LCD_CONTROL_YN",
";",
"}",
"else",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_FPGA",
")",
"{",
"HWREGH",
"(",
"LCD_FPGA_CONTROL_CLR_REG",
")",
"=",
"(",
"LCD_CONTROL_XN",
"|",
"LCD_CONTROL_YN",
")",
";",
"}",
"else",
"{",
"HWREG",
"(",
"TS_N_BASE",
"+",
"GPIO_O_DATA",
"+",
"(",
"(",
"TS_XN_PIN",
"|",
"TS_YN_PIN",
")",
"<<",
"2",
")",
")",
"=",
"0",
";",
"}",
"HWREG",
"(",
"ADC0_BASE",
"+",
"ADC_O_SSMUX3",
")",
"=",
"ADC_CTL_CH_YP",
";",
"if",
"(",
"g_ulTSState",
"==",
"TS_STATE_READ_Y",
")",
"{",
"TouchScreenDebouncer",
"(",
")",
";",
"}",
"g_ulTSState",
"=",
"TS_STATE_SKIP_X",
";",
"break",
";",
"}",
"}",
"}"
] | Handles the ADC interrupt for the touch screen. | [
"Handles",
"the",
"ADC",
"interrupt",
"for",
"the",
"touch",
"screen",
"."
] | [
"//\r",
"// Clear the ADC sample sequence interrupt.\r",
"//\r",
"//\r",
"// Determine what to do based on the current state of the state machine.\r",
"//\r",
"//\r",
"// The new sample is an X axis sample that should be discarded.\r",
"//\r",
"//\r",
"// Read and throw away the ADC sample.\r",
"//\r",
"//\r",
"// Set the analog mode select for the YP pin.\r",
"//\r",
"//\r",
"// Configure the Y axis touch layer pins as inputs.\r",
"//\r",
"//\r",
"// Default case with no daughter, SDRAM board or any other\r",
"// daughter which doesn't mess with the touchscreen interface.\r",
"//\r",
"//\r",
"// The next sample will be a valid X axis sample.\r",
"//\r",
"//\r",
"// This state has been handled.\r",
"//\r",
"//\r",
"// The new sample is an X axis sample that should be processed.\r",
"//\r",
"//\r",
"// Read the raw ADC sample.\r",
"//\r",
"//\r",
"// Clear the analog mode select for the YP pin.\r",
"//\r",
"//\r",
"// Configure the X and Y axis touch layers as outputs.\r",
"//\r",
"//\r",
"// Drive the positive side of the Y axis touch layer with VDD and\r",
"// the negative side with GND. Also, drive both sides of the X\r",
"// axis layer with GND to discharge any residual voltage (so that\r",
"// a no-touch condition can be properly detected).\r",
"//\r",
"//\r",
"// Default case - any daughter which doesn't muck with the\r",
"// touchscreen signals.\r",
"//\r",
"//\r",
"// Configure the sample sequence to capture the X axis value.\r",
"//\r",
"//\r",
"// The next sample will be an invalid Y axis sample.\r",
"//\r",
"//\r",
"// This state has been handled.\r",
"//\r",
"//\r",
"// The new sample is a Y axis sample that should be discarded.\r",
"//\r",
"//\r",
"// Read and throw away the ADC sample.\r",
"//\r",
"//\r",
"// Set the analog mode select for the XP pin.\r",
"//\r",
"//\r",
"// Configure the X axis touch layer pins as inputs.\r",
"//\r",
"//\r",
"// Default case - any daughter which doesn't muck with the\r",
"// touchscreen signals.\r",
"//\r",
"//\r",
"// The next sample will be a valid Y axis sample.\r",
"//\r",
"//\r",
"// This state has been handled.\r",
"//\r",
"//\r",
"// The new sample is a Y axis sample that should be processed.\r",
"//\r",
"//\r",
"// Read the raw ADC sample.\r",
"//\r",
"//\r",
"// The next configuration is the same as the initial configuration.\r",
"// Therefore, fall through into the initialization state to avoid\r",
"// duplicating the code.\r",
"//\r",
"//\r",
"// The state machine is in its initial state\r",
"//\r",
"//\r",
"// Clear the analog mode select for the XP pin.\r",
"//\r",
"//\r",
"// Configure the X and Y axis touch layers as outputs.\r",
"//\r",
"//\r",
"// Drive one side of the X axis touch layer with VDD and the other\r",
"// with GND. Also, drive both sides of the Y axis layer with GND\r",
"// to discharge any residual voltage (so that a no-touch condition\r",
"// can be properly detected).\r",
"//\r",
"//\r",
"// Default case - any daughter which does not muck with the\r",
"// touchscreen signals.\r",
"//\r",
"//\r",
"// Configure the sample sequence to capture the Y axis value.\r",
"//\r",
"//\r",
"// If this is the valid Y sample state, then there is a new X/Y\r",
"// sample pair. In that case, run the touch screen debouncer.\r",
"//\r",
"//\r",
"// The next sample will be an invalid X axis sample.\r",
"//\r",
"//\r",
"// This state has been handled.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
d7f6158783481209d7508c6f2a4498db10eaf7fc | junyanl-code/Luminary-Micro-Library | boards/dk-lm3s9b96/drivers/touch.c | [
"BSD-3-Clause"
] | C | TouchScreenInit | void | void
TouchScreenInit(void)
{
//
// Set the initial state of the touch screen driver's state machine.
//
g_ulTSState = TS_STATE_INIT;
//
// Determine which calibration parameter set we will be using.
//
g_plParmSet = g_lTouchParameters[SET_NORMAL];
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
//
// If the SRAM/Flash daughter board is present, select the appropriate
// calibration parameters and reading threshold value.
//
g_plParmSet = g_lTouchParameters[SET_SRAM_FLASH];
g_sTouchMin = 40;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
//
// If the FPGA daughter board is present, select the appropriate
// calibration parameters and reading threshold value.
//
g_plParmSet = g_lTouchParameters[SET_FPGA];
g_sTouchMin = 70;
}
//
// There is no touch screen handler initially.
//
g_pfnTSHandler = 0;
//
// Enable the peripherals used by the touch screen interface.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ROM_SysCtlPeripheralEnable(TS_P_PERIPH);
ROM_SysCtlPeripheralEnable(TS_N_PERIPH);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
//
// Configure the ADC sample sequence used to read the touch screen reading.
//
ROM_ADCHardwareOversampleConfigure(ADC0_BASE, 4);
ROM_ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_TIMER, 0);
ROM_ADCSequenceStepConfigure(ADC0_BASE, 3, 0,
ADC_CTL_CH_YP | ADC_CTL_END | ADC_CTL_IE);
ROM_ADCSequenceEnable(ADC0_BASE, 3);
//
// Enable the ADC sample sequence interrupt.
//
ROM_ADCIntEnable(ADC0_BASE, 3);
ROM_IntEnable(INT_ADC0SS3);
//
// Configure the GPIOs used to drive the touch screen layers.
//
ROM_GPIOPinTypeGPIOOutput(TS_P_BASE, TS_XP_PIN | TS_YP_PIN);
//
// If no daughter board or one which does not rewire the touchscreen
// interface is installed, set up GPIOs to drive the XN and YN signals.
//
if((g_eDaughterType != DAUGHTER_SRAM_FLASH) &&
(g_eDaughterType != DAUGHTER_FPGA))
{
ROM_GPIOPinTypeGPIOOutput(TS_N_BASE, TS_XN_PIN | TS_YN_PIN);
}
ROM_GPIOPinWrite(TS_P_BASE, TS_XP_PIN | TS_YP_PIN, 0x00);
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else
{
ROM_GPIOPinWrite(TS_N_BASE, TS_XN_PIN | TS_YN_PIN, 0x00);
}
//
// See if the ADC trigger timer has been configured, and configure it only
// if it has not been configured yet.
//
if((HWREG(TIMER1_BASE + TIMER_O_CTL) & TIMER_CTL_TAEN) == 0)
{
//
// Configure the timer to trigger the sampling of the touch screen
// every millisecond.
//
ROM_TimerConfigure(TIMER1_BASE, (TIMER_CFG_SPLIT_PAIR |
TIMER_CFG_A_PERIODIC | TIMER_CFG_B_PERIODIC));
ROM_TimerLoadSet(TIMER1_BASE, TIMER_A,
(ROM_SysCtlClockGet() / 1000) - 1);
ROM_TimerControlTrigger(TIMER1_BASE, TIMER_A, true);
//
// Enable the timer. At this point, the touch screen state machine
// will sample and run once per millisecond.
//
ROM_TimerEnable(TIMER1_BASE, TIMER_A);
}
} | //*****************************************************************************
//
//! Initializes the touch screen driver.
//!
//! This function initializes the touch screen driver, beginning the process of
//! reading from the touch screen. This driver uses the following hardware
//! resources:
//!
//! - ADC sample sequence 3
//! - Timer 1 subtimer A
//!
//! \return None.
//
//*****************************************************************************
| Initializes the touch screen driver.
This function initializes the touch screen driver, beginning the process of
reading from the touch screen. This driver uses the following hardware
resources.
ADC sample sequence 3
Timer 1 subtimer A
\return None. | [
"Initializes",
"the",
"touch",
"screen",
"driver",
".",
"This",
"function",
"initializes",
"the",
"touch",
"screen",
"driver",
"beginning",
"the",
"process",
"of",
"reading",
"from",
"the",
"touch",
"screen",
".",
"This",
"driver",
"uses",
"the",
"following",
"hardware",
"resources",
".",
"ADC",
"sample",
"sequence",
"3",
"Timer",
"1",
"subtimer",
"A",
"\\",
"return",
"None",
"."
] | void
TouchScreenInit(void)
{
g_ulTSState = TS_STATE_INIT;
g_plParmSet = g_lTouchParameters[SET_NORMAL];
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
g_plParmSet = g_lTouchParameters[SET_SRAM_FLASH];
g_sTouchMin = 40;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
g_plParmSet = g_lTouchParameters[SET_FPGA];
g_sTouchMin = 70;
}
g_pfnTSHandler = 0;
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ROM_SysCtlPeripheralEnable(TS_P_PERIPH);
ROM_SysCtlPeripheralEnable(TS_N_PERIPH);
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_TIMER1);
ROM_ADCHardwareOversampleConfigure(ADC0_BASE, 4);
ROM_ADCSequenceConfigure(ADC0_BASE, 3, ADC_TRIGGER_TIMER, 0);
ROM_ADCSequenceStepConfigure(ADC0_BASE, 3, 0,
ADC_CTL_CH_YP | ADC_CTL_END | ADC_CTL_IE);
ROM_ADCSequenceEnable(ADC0_BASE, 3);
ROM_ADCIntEnable(ADC0_BASE, 3);
ROM_IntEnable(INT_ADC0SS3);
ROM_GPIOPinTypeGPIOOutput(TS_P_BASE, TS_XP_PIN | TS_YP_PIN);
if((g_eDaughterType != DAUGHTER_SRAM_FLASH) &&
(g_eDaughterType != DAUGHTER_FPGA))
{
ROM_GPIOPinTypeGPIOOutput(TS_N_BASE, TS_XN_PIN | TS_YN_PIN);
}
ROM_GPIOPinWrite(TS_P_BASE, TS_XP_PIN | TS_YP_PIN, 0x00);
if(g_eDaughterType == DAUGHTER_SRAM_FLASH)
{
HWREGB(LCD_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else if(g_eDaughterType == DAUGHTER_FPGA)
{
HWREGH(LCD_FPGA_CONTROL_CLR_REG) = LCD_CONTROL_XN | LCD_CONTROL_YN;
}
else
{
ROM_GPIOPinWrite(TS_N_BASE, TS_XN_PIN | TS_YN_PIN, 0x00);
}
if((HWREG(TIMER1_BASE + TIMER_O_CTL) & TIMER_CTL_TAEN) == 0)
{
ROM_TimerConfigure(TIMER1_BASE, (TIMER_CFG_SPLIT_PAIR |
TIMER_CFG_A_PERIODIC | TIMER_CFG_B_PERIODIC));
ROM_TimerLoadSet(TIMER1_BASE, TIMER_A,
(ROM_SysCtlClockGet() / 1000) - 1);
ROM_TimerControlTrigger(TIMER1_BASE, TIMER_A, true);
ROM_TimerEnable(TIMER1_BASE, TIMER_A);
}
} | [
"void",
"TouchScreenInit",
"(",
"void",
")",
"{",
"g_ulTSState",
"=",
"TS_STATE_INIT",
";",
"g_plParmSet",
"=",
"g_lTouchParameters",
"[",
"SET_NORMAL",
"]",
";",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_SRAM_FLASH",
")",
"{",
"g_plParmSet",
"=",
"g_lTouchParameters",
"[",
"SET_SRAM_FLASH",
"]",
";",
"g_sTouchMin",
"=",
"40",
";",
"}",
"else",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_FPGA",
")",
"{",
"g_plParmSet",
"=",
"g_lTouchParameters",
"[",
"SET_FPGA",
"]",
";",
"g_sTouchMin",
"=",
"70",
";",
"}",
"g_pfnTSHandler",
"=",
"0",
";",
"ROM_SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_ADC0",
")",
";",
"ROM_SysCtlPeripheralEnable",
"(",
"TS_P_PERIPH",
")",
";",
"ROM_SysCtlPeripheralEnable",
"(",
"TS_N_PERIPH",
")",
";",
"ROM_SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_TIMER1",
")",
";",
"ROM_ADCHardwareOversampleConfigure",
"(",
"ADC0_BASE",
",",
"4",
")",
";",
"ROM_ADCSequenceConfigure",
"(",
"ADC0_BASE",
",",
"3",
",",
"ADC_TRIGGER_TIMER",
",",
"0",
")",
";",
"ROM_ADCSequenceStepConfigure",
"(",
"ADC0_BASE",
",",
"3",
",",
"0",
",",
"ADC_CTL_CH_YP",
"|",
"ADC_CTL_END",
"|",
"ADC_CTL_IE",
")",
";",
"ROM_ADCSequenceEnable",
"(",
"ADC0_BASE",
",",
"3",
")",
";",
"ROM_ADCIntEnable",
"(",
"ADC0_BASE",
",",
"3",
")",
";",
"ROM_IntEnable",
"(",
"INT_ADC0SS3",
")",
";",
"ROM_GPIOPinTypeGPIOOutput",
"(",
"TS_P_BASE",
",",
"TS_XP_PIN",
"|",
"TS_YP_PIN",
")",
";",
"if",
"(",
"(",
"g_eDaughterType",
"!=",
"DAUGHTER_SRAM_FLASH",
")",
"&&",
"(",
"g_eDaughterType",
"!=",
"DAUGHTER_FPGA",
")",
")",
"{",
"ROM_GPIOPinTypeGPIOOutput",
"(",
"TS_N_BASE",
",",
"TS_XN_PIN",
"|",
"TS_YN_PIN",
")",
";",
"}",
"ROM_GPIOPinWrite",
"(",
"TS_P_BASE",
",",
"TS_XP_PIN",
"|",
"TS_YP_PIN",
",",
"0x00",
")",
";",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_SRAM_FLASH",
")",
"{",
"HWREGB",
"(",
"LCD_CONTROL_CLR_REG",
")",
"=",
"LCD_CONTROL_XN",
"|",
"LCD_CONTROL_YN",
";",
"}",
"else",
"if",
"(",
"g_eDaughterType",
"==",
"DAUGHTER_FPGA",
")",
"{",
"HWREGH",
"(",
"LCD_FPGA_CONTROL_CLR_REG",
")",
"=",
"LCD_CONTROL_XN",
"|",
"LCD_CONTROL_YN",
";",
"}",
"else",
"{",
"ROM_GPIOPinWrite",
"(",
"TS_N_BASE",
",",
"TS_XN_PIN",
"|",
"TS_YN_PIN",
",",
"0x00",
")",
";",
"}",
"if",
"(",
"(",
"HWREG",
"(",
"TIMER1_BASE",
"+",
"TIMER_O_CTL",
")",
"&",
"TIMER_CTL_TAEN",
")",
"==",
"0",
")",
"{",
"ROM_TimerConfigure",
"(",
"TIMER1_BASE",
",",
"(",
"TIMER_CFG_SPLIT_PAIR",
"|",
"TIMER_CFG_A_PERIODIC",
"|",
"TIMER_CFG_B_PERIODIC",
")",
")",
";",
"ROM_TimerLoadSet",
"(",
"TIMER1_BASE",
",",
"TIMER_A",
",",
"(",
"ROM_SysCtlClockGet",
"(",
")",
"/",
"1000",
")",
"-",
"1",
")",
";",
"ROM_TimerControlTrigger",
"(",
"TIMER1_BASE",
",",
"TIMER_A",
",",
"true",
")",
";",
"ROM_TimerEnable",
"(",
"TIMER1_BASE",
",",
"TIMER_A",
")",
";",
"}",
"}"
] | Initializes the touch screen driver. | [
"Initializes",
"the",
"touch",
"screen",
"driver",
"."
] | [
"//\r",
"// Set the initial state of the touch screen driver's state machine.\r",
"//\r",
"//\r",
"// Determine which calibration parameter set we will be using.\r",
"//\r",
"//\r",
"// If the SRAM/Flash daughter board is present, select the appropriate\r",
"// calibration parameters and reading threshold value.\r",
"//\r",
"//\r",
"// If the FPGA daughter board is present, select the appropriate\r",
"// calibration parameters and reading threshold value.\r",
"//\r",
"//\r",
"// There is no touch screen handler initially.\r",
"//\r",
"//\r",
"// Enable the peripherals used by the touch screen interface.\r",
"//\r",
"//\r",
"// Configure the ADC sample sequence used to read the touch screen reading.\r",
"//\r",
"//\r",
"// Enable the ADC sample sequence interrupt.\r",
"//\r",
"//\r",
"// Configure the GPIOs used to drive the touch screen layers.\r",
"//\r",
"//\r",
"// If no daughter board or one which does not rewire the touchscreen\r",
"// interface is installed, set up GPIOs to drive the XN and YN signals.\r",
"//\r",
"//\r",
"// See if the ADC trigger timer has been configured, and configure it only\r",
"// if it has not been configured yet.\r",
"//\r",
"//\r",
"// Configure the timer to trigger the sampling of the touch screen\r",
"// every millisecond.\r",
"//\r",
"//\r",
"// Enable the timer. At this point, the touch screen state machine\r",
"// will sample and run once per millisecond.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
a90e83909c3d01d55a0c9726241414b321a226f7 | junyanl-code/Luminary-Micro-Library | third_party/ptpd-1rc1/src/bmc.c | [
"BSD-3-Clause"
] | C | bmcDataSetComparison | Integer8 | Integer8 bmcDataSetComparison(MsgHeader *headerA, MsgSync *syncA,
MsgHeader *headerB, MsgSync *syncB, PtpClock *ptpClock)
{
DBGV("bmcDataSetComparison: start\n");
if( !( syncA->grandmasterPortId == syncB->grandmasterPortId
&& !memcmp(syncA->grandmasterClockUuid, syncB->grandmasterClockUuid, PTP_UUID_LENGTH) ) )
{
if(syncA->grandmasterClockStratum < syncB->grandmasterClockStratum)
goto A;
else if(syncA->grandmasterClockStratum > syncB->grandmasterClockStratum)
goto B;
/* grandmasterClockStratums same */
if(getIdentifierOrder(syncA->grandmasterClockIdentifier) < getIdentifierOrder(syncB->grandmasterClockIdentifier))
goto A;
if(getIdentifierOrder(syncA->grandmasterClockIdentifier) > getIdentifierOrder(syncB->grandmasterClockIdentifier))
goto B;
/* grandmasterClockIdentifiers same */
if(syncA->grandmasterClockStratum > 2)
{
if(syncA->grandmasterClockVariance > syncB->grandmasterClockVariance + PTP_LOG_VARIANCE_THRESHOLD
|| syncA->grandmasterClockVariance < syncB->grandmasterClockVariance - PTP_LOG_VARIANCE_THRESHOLD)
{
/* grandmasterClockVariances are not similar */
if(syncA->grandmasterClockVariance < syncB->grandmasterClockVariance)
goto A;
else
goto B;
}
/* grandmasterClockVariances are similar */
if(!syncA->grandmasterIsBoundaryClock != !syncB->grandmasterIsBoundaryClock) /* XOR */
{
if(syncA->grandmasterIsBoundaryClock)
goto A;
else
goto B;
}
/* neither is grandmasterIsBoundaryClock */
if(memcmp(syncA->grandmasterClockUuid, syncB->grandmasterClockUuid, PTP_UUID_LENGTH) < 0)
goto A;
else
goto B;
}
/* syncA->grandmasterClockStratum <= 2 */
if(!syncA->grandmasterPreferred != !syncB->grandmasterPreferred) /* XOR */
{
if(syncA->grandmasterPreferred)
return 1; /* A1 */
else
return -1; /* B1 */
}
/* neither or both grandmasterPreferred */
}
DBGV("bmcDataSetComparison: X\n");
if(syncA->localStepsRemoved > syncB->localStepsRemoved + 1
|| syncA->localStepsRemoved < syncB->localStepsRemoved -1)
{
/* localStepsRemoved not within 1 */
if(syncA->localStepsRemoved < syncB->localStepsRemoved)
return 1; /* A1 */
else
return -1; /* B1 */
}
/* localStepsRemoved within 1 */
if(syncA->localStepsRemoved < syncB->localStepsRemoved)
{
DBGV("bmcDataSetComparison: A3\n");
if(memcmp(ptpClock->port_uuid_field, headerB->sourceUuid, PTP_UUID_LENGTH) < 0)
return 1; /* A1 */
else if(memcmp(ptpClock->port_uuid_field, headerB->sourceUuid, PTP_UUID_LENGTH) > 0)
return 2; /* A2 */
/* this port_uuid_field same as headerB->sourceUuid */
if(ptpClock->port_id_field < headerB->sourcePortId)
return 1; /* A1 */
else if(ptpClock->port_id_field > headerB->sourcePortId)
return 2; /* A2 */
/* this port_id_field same as headerB->sourcePortId */
return 0; /* same */
}
if(syncA->localStepsRemoved > syncB->localStepsRemoved)
{
DBGV("bmcDataSetComparison: B3\n");
if(memcmp(ptpClock->port_uuid_field, headerA->sourceUuid, PTP_UUID_LENGTH) < 0)
return -1; /* B1 */
else if(memcmp(ptpClock->port_uuid_field, headerB->sourceUuid, PTP_UUID_LENGTH) > 0)
return -2; /* B2 */
/* this port_uuid_field same as headerA->sourceUuid */
if(ptpClock->port_id_field < headerA->sourcePortId)
return -1; /* B1 */
else if(ptpClock->port_id_field > headerA->sourcePortId)
return -2; /* B2 */
/* this port_id_field same as headerA->sourcePortId */
return 0; /* same */
}
/* localStepsRemoved same */
if(memcmp(headerA->sourceUuid, headerB->sourceUuid, PTP_UUID_LENGTH) < 0)
return 2; /* A2 */
else if(memcmp(headerA->sourceUuid, headerB->sourceUuid, PTP_UUID_LENGTH) > 0)
return -2; /* B2 */
/* sourceUuid same */
DBGV("bmcDataSetComparison: Z\n");
if(syncA->grandmasterSequenceId > syncB->grandmasterSequenceId)
return 3;
else if(syncA->grandmasterSequenceId < syncB->grandmasterSequenceId)
return -3;
/* grandmasterSequenceId same */
if(headerA->sequenceId > headerB->sequenceId)
return 3;
else if(headerA->sequenceId < headerB->sequenceId)
return -3;
/* sequenceId same */
return 0; /* same */
/* oh no, a goto label! the horror! */
A:
if(!syncA->grandmasterPreferred && syncB->grandmasterPreferred)
return -1; /* B1 */
else
return 1; /* A1 */
B:
if(syncA->grandmasterPreferred && !syncB->grandmasterPreferred)
return 1; /* A1 */
else
return -1; /* B1 */
} | /* return similar to memcmp()s
note: communicationTechnology can be ignored because
if they differed they would not have made it here */ | return similar to memcmp()s
note: communicationTechnology can be ignored because
if they differed they would not have made it here | [
"return",
"similar",
"to",
"memcmp",
"()",
"s",
"note",
":",
"communicationTechnology",
"can",
"be",
"ignored",
"because",
"if",
"they",
"differed",
"they",
"would",
"not",
"have",
"made",
"it",
"here"
] | Integer8 bmcDataSetComparison(MsgHeader *headerA, MsgSync *syncA,
MsgHeader *headerB, MsgSync *syncB, PtpClock *ptpClock)
{
DBGV("bmcDataSetComparison: start\n");
if( !( syncA->grandmasterPortId == syncB->grandmasterPortId
&& !memcmp(syncA->grandmasterClockUuid, syncB->grandmasterClockUuid, PTP_UUID_LENGTH) ) )
{
if(syncA->grandmasterClockStratum < syncB->grandmasterClockStratum)
goto A;
else if(syncA->grandmasterClockStratum > syncB->grandmasterClockStratum)
goto B;
if(getIdentifierOrder(syncA->grandmasterClockIdentifier) < getIdentifierOrder(syncB->grandmasterClockIdentifier))
goto A;
if(getIdentifierOrder(syncA->grandmasterClockIdentifier) > getIdentifierOrder(syncB->grandmasterClockIdentifier))
goto B;
if(syncA->grandmasterClockStratum > 2)
{
if(syncA->grandmasterClockVariance > syncB->grandmasterClockVariance + PTP_LOG_VARIANCE_THRESHOLD
|| syncA->grandmasterClockVariance < syncB->grandmasterClockVariance - PTP_LOG_VARIANCE_THRESHOLD)
{
if(syncA->grandmasterClockVariance < syncB->grandmasterClockVariance)
goto A;
else
goto B;
}
if(!syncA->grandmasterIsBoundaryClock != !syncB->grandmasterIsBoundaryClock)
{
if(syncA->grandmasterIsBoundaryClock)
goto A;
else
goto B;
}
if(memcmp(syncA->grandmasterClockUuid, syncB->grandmasterClockUuid, PTP_UUID_LENGTH) < 0)
goto A;
else
goto B;
}
if(!syncA->grandmasterPreferred != !syncB->grandmasterPreferred)
{
if(syncA->grandmasterPreferred)
return 1;
else
return -1;
}
}
DBGV("bmcDataSetComparison: X\n");
if(syncA->localStepsRemoved > syncB->localStepsRemoved + 1
|| syncA->localStepsRemoved < syncB->localStepsRemoved -1)
{
if(syncA->localStepsRemoved < syncB->localStepsRemoved)
return 1;
else
return -1;
}
if(syncA->localStepsRemoved < syncB->localStepsRemoved)
{
DBGV("bmcDataSetComparison: A3\n");
if(memcmp(ptpClock->port_uuid_field, headerB->sourceUuid, PTP_UUID_LENGTH) < 0)
return 1;
else if(memcmp(ptpClock->port_uuid_field, headerB->sourceUuid, PTP_UUID_LENGTH) > 0)
return 2;
if(ptpClock->port_id_field < headerB->sourcePortId)
return 1;
else if(ptpClock->port_id_field > headerB->sourcePortId)
return 2;
return 0;
}
if(syncA->localStepsRemoved > syncB->localStepsRemoved)
{
DBGV("bmcDataSetComparison: B3\n");
if(memcmp(ptpClock->port_uuid_field, headerA->sourceUuid, PTP_UUID_LENGTH) < 0)
return -1;
else if(memcmp(ptpClock->port_uuid_field, headerB->sourceUuid, PTP_UUID_LENGTH) > 0)
return -2;
if(ptpClock->port_id_field < headerA->sourcePortId)
return -1;
else if(ptpClock->port_id_field > headerA->sourcePortId)
return -2;
return 0;
}
if(memcmp(headerA->sourceUuid, headerB->sourceUuid, PTP_UUID_LENGTH) < 0)
return 2;
else if(memcmp(headerA->sourceUuid, headerB->sourceUuid, PTP_UUID_LENGTH) > 0)
return -2;
DBGV("bmcDataSetComparison: Z\n");
if(syncA->grandmasterSequenceId > syncB->grandmasterSequenceId)
return 3;
else if(syncA->grandmasterSequenceId < syncB->grandmasterSequenceId)
return -3;
if(headerA->sequenceId > headerB->sequenceId)
return 3;
else if(headerA->sequenceId < headerB->sequenceId)
return -3;
return 0;
A:
if(!syncA->grandmasterPreferred && syncB->grandmasterPreferred)
return -1;
else
return 1;
B:
if(syncA->grandmasterPreferred && !syncB->grandmasterPreferred)
return 1;
else
return -1;
} | [
"Integer8",
"bmcDataSetComparison",
"(",
"MsgHeader",
"*",
"headerA",
",",
"MsgSync",
"*",
"syncA",
",",
"MsgHeader",
"*",
"headerB",
",",
"MsgSync",
"*",
"syncB",
",",
"PtpClock",
"*",
"ptpClock",
")",
"{",
"DBGV",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"!",
"(",
"syncA",
"->",
"grandmasterPortId",
"==",
"syncB",
"->",
"grandmasterPortId",
"&&",
"!",
"memcmp",
"(",
"syncA",
"->",
"grandmasterClockUuid",
",",
"syncB",
"->",
"grandmasterClockUuid",
",",
"PTP_UUID_LENGTH",
")",
")",
")",
"{",
"if",
"(",
"syncA",
"->",
"grandmasterClockStratum",
"<",
"syncB",
"->",
"grandmasterClockStratum",
")",
"goto",
"A",
";",
"else",
"if",
"(",
"syncA",
"->",
"grandmasterClockStratum",
">",
"syncB",
"->",
"grandmasterClockStratum",
")",
"goto",
"B",
";",
"if",
"(",
"getIdentifierOrder",
"(",
"syncA",
"->",
"grandmasterClockIdentifier",
")",
"<",
"getIdentifierOrder",
"(",
"syncB",
"->",
"grandmasterClockIdentifier",
")",
")",
"goto",
"A",
";",
"if",
"(",
"getIdentifierOrder",
"(",
"syncA",
"->",
"grandmasterClockIdentifier",
")",
">",
"getIdentifierOrder",
"(",
"syncB",
"->",
"grandmasterClockIdentifier",
")",
")",
"goto",
"B",
";",
"if",
"(",
"syncA",
"->",
"grandmasterClockStratum",
">",
"2",
")",
"{",
"if",
"(",
"syncA",
"->",
"grandmasterClockVariance",
">",
"syncB",
"->",
"grandmasterClockVariance",
"+",
"PTP_LOG_VARIANCE_THRESHOLD",
"||",
"syncA",
"->",
"grandmasterClockVariance",
"<",
"syncB",
"->",
"grandmasterClockVariance",
"-",
"PTP_LOG_VARIANCE_THRESHOLD",
")",
"{",
"if",
"(",
"syncA",
"->",
"grandmasterClockVariance",
"<",
"syncB",
"->",
"grandmasterClockVariance",
")",
"goto",
"A",
";",
"else",
"goto",
"B",
";",
"}",
"if",
"(",
"!",
"syncA",
"->",
"grandmasterIsBoundaryClock",
"!=",
"!",
"syncB",
"->",
"grandmasterIsBoundaryClock",
")",
"{",
"if",
"(",
"syncA",
"->",
"grandmasterIsBoundaryClock",
")",
"goto",
"A",
";",
"else",
"goto",
"B",
";",
"}",
"if",
"(",
"memcmp",
"(",
"syncA",
"->",
"grandmasterClockUuid",
",",
"syncB",
"->",
"grandmasterClockUuid",
",",
"PTP_UUID_LENGTH",
")",
"<",
"0",
")",
"goto",
"A",
";",
"else",
"goto",
"B",
";",
"}",
"if",
"(",
"!",
"syncA",
"->",
"grandmasterPreferred",
"!=",
"!",
"syncB",
"->",
"grandmasterPreferred",
")",
"{",
"if",
"(",
"syncA",
"->",
"grandmasterPreferred",
")",
"return",
"1",
";",
"else",
"return",
"-1",
";",
"}",
"}",
"DBGV",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"syncA",
"->",
"localStepsRemoved",
">",
"syncB",
"->",
"localStepsRemoved",
"+",
"1",
"||",
"syncA",
"->",
"localStepsRemoved",
"<",
"syncB",
"->",
"localStepsRemoved",
"-",
"1",
")",
"{",
"if",
"(",
"syncA",
"->",
"localStepsRemoved",
"<",
"syncB",
"->",
"localStepsRemoved",
")",
"return",
"1",
";",
"else",
"return",
"-1",
";",
"}",
"if",
"(",
"syncA",
"->",
"localStepsRemoved",
"<",
"syncB",
"->",
"localStepsRemoved",
")",
"{",
"DBGV",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"memcmp",
"(",
"ptpClock",
"->",
"port_uuid_field",
",",
"headerB",
"->",
"sourceUuid",
",",
"PTP_UUID_LENGTH",
")",
"<",
"0",
")",
"return",
"1",
";",
"else",
"if",
"(",
"memcmp",
"(",
"ptpClock",
"->",
"port_uuid_field",
",",
"headerB",
"->",
"sourceUuid",
",",
"PTP_UUID_LENGTH",
")",
">",
"0",
")",
"return",
"2",
";",
"if",
"(",
"ptpClock",
"->",
"port_id_field",
"<",
"headerB",
"->",
"sourcePortId",
")",
"return",
"1",
";",
"else",
"if",
"(",
"ptpClock",
"->",
"port_id_field",
">",
"headerB",
"->",
"sourcePortId",
")",
"return",
"2",
";",
"return",
"0",
";",
"}",
"if",
"(",
"syncA",
"->",
"localStepsRemoved",
">",
"syncB",
"->",
"localStepsRemoved",
")",
"{",
"DBGV",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"memcmp",
"(",
"ptpClock",
"->",
"port_uuid_field",
",",
"headerA",
"->",
"sourceUuid",
",",
"PTP_UUID_LENGTH",
")",
"<",
"0",
")",
"return",
"-1",
";",
"else",
"if",
"(",
"memcmp",
"(",
"ptpClock",
"->",
"port_uuid_field",
",",
"headerB",
"->",
"sourceUuid",
",",
"PTP_UUID_LENGTH",
")",
">",
"0",
")",
"return",
"-2",
";",
"if",
"(",
"ptpClock",
"->",
"port_id_field",
"<",
"headerA",
"->",
"sourcePortId",
")",
"return",
"-1",
";",
"else",
"if",
"(",
"ptpClock",
"->",
"port_id_field",
">",
"headerA",
"->",
"sourcePortId",
")",
"return",
"-2",
";",
"return",
"0",
";",
"}",
"if",
"(",
"memcmp",
"(",
"headerA",
"->",
"sourceUuid",
",",
"headerB",
"->",
"sourceUuid",
",",
"PTP_UUID_LENGTH",
")",
"<",
"0",
")",
"return",
"2",
";",
"else",
"if",
"(",
"memcmp",
"(",
"headerA",
"->",
"sourceUuid",
",",
"headerB",
"->",
"sourceUuid",
",",
"PTP_UUID_LENGTH",
")",
">",
"0",
")",
"return",
"-2",
";",
"DBGV",
"(",
"\"",
"\\n",
"\"",
")",
";",
"if",
"(",
"syncA",
"->",
"grandmasterSequenceId",
">",
"syncB",
"->",
"grandmasterSequenceId",
")",
"return",
"3",
";",
"else",
"if",
"(",
"syncA",
"->",
"grandmasterSequenceId",
"<",
"syncB",
"->",
"grandmasterSequenceId",
")",
"return",
"-3",
";",
"if",
"(",
"headerA",
"->",
"sequenceId",
">",
"headerB",
"->",
"sequenceId",
")",
"return",
"3",
";",
"else",
"if",
"(",
"headerA",
"->",
"sequenceId",
"<",
"headerB",
"->",
"sequenceId",
")",
"return",
"-3",
";",
"return",
"0",
";",
"A",
":",
"if",
"(",
"!",
"syncA",
"->",
"grandmasterPreferred",
"&&",
"syncB",
"->",
"grandmasterPreferred",
")",
"return",
"-1",
";",
"else",
"return",
"1",
";",
"B",
":",
"if",
"(",
"syncA",
"->",
"grandmasterPreferred",
"&&",
"!",
"syncB",
"->",
"grandmasterPreferred",
")",
"return",
"1",
";",
"else",
"return",
"-1",
";",
"}"
] | return similar to memcmp()s
note: communicationTechnology can be ignored because
if they differed they would not have made it here | [
"return",
"similar",
"to",
"memcmp",
"()",
"s",
"note",
":",
"communicationTechnology",
"can",
"be",
"ignored",
"because",
"if",
"they",
"differed",
"they",
"would",
"not",
"have",
"made",
"it",
"here"
] | [
"/* grandmasterClockStratums same */",
"/* grandmasterClockIdentifiers same */",
"/* grandmasterClockVariances are not similar */",
"/* grandmasterClockVariances are similar */",
"/* XOR */",
"/* neither is grandmasterIsBoundaryClock */",
"/* syncA->grandmasterClockStratum <= 2 */",
"/* XOR */",
"/* A1 */",
"/* B1 */",
"/* neither or both grandmasterPreferred */",
"/* localStepsRemoved not within 1 */",
"/* A1 */",
"/* B1 */",
"/* localStepsRemoved within 1 */",
"/* A1 */",
"/* A2 */",
"/* this port_uuid_field same as headerB->sourceUuid */",
"/* A1 */",
"/* A2 */",
"/* this port_id_field same as headerB->sourcePortId */",
"/* same */",
"/* B1 */",
"/* B2 */",
"/* this port_uuid_field same as headerA->sourceUuid */",
"/* B1 */",
"/* B2 */",
"/* this port_id_field same as headerA->sourcePortId */",
"/* same */",
"/* localStepsRemoved same */",
"/* A2 */",
"/* B2 */",
"/* sourceUuid same */",
"/* grandmasterSequenceId same */",
"/* sequenceId same */",
"/* same */",
"/* oh no, a goto label! the horror! */",
"/* B1 */",
"/* A1 */",
"/* A1 */",
"/* B1 */"
] | [
{
"param": "headerA",
"type": "MsgHeader"
},
{
"param": "syncA",
"type": "MsgSync"
},
{
"param": "headerB",
"type": "MsgHeader"
},
{
"param": "syncB",
"type": "MsgSync"
},
{
"param": "ptpClock",
"type": "PtpClock"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "headerA",
"type": "MsgHeader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "syncA",
"type": "MsgSync",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "headerB",
"type": "MsgHeader",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "syncB",
"type": "MsgSync",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ptpClock",
"type": "PtpClock",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c90126455979f906a4513056ba8d734697acc78 | junyanl-code/Luminary-Micro-Library | boot_loader/bl_i2c.c | [
"BSD-3-Clause"
] | C | I2CSend | void | void
I2CSend(const unsigned char *pucData, unsigned long ulSize)
{
//
// Transmit the number of bytes requested on the UART port.
//
while(ulSize--)
{
//
// Wait for request to come in at slave.
//
while(!(HWREG(I2C0_SLAVE_BASE + I2C_O_SCSR) & I2C_SCSR_TREQ))
{
}
//
// Send out the next byte.
//
HWREG(I2C0_SLAVE_BASE + I2C_O_SDR) = *pucData++;
}
} | //*****************************************************************************
//
//! Sends data over the I2C port.
//!
//! \param pucData is the buffer containing the data to write out to the I2C
//! port.
//! \param ulSize is the number of bytes provided in \e pucData buffer that
//! will be written out to the I2C port.
//!
//! This function sends \e ulSize bytes of data from the buffer pointed to by
//! \e pucData via the I2C port. The function will wait till the I2C Slave
//! port has been properly addressed by the I2C Master device before sending
//! the first byte.
//!
//! \return None.
//
//*****************************************************************************
| Sends data over the I2C port.
\param pucData is the buffer containing the data to write out to the I2C
port.
\param ulSize is the number of bytes provided in \e pucData buffer that
will be written out to the I2C port.
This function sends \e ulSize bytes of data from the buffer pointed to by
\e pucData via the I2C port. The function will wait till the I2C Slave
port has been properly addressed by the I2C Master device before sending
the first byte.
\return None. | [
"Sends",
"data",
"over",
"the",
"I2C",
"port",
".",
"\\",
"param",
"pucData",
"is",
"the",
"buffer",
"containing",
"the",
"data",
"to",
"write",
"out",
"to",
"the",
"I2C",
"port",
".",
"\\",
"param",
"ulSize",
"is",
"the",
"number",
"of",
"bytes",
"provided",
"in",
"\\",
"e",
"pucData",
"buffer",
"that",
"will",
"be",
"written",
"out",
"to",
"the",
"I2C",
"port",
".",
"This",
"function",
"sends",
"\\",
"e",
"ulSize",
"bytes",
"of",
"data",
"from",
"the",
"buffer",
"pointed",
"to",
"by",
"\\",
"e",
"pucData",
"via",
"the",
"I2C",
"port",
".",
"The",
"function",
"will",
"wait",
"till",
"the",
"I2C",
"Slave",
"port",
"has",
"been",
"properly",
"addressed",
"by",
"the",
"I2C",
"Master",
"device",
"before",
"sending",
"the",
"first",
"byte",
".",
"\\",
"return",
"None",
"."
] | void
I2CSend(const unsigned char *pucData, unsigned long ulSize)
{
while(ulSize--)
{
while(!(HWREG(I2C0_SLAVE_BASE + I2C_O_SCSR) & I2C_SCSR_TREQ))
{
}
HWREG(I2C0_SLAVE_BASE + I2C_O_SDR) = *pucData++;
}
} | [
"void",
"I2CSend",
"(",
"const",
"unsigned",
"char",
"*",
"pucData",
",",
"unsigned",
"long",
"ulSize",
")",
"{",
"while",
"(",
"ulSize",
"--",
")",
"{",
"while",
"(",
"!",
"(",
"HWREG",
"(",
"I2C0_SLAVE_BASE",
"+",
"I2C_O_SCSR",
")",
"&",
"I2C_SCSR_TREQ",
")",
")",
"{",
"}",
"HWREG",
"(",
"I2C0_SLAVE_BASE",
"+",
"I2C_O_SDR",
")",
"=",
"*",
"pucData",
"++",
";",
"}",
"}"
] | Sends data over the I2C port. | [
"Sends",
"data",
"over",
"the",
"I2C",
"port",
"."
] | [
"//\r",
"// Transmit the number of bytes requested on the UART port.\r",
"//\r",
"//\r",
"// Wait for request to come in at slave.\r",
"//\r",
"//\r",
"// Send out the next byte.\r",
"//\r"
] | [
{
"param": "pucData",
"type": "unsigned char"
},
{
"param": "ulSize",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pucData",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulSize",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
1c90126455979f906a4513056ba8d734697acc78 | junyanl-code/Luminary-Micro-Library | boot_loader/bl_i2c.c | [
"BSD-3-Clause"
] | C | I2CFlush | void | void
I2CFlush(void)
{
//
// Wait until the I2C bus is no longer busy, meaning that the last byte has
// been sent.
//
while(HWREG(I2C0_MASTER_BASE + I2C_O_MCS) & I2C_MCS_BUSBSY)
{
}
} | //*****************************************************************************
//
//! Waits until all data has been transmitted by the I2C port.
//!
//! This function waits until all data written to the I2C port has been read by
//! the master.
//!
//! \return None.
//
//*****************************************************************************
| Waits until all data has been transmitted by the I2C port.
This function waits until all data written to the I2C port has been read by
the master.
\return None. | [
"Waits",
"until",
"all",
"data",
"has",
"been",
"transmitted",
"by",
"the",
"I2C",
"port",
".",
"This",
"function",
"waits",
"until",
"all",
"data",
"written",
"to",
"the",
"I2C",
"port",
"has",
"been",
"read",
"by",
"the",
"master",
".",
"\\",
"return",
"None",
"."
] | void
I2CFlush(void)
{
while(HWREG(I2C0_MASTER_BASE + I2C_O_MCS) & I2C_MCS_BUSBSY)
{
}
} | [
"void",
"I2CFlush",
"(",
"void",
")",
"{",
"while",
"(",
"HWREG",
"(",
"I2C0_MASTER_BASE",
"+",
"I2C_O_MCS",
")",
"&",
"I2C_MCS_BUSBSY",
")",
"{",
"}",
"}"
] | Waits until all data has been transmitted by the I2C port. | [
"Waits",
"until",
"all",
"data",
"has",
"been",
"transmitted",
"by",
"the",
"I2C",
"port",
"."
] | [
"//\r",
"// Wait until the I2C bus is no longer busy, meaning that the last byte has\r",
"// been sent.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
1c90126455979f906a4513056ba8d734697acc78 | junyanl-code/Luminary-Micro-Library | boot_loader/bl_i2c.c | [
"BSD-3-Clause"
] | C | I2CReceive | void | void
I2CReceive(unsigned char *pucData, unsigned long ulSize)
{
//
// Send out the number of bytes requested.
//
while(ulSize--)
{
//
// Wait until the slave has received the character.
//
while(!(HWREG(I2C0_SLAVE_BASE + I2C_O_SCSR) & I2C_SCSR_RREQ))
{
}
//
// Receive a byte from the I2C.
//
*pucData++ = HWREG(I2C0_SLAVE_BASE + I2C_O_SDR);
}
} | //*****************************************************************************
//
//! Receives data over the I2C port.
//!
//! \param pucData is the buffer to read data into from the I2C port.
//! \param ulSize is the number of bytes provided in the \e pucData buffer that
//! should be written with data from the I2C port.
//!
//! This function reads back \e ulSize bytes of data from the I2C port, into
//! the buffer that is pointed to by \e pucData. This function will not return
//! until \e ulSize number of bytes have been received. This function will
//! wait till the I2C Slave port has been properly addressed by the I2C Master
//! before reading the first byte of data from the I2C port.
//!
//! \return None.
//
//*****************************************************************************
| Receives data over the I2C port.
\param pucData is the buffer to read data into from the I2C port.
\param ulSize is the number of bytes provided in the \e pucData buffer that
should be written with data from the I2C port.
This function reads back \e ulSize bytes of data from the I2C port, into
the buffer that is pointed to by \e pucData. This function will not return
until \e ulSize number of bytes have been received. This function will
wait till the I2C Slave port has been properly addressed by the I2C Master
before reading the first byte of data from the I2C port.
\return None. | [
"Receives",
"data",
"over",
"the",
"I2C",
"port",
".",
"\\",
"param",
"pucData",
"is",
"the",
"buffer",
"to",
"read",
"data",
"into",
"from",
"the",
"I2C",
"port",
".",
"\\",
"param",
"ulSize",
"is",
"the",
"number",
"of",
"bytes",
"provided",
"in",
"the",
"\\",
"e",
"pucData",
"buffer",
"that",
"should",
"be",
"written",
"with",
"data",
"from",
"the",
"I2C",
"port",
".",
"This",
"function",
"reads",
"back",
"\\",
"e",
"ulSize",
"bytes",
"of",
"data",
"from",
"the",
"I2C",
"port",
"into",
"the",
"buffer",
"that",
"is",
"pointed",
"to",
"by",
"\\",
"e",
"pucData",
".",
"This",
"function",
"will",
"not",
"return",
"until",
"\\",
"e",
"ulSize",
"number",
"of",
"bytes",
"have",
"been",
"received",
".",
"This",
"function",
"will",
"wait",
"till",
"the",
"I2C",
"Slave",
"port",
"has",
"been",
"properly",
"addressed",
"by",
"the",
"I2C",
"Master",
"before",
"reading",
"the",
"first",
"byte",
"of",
"data",
"from",
"the",
"I2C",
"port",
".",
"\\",
"return",
"None",
"."
] | void
I2CReceive(unsigned char *pucData, unsigned long ulSize)
{
while(ulSize--)
{
while(!(HWREG(I2C0_SLAVE_BASE + I2C_O_SCSR) & I2C_SCSR_RREQ))
{
}
*pucData++ = HWREG(I2C0_SLAVE_BASE + I2C_O_SDR);
}
} | [
"void",
"I2CReceive",
"(",
"unsigned",
"char",
"*",
"pucData",
",",
"unsigned",
"long",
"ulSize",
")",
"{",
"while",
"(",
"ulSize",
"--",
")",
"{",
"while",
"(",
"!",
"(",
"HWREG",
"(",
"I2C0_SLAVE_BASE",
"+",
"I2C_O_SCSR",
")",
"&",
"I2C_SCSR_RREQ",
")",
")",
"{",
"}",
"*",
"pucData",
"++",
"=",
"HWREG",
"(",
"I2C0_SLAVE_BASE",
"+",
"I2C_O_SDR",
")",
";",
"}",
"}"
] | Receives data over the I2C port. | [
"Receives",
"data",
"over",
"the",
"I2C",
"port",
"."
] | [
"//\r",
"// Send out the number of bytes requested.\r",
"//\r",
"//\r",
"// Wait until the slave has received the character.\r",
"//\r",
"//\r",
"// Receive a byte from the I2C.\r",
"//\r"
] | [
{
"param": "pucData",
"type": "unsigned char"
},
{
"param": "ulSize",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pucData",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulSize",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a98f423bfed2b29c93e61bbd8b5aa5367aaaea23 | junyanl-code/Luminary-Micro-Library | grlib/rectangle.c | [
"BSD-3-Clause"
] | C | GrRectDraw | void | void
GrRectDraw(const tContext *pContext, const tRectangle *pRect)
{
//
// Check the arguments.
//
ASSERT(pContext);
ASSERT(pRect);
//
// Draw a line across the top of the rectangle.
//
GrLineDrawH(pContext, pRect->sXMin, pRect->sXMax, pRect->sYMin);
//
// Return if the rectangle is one pixel tall.
//
if(pRect->sYMin == pRect->sYMax)
{
return;
}
//
// Draw a line down the right side of the rectangle.
//
GrLineDrawV(pContext, pRect->sXMax, pRect->sYMin + 1, pRect->sYMax);
//
// Return if the rectangle is one pixel wide.
//
if(pRect->sXMin == pRect->sXMax)
{
return;
}
//
// Draw a line across the bottom of the rectangle.
//
GrLineDrawH(pContext, pRect->sXMax - 1, pRect->sXMin, pRect->sYMax);
//
// Return if the rectangle is two pixels tall.
//
if((pRect->sYMin + 1) == pRect->sYMax)
{
return;
}
//
// Draw a line up the left side of the rectangle.
//
GrLineDrawV(pContext, pRect->sXMin, pRect->sYMax - 1, pRect->sYMin + 1);
} | //*****************************************************************************
//
//! Draws a rectangle.
//!
//! \param pContext is a pointer to the drawing context to use.
//! \param pRect is a pointer to the structure containing the extents of the
//! rectangle.
//!
//! This function draws a rectangle. The rectangle will extend from \e lXMin
//! to \e lXMax and \e lYMin to \e lYMax, inclusive.
//!
//! \return None.
//
//*****************************************************************************
| Draws a rectangle.
\param pContext is a pointer to the drawing context to use.
\param pRect is a pointer to the structure containing the extents of the
rectangle.
This function draws a rectangle. The rectangle will extend from \e lXMin
to \e lXMax and \e lYMin to \e lYMax, inclusive.
\return None. | [
"Draws",
"a",
"rectangle",
".",
"\\",
"param",
"pContext",
"is",
"a",
"pointer",
"to",
"the",
"drawing",
"context",
"to",
"use",
".",
"\\",
"param",
"pRect",
"is",
"a",
"pointer",
"to",
"the",
"structure",
"containing",
"the",
"extents",
"of",
"the",
"rectangle",
".",
"This",
"function",
"draws",
"a",
"rectangle",
".",
"The",
"rectangle",
"will",
"extend",
"from",
"\\",
"e",
"lXMin",
"to",
"\\",
"e",
"lXMax",
"and",
"\\",
"e",
"lYMin",
"to",
"\\",
"e",
"lYMax",
"inclusive",
".",
"\\",
"return",
"None",
"."
] | void
GrRectDraw(const tContext *pContext, const tRectangle *pRect)
{
ASSERT(pContext);
ASSERT(pRect);
GrLineDrawH(pContext, pRect->sXMin, pRect->sXMax, pRect->sYMin);
if(pRect->sYMin == pRect->sYMax)
{
return;
}
GrLineDrawV(pContext, pRect->sXMax, pRect->sYMin + 1, pRect->sYMax);
if(pRect->sXMin == pRect->sXMax)
{
return;
}
GrLineDrawH(pContext, pRect->sXMax - 1, pRect->sXMin, pRect->sYMax);
if((pRect->sYMin + 1) == pRect->sYMax)
{
return;
}
GrLineDrawV(pContext, pRect->sXMin, pRect->sYMax - 1, pRect->sYMin + 1);
} | [
"void",
"GrRectDraw",
"(",
"const",
"tContext",
"*",
"pContext",
",",
"const",
"tRectangle",
"*",
"pRect",
")",
"{",
"ASSERT",
"(",
"pContext",
")",
";",
"ASSERT",
"(",
"pRect",
")",
";",
"GrLineDrawH",
"(",
"pContext",
",",
"pRect",
"->",
"sXMin",
",",
"pRect",
"->",
"sXMax",
",",
"pRect",
"->",
"sYMin",
")",
";",
"if",
"(",
"pRect",
"->",
"sYMin",
"==",
"pRect",
"->",
"sYMax",
")",
"{",
"return",
";",
"}",
"GrLineDrawV",
"(",
"pContext",
",",
"pRect",
"->",
"sXMax",
",",
"pRect",
"->",
"sYMin",
"+",
"1",
",",
"pRect",
"->",
"sYMax",
")",
";",
"if",
"(",
"pRect",
"->",
"sXMin",
"==",
"pRect",
"->",
"sXMax",
")",
"{",
"return",
";",
"}",
"GrLineDrawH",
"(",
"pContext",
",",
"pRect",
"->",
"sXMax",
"-",
"1",
",",
"pRect",
"->",
"sXMin",
",",
"pRect",
"->",
"sYMax",
")",
";",
"if",
"(",
"(",
"pRect",
"->",
"sYMin",
"+",
"1",
")",
"==",
"pRect",
"->",
"sYMax",
")",
"{",
"return",
";",
"}",
"GrLineDrawV",
"(",
"pContext",
",",
"pRect",
"->",
"sXMin",
",",
"pRect",
"->",
"sYMax",
"-",
"1",
",",
"pRect",
"->",
"sYMin",
"+",
"1",
")",
";",
"}"
] | Draws a rectangle. | [
"Draws",
"a",
"rectangle",
"."
] | [
"//\r",
"// Check the arguments.\r",
"//\r",
"//\r",
"// Draw a line across the top of the rectangle.\r",
"//\r",
"//\r",
"// Return if the rectangle is one pixel tall.\r",
"//\r",
"//\r",
"// Draw a line down the right side of the rectangle.\r",
"//\r",
"//\r",
"// Return if the rectangle is one pixel wide.\r",
"//\r",
"//\r",
"// Draw a line across the bottom of the rectangle.\r",
"//\r",
"//\r",
"// Return if the rectangle is two pixels tall.\r",
"//\r",
"//\r",
"// Draw a line up the left side of the rectangle.\r",
"//\r"
] | [
{
"param": "pContext",
"type": "tContext"
},
{
"param": "pRect",
"type": "tRectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pContext",
"type": "tContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pRect",
"type": "tRectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a98f423bfed2b29c93e61bbd8b5aa5367aaaea23 | junyanl-code/Luminary-Micro-Library | grlib/rectangle.c | [
"BSD-3-Clause"
] | C | GrRectFill | void | void
GrRectFill(const tContext *pContext, const tRectangle *pRect)
{
tRectangle sTemp;
//
// Check the arguments.
//
ASSERT(pContext);
ASSERT(pRect);
//
// Swap the X coordinates if sXMin is greater than sXMax.
//
if(pRect->sXMin > pRect->sXMax)
{
sTemp.sXMin = pRect->sXMax;
sTemp.sXMax = pRect->sXMin;
}
else
{
sTemp.sXMin = pRect->sXMin;
sTemp.sXMax = pRect->sXMax;
}
//
// Swap the Y coordinates if sYMin is greater than sYMax.
//
if(pRect->sYMin > pRect->sYMax)
{
sTemp.sYMin = pRect->sYMax;
sTemp.sYMax = pRect->sYMin;
}
else
{
sTemp.sYMin = pRect->sYMin;
sTemp.sYMax = pRect->sYMax;
}
//
// Now that the coordinates are ordered, return without drawing anything if
// the entire rectangle is out of the clipping region.
//
if((sTemp.sXMin > pContext->sClipRegion.sXMax) ||
(sTemp.sXMax < pContext->sClipRegion.sXMin) ||
(sTemp.sYMin > pContext->sClipRegion.sYMax) ||
(sTemp.sYMax < pContext->sClipRegion.sYMin))
{
return;
}
//
// Clip the X coordinates to the edges of the clipping region if necessary.
//
if(sTemp.sXMin < pContext->sClipRegion.sXMin)
{
sTemp.sXMin = pContext->sClipRegion.sXMin;
}
if(sTemp.sXMax > pContext->sClipRegion.sXMax)
{
sTemp.sXMax = pContext->sClipRegion.sXMax;
}
//
// Clip the Y coordinates to the edges of the clipping region if necessary.
//
if(sTemp.sYMin < pContext->sClipRegion.sYMin)
{
sTemp.sYMin = pContext->sClipRegion.sYMin;
}
if(sTemp.sYMax > pContext->sClipRegion.sYMax)
{
sTemp.sYMax = pContext->sClipRegion.sYMax;
}
//
// Call the low level rectangle fill routine.
//
DpyRectFill(pContext->pDisplay, &sTemp, pContext->ulForeground);
} | //*****************************************************************************
//
//! Draws a filled rectangle.
//!
//! \param pContext is a pointer to the drawing context to use.
//! \param pRect is a pointer to the structure containing the extents of the
//! rectangle.
//!
//! This function draws a filled rectangle. The rectangle will extend from
//! \e lXMin to \e lXMax and \e lYMin to \e lYMax, inclusive. The clipping of
//! the rectangle to the clipping rectangle is performed within this routine;
//! the display driver's rectangle fill routine is used to perform the actual
//! rectangle fill.
//!
//! \return None.
//
//*****************************************************************************
| Draws a filled rectangle.
\param pContext is a pointer to the drawing context to use.
\param pRect is a pointer to the structure containing the extents of the
rectangle.
This function draws a filled rectangle. The rectangle will extend from
\e lXMin to \e lXMax and \e lYMin to \e lYMax, inclusive. The clipping of
the rectangle to the clipping rectangle is performed within this routine;
the display driver's rectangle fill routine is used to perform the actual
rectangle fill.
\return None. | [
"Draws",
"a",
"filled",
"rectangle",
".",
"\\",
"param",
"pContext",
"is",
"a",
"pointer",
"to",
"the",
"drawing",
"context",
"to",
"use",
".",
"\\",
"param",
"pRect",
"is",
"a",
"pointer",
"to",
"the",
"structure",
"containing",
"the",
"extents",
"of",
"the",
"rectangle",
".",
"This",
"function",
"draws",
"a",
"filled",
"rectangle",
".",
"The",
"rectangle",
"will",
"extend",
"from",
"\\",
"e",
"lXMin",
"to",
"\\",
"e",
"lXMax",
"and",
"\\",
"e",
"lYMin",
"to",
"\\",
"e",
"lYMax",
"inclusive",
".",
"The",
"clipping",
"of",
"the",
"rectangle",
"to",
"the",
"clipping",
"rectangle",
"is",
"performed",
"within",
"this",
"routine",
";",
"the",
"display",
"driver",
"'",
"s",
"rectangle",
"fill",
"routine",
"is",
"used",
"to",
"perform",
"the",
"actual",
"rectangle",
"fill",
".",
"\\",
"return",
"None",
"."
] | void
GrRectFill(const tContext *pContext, const tRectangle *pRect)
{
tRectangle sTemp;
ASSERT(pContext);
ASSERT(pRect);
if(pRect->sXMin > pRect->sXMax)
{
sTemp.sXMin = pRect->sXMax;
sTemp.sXMax = pRect->sXMin;
}
else
{
sTemp.sXMin = pRect->sXMin;
sTemp.sXMax = pRect->sXMax;
}
if(pRect->sYMin > pRect->sYMax)
{
sTemp.sYMin = pRect->sYMax;
sTemp.sYMax = pRect->sYMin;
}
else
{
sTemp.sYMin = pRect->sYMin;
sTemp.sYMax = pRect->sYMax;
}
if((sTemp.sXMin > pContext->sClipRegion.sXMax) ||
(sTemp.sXMax < pContext->sClipRegion.sXMin) ||
(sTemp.sYMin > pContext->sClipRegion.sYMax) ||
(sTemp.sYMax < pContext->sClipRegion.sYMin))
{
return;
}
if(sTemp.sXMin < pContext->sClipRegion.sXMin)
{
sTemp.sXMin = pContext->sClipRegion.sXMin;
}
if(sTemp.sXMax > pContext->sClipRegion.sXMax)
{
sTemp.sXMax = pContext->sClipRegion.sXMax;
}
if(sTemp.sYMin < pContext->sClipRegion.sYMin)
{
sTemp.sYMin = pContext->sClipRegion.sYMin;
}
if(sTemp.sYMax > pContext->sClipRegion.sYMax)
{
sTemp.sYMax = pContext->sClipRegion.sYMax;
}
DpyRectFill(pContext->pDisplay, &sTemp, pContext->ulForeground);
} | [
"void",
"GrRectFill",
"(",
"const",
"tContext",
"*",
"pContext",
",",
"const",
"tRectangle",
"*",
"pRect",
")",
"{",
"tRectangle",
"sTemp",
";",
"ASSERT",
"(",
"pContext",
")",
";",
"ASSERT",
"(",
"pRect",
")",
";",
"if",
"(",
"pRect",
"->",
"sXMin",
">",
"pRect",
"->",
"sXMax",
")",
"{",
"sTemp",
".",
"sXMin",
"=",
"pRect",
"->",
"sXMax",
";",
"sTemp",
".",
"sXMax",
"=",
"pRect",
"->",
"sXMin",
";",
"}",
"else",
"{",
"sTemp",
".",
"sXMin",
"=",
"pRect",
"->",
"sXMin",
";",
"sTemp",
".",
"sXMax",
"=",
"pRect",
"->",
"sXMax",
";",
"}",
"if",
"(",
"pRect",
"->",
"sYMin",
">",
"pRect",
"->",
"sYMax",
")",
"{",
"sTemp",
".",
"sYMin",
"=",
"pRect",
"->",
"sYMax",
";",
"sTemp",
".",
"sYMax",
"=",
"pRect",
"->",
"sYMin",
";",
"}",
"else",
"{",
"sTemp",
".",
"sYMin",
"=",
"pRect",
"->",
"sYMin",
";",
"sTemp",
".",
"sYMax",
"=",
"pRect",
"->",
"sYMax",
";",
"}",
"if",
"(",
"(",
"sTemp",
".",
"sXMin",
">",
"pContext",
"->",
"sClipRegion",
".",
"sXMax",
")",
"||",
"(",
"sTemp",
".",
"sXMax",
"<",
"pContext",
"->",
"sClipRegion",
".",
"sXMin",
")",
"||",
"(",
"sTemp",
".",
"sYMin",
">",
"pContext",
"->",
"sClipRegion",
".",
"sYMax",
")",
"||",
"(",
"sTemp",
".",
"sYMax",
"<",
"pContext",
"->",
"sClipRegion",
".",
"sYMin",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"sTemp",
".",
"sXMin",
"<",
"pContext",
"->",
"sClipRegion",
".",
"sXMin",
")",
"{",
"sTemp",
".",
"sXMin",
"=",
"pContext",
"->",
"sClipRegion",
".",
"sXMin",
";",
"}",
"if",
"(",
"sTemp",
".",
"sXMax",
">",
"pContext",
"->",
"sClipRegion",
".",
"sXMax",
")",
"{",
"sTemp",
".",
"sXMax",
"=",
"pContext",
"->",
"sClipRegion",
".",
"sXMax",
";",
"}",
"if",
"(",
"sTemp",
".",
"sYMin",
"<",
"pContext",
"->",
"sClipRegion",
".",
"sYMin",
")",
"{",
"sTemp",
".",
"sYMin",
"=",
"pContext",
"->",
"sClipRegion",
".",
"sYMin",
";",
"}",
"if",
"(",
"sTemp",
".",
"sYMax",
">",
"pContext",
"->",
"sClipRegion",
".",
"sYMax",
")",
"{",
"sTemp",
".",
"sYMax",
"=",
"pContext",
"->",
"sClipRegion",
".",
"sYMax",
";",
"}",
"DpyRectFill",
"(",
"pContext",
"->",
"pDisplay",
",",
"&",
"sTemp",
",",
"pContext",
"->",
"ulForeground",
")",
";",
"}"
] | Draws a filled rectangle. | [
"Draws",
"a",
"filled",
"rectangle",
"."
] | [
"//\r",
"// Check the arguments.\r",
"//\r",
"//\r",
"// Swap the X coordinates if sXMin is greater than sXMax.\r",
"//\r",
"//\r",
"// Swap the Y coordinates if sYMin is greater than sYMax.\r",
"//\r",
"//\r",
"// Now that the coordinates are ordered, return without drawing anything if\r",
"// the entire rectangle is out of the clipping region.\r",
"//\r",
"//\r",
"// Clip the X coordinates to the edges of the clipping region if necessary.\r",
"//\r",
"//\r",
"// Clip the Y coordinates to the edges of the clipping region if necessary.\r",
"//\r",
"//\r",
"// Call the low level rectangle fill routine.\r",
"//\r"
] | [
{
"param": "pContext",
"type": "tContext"
},
{
"param": "pRect",
"type": "tRectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pContext",
"type": "tContext",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pRect",
"type": "tRectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
a98f423bfed2b29c93e61bbd8b5aa5367aaaea23 | junyanl-code/Luminary-Micro-Library | grlib/rectangle.c | [
"BSD-3-Clause"
] | C | GrRectIntersectGet | null | long
GrRectIntersectGet(tRectangle *psRect1, tRectangle *psRect2,
tRectangle *psIntersect)
{
//
// Make sure we were passed valid rectangles.
//
if((psRect1->sXMax <= psRect1->sXMin) ||
(psRect1->sYMax <= psRect1->sYMin) ||
(psRect2->sXMax <= psRect2->sXMin) ||
(psRect2->sYMax <= psRect2->sYMin))
{
return(0);
}
//
// Make sure that there is an intersection between the two rectangles.
//
if(!GrRectOverlapCheck(psRect1, psRect2))
{
return(0);
}
//
// The rectangles do intersect so determine the rectangle of the
// intersection.
//
psIntersect->sXMin = max(psRect1->sXMin, psRect2->sXMin);
psIntersect->sXMax = min(psRect1->sXMax, psRect2->sXMax);
psIntersect->sYMin = max(psRect1->sYMin, psRect2->sYMin);
psIntersect->sYMax = min(psRect1->sYMax, psRect2->sYMax);
return(1);
} | //*****************************************************************************
//
//! Determines the intersection of two rectangles.
//!
//! \param psRect1 is a pointer to the first rectangle.
//! \param psRect2 is a pointer to the second rectangle.
//! \param psIntersect is a pointer to a rectangle which will be written with
//! the intersection of \e psRect1 and \e psRect2.
//!
//! This function determines if two rectangles overlap and, if they do,
//! calculates the rectangle representing their intersection. If the rectangles
//! do not overlap, 0 is returned and \e psIntersect is not written.
//!
//! \return Returns 1 if there is an overlap or 0 if not.
//
//*****************************************************************************
| Determines the intersection of two rectangles.
\param psRect1 is a pointer to the first rectangle.
\param psRect2 is a pointer to the second rectangle.
\param psIntersect is a pointer to a rectangle which will be written with
the intersection of \e psRect1 and \e psRect2.
This function determines if two rectangles overlap and, if they do,
calculates the rectangle representing their intersection. If the rectangles
do not overlap, 0 is returned and \e psIntersect is not written.
\return Returns 1 if there is an overlap or 0 if not. | [
"Determines",
"the",
"intersection",
"of",
"two",
"rectangles",
".",
"\\",
"param",
"psRect1",
"is",
"a",
"pointer",
"to",
"the",
"first",
"rectangle",
".",
"\\",
"param",
"psRect2",
"is",
"a",
"pointer",
"to",
"the",
"second",
"rectangle",
".",
"\\",
"param",
"psIntersect",
"is",
"a",
"pointer",
"to",
"a",
"rectangle",
"which",
"will",
"be",
"written",
"with",
"the",
"intersection",
"of",
"\\",
"e",
"psRect1",
"and",
"\\",
"e",
"psRect2",
".",
"This",
"function",
"determines",
"if",
"two",
"rectangles",
"overlap",
"and",
"if",
"they",
"do",
"calculates",
"the",
"rectangle",
"representing",
"their",
"intersection",
".",
"If",
"the",
"rectangles",
"do",
"not",
"overlap",
"0",
"is",
"returned",
"and",
"\\",
"e",
"psIntersect",
"is",
"not",
"written",
".",
"\\",
"return",
"Returns",
"1",
"if",
"there",
"is",
"an",
"overlap",
"or",
"0",
"if",
"not",
"."
] | long
GrRectIntersectGet(tRectangle *psRect1, tRectangle *psRect2,
tRectangle *psIntersect)
{
if((psRect1->sXMax <= psRect1->sXMin) ||
(psRect1->sYMax <= psRect1->sYMin) ||
(psRect2->sXMax <= psRect2->sXMin) ||
(psRect2->sYMax <= psRect2->sYMin))
{
return(0);
}
if(!GrRectOverlapCheck(psRect1, psRect2))
{
return(0);
}
psIntersect->sXMin = max(psRect1->sXMin, psRect2->sXMin);
psIntersect->sXMax = min(psRect1->sXMax, psRect2->sXMax);
psIntersect->sYMin = max(psRect1->sYMin, psRect2->sYMin);
psIntersect->sYMax = min(psRect1->sYMax, psRect2->sYMax);
return(1);
} | [
"long",
"GrRectIntersectGet",
"(",
"tRectangle",
"*",
"psRect1",
",",
"tRectangle",
"*",
"psRect2",
",",
"tRectangle",
"*",
"psIntersect",
")",
"{",
"if",
"(",
"(",
"psRect1",
"->",
"sXMax",
"<=",
"psRect1",
"->",
"sXMin",
")",
"||",
"(",
"psRect1",
"->",
"sYMax",
"<=",
"psRect1",
"->",
"sYMin",
")",
"||",
"(",
"psRect2",
"->",
"sXMax",
"<=",
"psRect2",
"->",
"sXMin",
")",
"||",
"(",
"psRect2",
"->",
"sYMax",
"<=",
"psRect2",
"->",
"sYMin",
")",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"if",
"(",
"!",
"GrRectOverlapCheck",
"(",
"psRect1",
",",
"psRect2",
")",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"psIntersect",
"->",
"sXMin",
"=",
"max",
"(",
"psRect1",
"->",
"sXMin",
",",
"psRect2",
"->",
"sXMin",
")",
";",
"psIntersect",
"->",
"sXMax",
"=",
"min",
"(",
"psRect1",
"->",
"sXMax",
",",
"psRect2",
"->",
"sXMax",
")",
";",
"psIntersect",
"->",
"sYMin",
"=",
"max",
"(",
"psRect1",
"->",
"sYMin",
",",
"psRect2",
"->",
"sYMin",
")",
";",
"psIntersect",
"->",
"sYMax",
"=",
"min",
"(",
"psRect1",
"->",
"sYMax",
",",
"psRect2",
"->",
"sYMax",
")",
";",
"return",
"(",
"1",
")",
";",
"}"
] | Determines the intersection of two rectangles. | [
"Determines",
"the",
"intersection",
"of",
"two",
"rectangles",
"."
] | [
"//\r",
"// Make sure we were passed valid rectangles.\r",
"//\r",
"//\r",
"// Make sure that there is an intersection between the two rectangles.\r",
"//\r",
"//\r",
"// The rectangles do intersect so determine the rectangle of the\r",
"// intersection.\r",
"//\r"
] | [
{
"param": "psRect1",
"type": "tRectangle"
},
{
"param": "psRect2",
"type": "tRectangle"
},
{
"param": "psIntersect",
"type": "tRectangle"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "psRect1",
"type": "tRectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "psRect2",
"type": "tRectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "psIntersect",
"type": "tRectangle",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55560f4248397a58311b31441df35ab1d3b047e8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s1968/drivers/rit128x96x4.c | [
"BSD-3-Clause"
] | C | RIT128x96x4StringDraw | void | void
RIT128x96x4StringDraw(const char *pcStr, unsigned long ulX,
unsigned long ulY, unsigned char ucLevel)
{
unsigned long ulIdx1, ulIdx2;
unsigned char ucTemp;
//
// Check the arguments.
//
ASSERT(ulX < 128);
ASSERT((ulX & 1) == 0);
ASSERT(ulY < 96);
ASSERT(ucLevel < 16);
//
// Setup a window starting at the specified column and row, ending
// at the right edge of the display and 8 rows down (single character row).
//
g_pucBuffer[0] = 0x15;
g_pucBuffer[1] = ulX / 2;
g_pucBuffer[2] = 63;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = ulY;
g_pucBuffer[2] = ulY + 7;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4VerticalInc,
sizeof(g_pucRIT128x96x4VerticalInc));
//
// Loop while there are more characters in the string.
//
while(*pcStr != 0)
{
//
// Get a working copy of the current character and convert to an
// index into the character bit-map array.
//
ucTemp = *pcStr++ & 0x7f;
if(ucTemp < ' ')
{
ucTemp = 0;
}
else
{
ucTemp -= ' ';
}
//
// Build and display the character buffer.
//
for(ulIdx1 = 0; ulIdx1 < 6; ulIdx1 += 2)
{
//
// Convert two columns of 1-bit font data into a single data
// byte column of 4-bit font data.
//
for(ulIdx2 = 0; ulIdx2 < 8; ulIdx2++)
{
g_pucBuffer[ulIdx2] = 0;
if(g_pucFont[ucTemp][ulIdx1] & (1 << ulIdx2))
{
g_pucBuffer[ulIdx2] = (ucLevel << 4) & 0xf0;
}
if((ulIdx1 < 4) &&
(g_pucFont[ucTemp][ulIdx1 + 1] & (1 << ulIdx2)))
{
g_pucBuffer[ulIdx2] |= (ucLevel << 0) & 0x0f;
}
}
//
// Send this byte column to the display.
//
RITWriteData(g_pucBuffer, 8);
ulX += 2;
//
// Return if the right side of the display has been reached.
//
if(ulX == 128)
{
return;
}
}
}
} | //*****************************************************************************
//
//! Displays a string on the OLED display.
//!
//! \param pcStr is a pointer to the string to display.
//! \param ulX is the horizontal position to display the string, specified in
//! columns from the left edge of the display.
//! \param ulY is the vertical position to display the string, specified in
//! rows from the top edge of the display.
//! \param ucLevel is the 4-bit gray scale value to be used for displayed text.
//!
//! This function will draw a string on the display. Only the ASCII characters
//! between 32 (space) and 126 (tilde) are supported; other characters will
//! result in random data being draw on the display (based on whatever appears
//! before/after the font in memory). The font is mono-spaced, so characters
//! such as ``i'' and ``l'' have more white space around them than characters
//! such as ``m'' or ``w''.
//!
//! If the drawing of the string reaches the right edge of the display, no more
//! characters will be drawn. Therefore, special care is not required to avoid
//! supplying a string that is ``too long'' to display.
//!
//! \note Because the OLED display packs 2 pixels of data in a single byte, the
//! parameter \e ulX must be an even column number (for example, 0, 2, 4, and
//! so on).
//!
//! \return None.
//
//*****************************************************************************
| Displays a string on the OLED display.
\param pcStr is a pointer to the string to display.
\param ulX is the horizontal position to display the string, specified in
columns from the left edge of the display.
\param ulY is the vertical position to display the string, specified in
rows from the top edge of the display.
\param ucLevel is the 4-bit gray scale value to be used for displayed text.
This function will draw a string on the display. Only the ASCII characters
between 32 (space) and 126 (tilde) are supported; other characters will
result in random data being draw on the display (based on whatever appears
before/after the font in memory).
If the drawing of the string reaches the right edge of the display, no more
characters will be drawn. Therefore, special care is not required to avoid
supplying a string that is ``too long'' to display.
\note Because the OLED display packs 2 pixels of data in a single byte, the
parameter \e ulX must be an even column number (for example, 0, 2, 4, and
so on).
\return None. | [
"Displays",
"a",
"string",
"on",
"the",
"OLED",
"display",
".",
"\\",
"param",
"pcStr",
"is",
"a",
"pointer",
"to",
"the",
"string",
"to",
"display",
".",
"\\",
"param",
"ulX",
"is",
"the",
"horizontal",
"position",
"to",
"display",
"the",
"string",
"specified",
"in",
"columns",
"from",
"the",
"left",
"edge",
"of",
"the",
"display",
".",
"\\",
"param",
"ulY",
"is",
"the",
"vertical",
"position",
"to",
"display",
"the",
"string",
"specified",
"in",
"rows",
"from",
"the",
"top",
"edge",
"of",
"the",
"display",
".",
"\\",
"param",
"ucLevel",
"is",
"the",
"4",
"-",
"bit",
"gray",
"scale",
"value",
"to",
"be",
"used",
"for",
"displayed",
"text",
".",
"This",
"function",
"will",
"draw",
"a",
"string",
"on",
"the",
"display",
".",
"Only",
"the",
"ASCII",
"characters",
"between",
"32",
"(",
"space",
")",
"and",
"126",
"(",
"tilde",
")",
"are",
"supported",
";",
"other",
"characters",
"will",
"result",
"in",
"random",
"data",
"being",
"draw",
"on",
"the",
"display",
"(",
"based",
"on",
"whatever",
"appears",
"before",
"/",
"after",
"the",
"font",
"in",
"memory",
")",
".",
"If",
"the",
"drawing",
"of",
"the",
"string",
"reaches",
"the",
"right",
"edge",
"of",
"the",
"display",
"no",
"more",
"characters",
"will",
"be",
"drawn",
".",
"Therefore",
"special",
"care",
"is",
"not",
"required",
"to",
"avoid",
"supplying",
"a",
"string",
"that",
"is",
"`",
"`",
"too",
"long",
"'",
"'",
"to",
"display",
".",
"\\",
"note",
"Because",
"the",
"OLED",
"display",
"packs",
"2",
"pixels",
"of",
"data",
"in",
"a",
"single",
"byte",
"the",
"parameter",
"\\",
"e",
"ulX",
"must",
"be",
"an",
"even",
"column",
"number",
"(",
"for",
"example",
"0",
"2",
"4",
"and",
"so",
"on",
")",
".",
"\\",
"return",
"None",
"."
] | void
RIT128x96x4StringDraw(const char *pcStr, unsigned long ulX,
unsigned long ulY, unsigned char ucLevel)
{
unsigned long ulIdx1, ulIdx2;
unsigned char ucTemp;
ASSERT(ulX < 128);
ASSERT((ulX & 1) == 0);
ASSERT(ulY < 96);
ASSERT(ucLevel < 16);
g_pucBuffer[0] = 0x15;
g_pucBuffer[1] = ulX / 2;
g_pucBuffer[2] = 63;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = ulY;
g_pucBuffer[2] = ulY + 7;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4VerticalInc,
sizeof(g_pucRIT128x96x4VerticalInc));
while(*pcStr != 0)
{
ucTemp = *pcStr++ & 0x7f;
if(ucTemp < ' ')
{
ucTemp = 0;
}
else
{
ucTemp -= ' ';
}
for(ulIdx1 = 0; ulIdx1 < 6; ulIdx1 += 2)
{
for(ulIdx2 = 0; ulIdx2 < 8; ulIdx2++)
{
g_pucBuffer[ulIdx2] = 0;
if(g_pucFont[ucTemp][ulIdx1] & (1 << ulIdx2))
{
g_pucBuffer[ulIdx2] = (ucLevel << 4) & 0xf0;
}
if((ulIdx1 < 4) &&
(g_pucFont[ucTemp][ulIdx1 + 1] & (1 << ulIdx2)))
{
g_pucBuffer[ulIdx2] |= (ucLevel << 0) & 0x0f;
}
}
RITWriteData(g_pucBuffer, 8);
ulX += 2;
if(ulX == 128)
{
return;
}
}
}
} | [
"void",
"RIT128x96x4StringDraw",
"(",
"const",
"char",
"*",
"pcStr",
",",
"unsigned",
"long",
"ulX",
",",
"unsigned",
"long",
"ulY",
",",
"unsigned",
"char",
"ucLevel",
")",
"{",
"unsigned",
"long",
"ulIdx1",
",",
"ulIdx2",
";",
"unsigned",
"char",
"ucTemp",
";",
"ASSERT",
"(",
"ulX",
"<",
"128",
")",
";",
"ASSERT",
"(",
"(",
"ulX",
"&",
"1",
")",
"==",
"0",
")",
";",
"ASSERT",
"(",
"ulY",
"<",
"96",
")",
";",
"ASSERT",
"(",
"ucLevel",
"<",
"16",
")",
";",
"g_pucBuffer",
"[",
"0",
"]",
"=",
"0x15",
";",
"g_pucBuffer",
"[",
"1",
"]",
"=",
"ulX",
"/",
"2",
";",
"g_pucBuffer",
"[",
"2",
"]",
"=",
"63",
";",
"RITWriteCommand",
"(",
"g_pucBuffer",
",",
"3",
")",
";",
"g_pucBuffer",
"[",
"0",
"]",
"=",
"0x75",
";",
"g_pucBuffer",
"[",
"1",
"]",
"=",
"ulY",
";",
"g_pucBuffer",
"[",
"2",
"]",
"=",
"ulY",
"+",
"7",
";",
"RITWriteCommand",
"(",
"g_pucBuffer",
",",
"3",
")",
";",
"RITWriteCommand",
"(",
"g_pucRIT128x96x4VerticalInc",
",",
"sizeof",
"(",
"g_pucRIT128x96x4VerticalInc",
")",
")",
";",
"while",
"(",
"*",
"pcStr",
"!=",
"0",
")",
"{",
"ucTemp",
"=",
"*",
"pcStr",
"++",
"&",
"0x7f",
";",
"if",
"(",
"ucTemp",
"<",
"'",
"'",
")",
"{",
"ucTemp",
"=",
"0",
";",
"}",
"else",
"{",
"ucTemp",
"-=",
"'",
"'",
";",
"}",
"for",
"(",
"ulIdx1",
"=",
"0",
";",
"ulIdx1",
"<",
"6",
";",
"ulIdx1",
"+=",
"2",
")",
"{",
"for",
"(",
"ulIdx2",
"=",
"0",
";",
"ulIdx2",
"<",
"8",
";",
"ulIdx2",
"++",
")",
"{",
"g_pucBuffer",
"[",
"ulIdx2",
"]",
"=",
"0",
";",
"if",
"(",
"g_pucFont",
"[",
"ucTemp",
"]",
"[",
"ulIdx1",
"]",
"&",
"(",
"1",
"<<",
"ulIdx2",
")",
")",
"{",
"g_pucBuffer",
"[",
"ulIdx2",
"]",
"=",
"(",
"ucLevel",
"<<",
"4",
")",
"&",
"0xf0",
";",
"}",
"if",
"(",
"(",
"ulIdx1",
"<",
"4",
")",
"&&",
"(",
"g_pucFont",
"[",
"ucTemp",
"]",
"[",
"ulIdx1",
"+",
"1",
"]",
"&",
"(",
"1",
"<<",
"ulIdx2",
")",
")",
")",
"{",
"g_pucBuffer",
"[",
"ulIdx2",
"]",
"|=",
"(",
"ucLevel",
"<<",
"0",
")",
"&",
"0x0f",
";",
"}",
"}",
"RITWriteData",
"(",
"g_pucBuffer",
",",
"8",
")",
";",
"ulX",
"+=",
"2",
";",
"if",
"(",
"ulX",
"==",
"128",
")",
"{",
"return",
";",
"}",
"}",
"}",
"}"
] | Displays a string on the OLED display. | [
"Displays",
"a",
"string",
"on",
"the",
"OLED",
"display",
"."
] | [
"//\r",
"// Check the arguments.\r",
"//\r",
"//\r",
"// Setup a window starting at the specified column and row, ending\r",
"// at the right edge of the display and 8 rows down (single character row).\r",
"//\r",
"//\r",
"// Loop while there are more characters in the string.\r",
"//\r",
"//\r",
"// Get a working copy of the current character and convert to an\r",
"// index into the character bit-map array.\r",
"//\r",
"//\r",
"// Build and display the character buffer.\r",
"//\r",
"//\r",
"// Convert two columns of 1-bit font data into a single data\r",
"// byte column of 4-bit font data.\r",
"//\r",
"//\r",
"// Send this byte column to the display.\r",
"//\r",
"//\r",
"// Return if the right side of the display has been reached.\r",
"//\r"
] | [
{
"param": "pcStr",
"type": "char"
},
{
"param": "ulX",
"type": "unsigned long"
},
{
"param": "ulY",
"type": "unsigned long"
},
{
"param": "ucLevel",
"type": "unsigned char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcStr",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulX",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulY",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ucLevel",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55560f4248397a58311b31441df35ab1d3b047e8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s1968/drivers/rit128x96x4.c | [
"BSD-3-Clause"
] | C | RIT128x96x4ImageDraw | void | void
RIT128x96x4ImageDraw(const unsigned char *pucImage, unsigned long ulX,
unsigned long ulY, unsigned long ulWidth,
unsigned long ulHeight)
{
//
// Check the arguments.
//
ASSERT(ulX < 128);
ASSERT((ulX & 1) == 0);
ASSERT(ulY < 96);
ASSERT((ulX + ulWidth) <= 128);
ASSERT((ulY + ulHeight) <= 96);
ASSERT((ulWidth & 1) == 0);
//
// Setup a window starting at the specified column and row, and ending
// at the column + width and row+height.
//
g_pucBuffer[0] = 0x15;
g_pucBuffer[1] = ulX / 2;
g_pucBuffer[2] = (ulX + ulWidth - 2) / 2;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = ulY;
g_pucBuffer[2] = ulY + ulHeight - 1;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
//
// Loop while there are more rows to display.
//
while(ulHeight--)
{
//
// Write this row of image data.
//
RITWriteData(pucImage, (ulWidth / 2));
//
// Advance to the next row of the image.
//
pucImage += (ulWidth / 2);
}
} | //*****************************************************************************
//
//! Displays an image on the OLED display.
//!
//! \param pucImage is a pointer to the image data.
//! \param ulX is the horizontal position to display this image, specified in
//! columns from the left edge of the display.
//! \param ulY is the vertical position to display this image, specified in
//! rows from the top of the display.
//! \param ulWidth is the width of the image, specified in columns.
//! \param ulHeight is the height of the image, specified in rows.
//!
//! This function will display a bitmap graphic on the display. Because of the
//! format of the display RAM, the starting column (\e ulX) and the number of
//! columns (\e ulWidth) must be an integer multiple of two.
//!
//! The image data is organized with the first row of image data appearing left
//! to right, followed immediately by the second row of image data. Each byte
//! contains the data for two columns in the current row, with the leftmost
//! column being contained in bits 7:4 and the rightmost column being contained
//! in bits 3:0.
//!
//! For example, an image six columns wide and seven scan lines tall would
//! be arranged as follows (showing how the twenty one bytes of the image would
//! appear on the display):
//!
//! \verbatim
//! +-------------------+-------------------+-------------------+
//! | Byte 0 | Byte 1 | Byte 2 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! | Byte 3 | Byte 4 | Byte 5 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! | Byte 6 | Byte 7 | Byte 8 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! | Byte 9 | Byte 10 | Byte 11 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! | Byte 12 | Byte 13 | Byte 14 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! | Byte 15 | Byte 16 | Byte 17 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! | Byte 18 | Byte 19 | Byte 20 |
//! +---------+---------+---------+---------+---------+---------+
//! | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 | 7 6 5 4 | 3 2 1 0 |
//! +---------+---------+---------+---------+---------+---------+
//! \endverbatim
//!
//! \return None.
//
//*****************************************************************************
| Displays an image on the OLED display.
\param pucImage is a pointer to the image data.
\param ulX is the horizontal position to display this image, specified in
columns from the left edge of the display.
\param ulY is the vertical position to display this image, specified in
rows from the top of the display.
\param ulWidth is the width of the image, specified in columns.
\param ulHeight is the height of the image, specified in rows.
This function will display a bitmap graphic on the display. Because of the
format of the display RAM, the starting column (\e ulX) and the number of
columns (\e ulWidth) must be an integer multiple of two.
The image data is organized with the first row of image data appearing left
to right, followed immediately by the second row of image data. Each byte
contains the data for two columns in the current row, with the leftmost
column being contained in bits 7:4 and the rightmost column being contained
in bits 3:0.
For example, an image six columns wide and seven scan lines tall would
be arranged as follows (showing how the twenty one bytes of the image would
appear on the display).
\return None. | [
"Displays",
"an",
"image",
"on",
"the",
"OLED",
"display",
".",
"\\",
"param",
"pucImage",
"is",
"a",
"pointer",
"to",
"the",
"image",
"data",
".",
"\\",
"param",
"ulX",
"is",
"the",
"horizontal",
"position",
"to",
"display",
"this",
"image",
"specified",
"in",
"columns",
"from",
"the",
"left",
"edge",
"of",
"the",
"display",
".",
"\\",
"param",
"ulY",
"is",
"the",
"vertical",
"position",
"to",
"display",
"this",
"image",
"specified",
"in",
"rows",
"from",
"the",
"top",
"of",
"the",
"display",
".",
"\\",
"param",
"ulWidth",
"is",
"the",
"width",
"of",
"the",
"image",
"specified",
"in",
"columns",
".",
"\\",
"param",
"ulHeight",
"is",
"the",
"height",
"of",
"the",
"image",
"specified",
"in",
"rows",
".",
"This",
"function",
"will",
"display",
"a",
"bitmap",
"graphic",
"on",
"the",
"display",
".",
"Because",
"of",
"the",
"format",
"of",
"the",
"display",
"RAM",
"the",
"starting",
"column",
"(",
"\\",
"e",
"ulX",
")",
"and",
"the",
"number",
"of",
"columns",
"(",
"\\",
"e",
"ulWidth",
")",
"must",
"be",
"an",
"integer",
"multiple",
"of",
"two",
".",
"The",
"image",
"data",
"is",
"organized",
"with",
"the",
"first",
"row",
"of",
"image",
"data",
"appearing",
"left",
"to",
"right",
"followed",
"immediately",
"by",
"the",
"second",
"row",
"of",
"image",
"data",
".",
"Each",
"byte",
"contains",
"the",
"data",
"for",
"two",
"columns",
"in",
"the",
"current",
"row",
"with",
"the",
"leftmost",
"column",
"being",
"contained",
"in",
"bits",
"7",
":",
"4",
"and",
"the",
"rightmost",
"column",
"being",
"contained",
"in",
"bits",
"3",
":",
"0",
".",
"For",
"example",
"an",
"image",
"six",
"columns",
"wide",
"and",
"seven",
"scan",
"lines",
"tall",
"would",
"be",
"arranged",
"as",
"follows",
"(",
"showing",
"how",
"the",
"twenty",
"one",
"bytes",
"of",
"the",
"image",
"would",
"appear",
"on",
"the",
"display",
")",
".",
"\\",
"return",
"None",
"."
] | void
RIT128x96x4ImageDraw(const unsigned char *pucImage, unsigned long ulX,
unsigned long ulY, unsigned long ulWidth,
unsigned long ulHeight)
{
ASSERT(ulX < 128);
ASSERT((ulX & 1) == 0);
ASSERT(ulY < 96);
ASSERT((ulX + ulWidth) <= 128);
ASSERT((ulY + ulHeight) <= 96);
ASSERT((ulWidth & 1) == 0);
g_pucBuffer[0] = 0x15;
g_pucBuffer[1] = ulX / 2;
g_pucBuffer[2] = (ulX + ulWidth - 2) / 2;
RITWriteCommand(g_pucBuffer, 3);
g_pucBuffer[0] = 0x75;
g_pucBuffer[1] = ulY;
g_pucBuffer[2] = ulY + ulHeight - 1;
RITWriteCommand(g_pucBuffer, 3);
RITWriteCommand(g_pucRIT128x96x4HorizontalInc,
sizeof(g_pucRIT128x96x4HorizontalInc));
while(ulHeight--)
{
RITWriteData(pucImage, (ulWidth / 2));
pucImage += (ulWidth / 2);
}
} | [
"void",
"RIT128x96x4ImageDraw",
"(",
"const",
"unsigned",
"char",
"*",
"pucImage",
",",
"unsigned",
"long",
"ulX",
",",
"unsigned",
"long",
"ulY",
",",
"unsigned",
"long",
"ulWidth",
",",
"unsigned",
"long",
"ulHeight",
")",
"{",
"ASSERT",
"(",
"ulX",
"<",
"128",
")",
";",
"ASSERT",
"(",
"(",
"ulX",
"&",
"1",
")",
"==",
"0",
")",
";",
"ASSERT",
"(",
"ulY",
"<",
"96",
")",
";",
"ASSERT",
"(",
"(",
"ulX",
"+",
"ulWidth",
")",
"<=",
"128",
")",
";",
"ASSERT",
"(",
"(",
"ulY",
"+",
"ulHeight",
")",
"<=",
"96",
")",
";",
"ASSERT",
"(",
"(",
"ulWidth",
"&",
"1",
")",
"==",
"0",
")",
";",
"g_pucBuffer",
"[",
"0",
"]",
"=",
"0x15",
";",
"g_pucBuffer",
"[",
"1",
"]",
"=",
"ulX",
"/",
"2",
";",
"g_pucBuffer",
"[",
"2",
"]",
"=",
"(",
"ulX",
"+",
"ulWidth",
"-",
"2",
")",
"/",
"2",
";",
"RITWriteCommand",
"(",
"g_pucBuffer",
",",
"3",
")",
";",
"g_pucBuffer",
"[",
"0",
"]",
"=",
"0x75",
";",
"g_pucBuffer",
"[",
"1",
"]",
"=",
"ulY",
";",
"g_pucBuffer",
"[",
"2",
"]",
"=",
"ulY",
"+",
"ulHeight",
"-",
"1",
";",
"RITWriteCommand",
"(",
"g_pucBuffer",
",",
"3",
")",
";",
"RITWriteCommand",
"(",
"g_pucRIT128x96x4HorizontalInc",
",",
"sizeof",
"(",
"g_pucRIT128x96x4HorizontalInc",
")",
")",
";",
"while",
"(",
"ulHeight",
"--",
")",
"{",
"RITWriteData",
"(",
"pucImage",
",",
"(",
"ulWidth",
"/",
"2",
")",
")",
";",
"pucImage",
"+=",
"(",
"ulWidth",
"/",
"2",
")",
";",
"}",
"}"
] | Displays an image on the OLED display. | [
"Displays",
"an",
"image",
"on",
"the",
"OLED",
"display",
"."
] | [
"//\r",
"// Check the arguments.\r",
"//\r",
"//\r",
"// Setup a window starting at the specified column and row, and ending\r",
"// at the column + width and row+height.\r",
"//\r",
"//\r",
"// Loop while there are more rows to display.\r",
"//\r",
"//\r",
"// Write this row of image data.\r",
"//\r",
"//\r",
"// Advance to the next row of the image.\r",
"//\r"
] | [
{
"param": "pucImage",
"type": "unsigned char"
},
{
"param": "ulX",
"type": "unsigned long"
},
{
"param": "ulY",
"type": "unsigned long"
},
{
"param": "ulWidth",
"type": "unsigned long"
},
{
"param": "ulHeight",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pucImage",
"type": "unsigned char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulX",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulY",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulWidth",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulHeight",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55560f4248397a58311b31441df35ab1d3b047e8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s1968/drivers/rit128x96x4.c | [
"BSD-3-Clause"
] | C | RIT128x96x4Disable | void | void
RIT128x96x4Disable(void)
{
unsigned long ulTemp;
//
// Indicate that the RIT driver can no longer use the SSI Port.
//
HWREGBITW(&g_ulSSIFlags, FLAG_SSI_ENABLED) = 0;
//
// Wait until the SSI port is no longer busy.
//
while(SSIBusy(SSI0_BASE))
{
}
//
// Drain the receive fifo.
//
while(SSIDataGetNonBlocking(SSI0_BASE, &ulTemp) != 0)
{
}
//
// Disable the SSI port.
//
SSIDisable(SSI0_BASE);
//
// Disable SSI control of the FSS pin.
//
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_PIN_3);
} | //*****************************************************************************
//
//! Enable the SSI component of the OLED display driver.
//!
//! This function initializes the SSI interface to the OLED display.
//!
//! \return None.
//
//*****************************************************************************
| Enable the SSI component of the OLED display driver.
This function initializes the SSI interface to the OLED display.
\return None. | [
"Enable",
"the",
"SSI",
"component",
"of",
"the",
"OLED",
"display",
"driver",
".",
"This",
"function",
"initializes",
"the",
"SSI",
"interface",
"to",
"the",
"OLED",
"display",
".",
"\\",
"return",
"None",
"."
] | void
RIT128x96x4Disable(void)
{
unsigned long ulTemp;
HWREGBITW(&g_ulSSIFlags, FLAG_SSI_ENABLED) = 0;
while(SSIBusy(SSI0_BASE))
{
}
while(SSIDataGetNonBlocking(SSI0_BASE, &ulTemp) != 0)
{
}
SSIDisable(SSI0_BASE);
GPIOPinTypeGPIOOutput(GPIO_PORTA_BASE, GPIO_PIN_3);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_STRENGTH_8MA,
GPIO_PIN_TYPE_STD_WPU);
GPIOPinWrite(GPIO_PORTA_BASE, GPIO_PIN_3, GPIO_PIN_3);
} | [
"void",
"RIT128x96x4Disable",
"(",
"void",
")",
"{",
"unsigned",
"long",
"ulTemp",
";",
"HWREGBITW",
"(",
"&",
"g_ulSSIFlags",
",",
"FLAG_SSI_ENABLED",
")",
"=",
"0",
";",
"while",
"(",
"SSIBusy",
"(",
"SSI0_BASE",
")",
")",
"{",
"}",
"while",
"(",
"SSIDataGetNonBlocking",
"(",
"SSI0_BASE",
",",
"&",
"ulTemp",
")",
"!=",
"0",
")",
"{",
"}",
"SSIDisable",
"(",
"SSI0_BASE",
")",
";",
"GPIOPinTypeGPIOOutput",
"(",
"GPIO_PORTA_BASE",
",",
"GPIO_PIN_3",
")",
";",
"GPIOPadConfigSet",
"(",
"GPIO_PORTA_BASE",
",",
"GPIO_PIN_3",
",",
"GPIO_STRENGTH_8MA",
",",
"GPIO_PIN_TYPE_STD_WPU",
")",
";",
"GPIOPinWrite",
"(",
"GPIO_PORTA_BASE",
",",
"GPIO_PIN_3",
",",
"GPIO_PIN_3",
")",
";",
"}"
] | Enable the SSI component of the OLED display driver. | [
"Enable",
"the",
"SSI",
"component",
"of",
"the",
"OLED",
"display",
"driver",
"."
] | [
"//\r",
"// Indicate that the RIT driver can no longer use the SSI Port.\r",
"//\r",
"//\r",
"// Wait until the SSI port is no longer busy.\r",
"//\r",
"//\r",
"// Drain the receive fifo.\r",
"//\r",
"//\r",
"// Disable the SSI port.\r",
"//\r",
"//\r",
"// Disable SSI control of the FSS pin.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
55560f4248397a58311b31441df35ab1d3b047e8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s1968/drivers/rit128x96x4.c | [
"BSD-3-Clause"
] | C | RIT128x96x4Init | void | void
RIT128x96x4Init(unsigned long ulFrequency)
{
unsigned long ulIdx;
//
// Enable the SSI0 and GPIO port blocks as they are needed by this driver.
//
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIO_OLEDDC);
//
// Configure the SSI0CLK and SSIOTX pins for SSI operation.
//
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
//
// Configure the GPIO port pin used as a D/Cn signal for OLED device,
// and the port pin used to enable power to the OLED panel.
//
GPIOPinTypeGPIOOutput(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
GPIOPadConfigSet(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
GPIOPinWrite(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
HWREGBITW(&g_ulSSIFlags, FLAG_DC_HIGH) = 1;
//
// Configure and enable the SSI0 port for master mode.
//
RIT128x96x4Enable(ulFrequency);
//
// Clear the frame buffer.
//
RIT128x96x4Clear();
//
// Initialize the SSD1329 controller. Loop through the initialization
// sequence array, sending each command "string" to the controller.
//
for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init);
ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1)
{
//
// Send this command.
//
RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1,
g_pucRIT128x96x4Init[ulIdx] - 1);
}
} | //*****************************************************************************
//
//! Initialize the OLED display.
//!
//! \param ulFrequency specifies the SSI Clock Frequency to be used.
//!
//! This function initializes the SSI interface to the OLED display and
//! configures the SSD1329 controller on the panel.
//!
//! \return None.
//
//*****************************************************************************
| Initialize the OLED display.
\param ulFrequency specifies the SSI Clock Frequency to be used.
This function initializes the SSI interface to the OLED display and
configures the SSD1329 controller on the panel.
\return None. | [
"Initialize",
"the",
"OLED",
"display",
".",
"\\",
"param",
"ulFrequency",
"specifies",
"the",
"SSI",
"Clock",
"Frequency",
"to",
"be",
"used",
".",
"This",
"function",
"initializes",
"the",
"SSI",
"interface",
"to",
"the",
"OLED",
"display",
"and",
"configures",
"the",
"SSD1329",
"controller",
"on",
"the",
"panel",
".",
"\\",
"return",
"None",
"."
] | void
RIT128x96x4Init(unsigned long ulFrequency)
{
unsigned long ulIdx;
SysCtlPeripheralEnable(SYSCTL_PERIPH_SSI0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIO_OLEDDC);
GPIOPinTypeSSI(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5);
GPIOPadConfigSet(GPIO_PORTA_BASE, GPIO_PIN_2 | GPIO_PIN_3 | GPIO_PIN_5,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD_WPU);
GPIOPinTypeGPIOOutput(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
GPIOPadConfigSet(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
GPIO_STRENGTH_8MA, GPIO_PIN_TYPE_STD);
GPIOPinWrite(GPIO_OLEDDC_BASE, GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN,
GPIO_OLEDDC_PIN | GPIO_OLEDEN_PIN);
HWREGBITW(&g_ulSSIFlags, FLAG_DC_HIGH) = 1;
RIT128x96x4Enable(ulFrequency);
RIT128x96x4Clear();
for(ulIdx = 0; ulIdx < sizeof(g_pucRIT128x96x4Init);
ulIdx += g_pucRIT128x96x4Init[ulIdx] + 1)
{
RITWriteCommand(g_pucRIT128x96x4Init + ulIdx + 1,
g_pucRIT128x96x4Init[ulIdx] - 1);
}
} | [
"void",
"RIT128x96x4Init",
"(",
"unsigned",
"long",
"ulFrequency",
")",
"{",
"unsigned",
"long",
"ulIdx",
";",
"SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_SSI0",
")",
";",
"SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_GPIOA",
")",
";",
"SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_GPIO_OLEDDC",
")",
";",
"GPIOPinTypeSSI",
"(",
"GPIO_PORTA_BASE",
",",
"GPIO_PIN_2",
"|",
"GPIO_PIN_3",
"|",
"GPIO_PIN_5",
")",
";",
"GPIOPadConfigSet",
"(",
"GPIO_PORTA_BASE",
",",
"GPIO_PIN_2",
"|",
"GPIO_PIN_3",
"|",
"GPIO_PIN_5",
",",
"GPIO_STRENGTH_8MA",
",",
"GPIO_PIN_TYPE_STD_WPU",
")",
";",
"GPIOPinTypeGPIOOutput",
"(",
"GPIO_OLEDDC_BASE",
",",
"GPIO_OLEDDC_PIN",
"|",
"GPIO_OLEDEN_PIN",
")",
";",
"GPIOPadConfigSet",
"(",
"GPIO_OLEDDC_BASE",
",",
"GPIO_OLEDDC_PIN",
"|",
"GPIO_OLEDEN_PIN",
",",
"GPIO_STRENGTH_8MA",
",",
"GPIO_PIN_TYPE_STD",
")",
";",
"GPIOPinWrite",
"(",
"GPIO_OLEDDC_BASE",
",",
"GPIO_OLEDDC_PIN",
"|",
"GPIO_OLEDEN_PIN",
",",
"GPIO_OLEDDC_PIN",
"|",
"GPIO_OLEDEN_PIN",
")",
";",
"HWREGBITW",
"(",
"&",
"g_ulSSIFlags",
",",
"FLAG_DC_HIGH",
")",
"=",
"1",
";",
"RIT128x96x4Enable",
"(",
"ulFrequency",
")",
";",
"RIT128x96x4Clear",
"(",
")",
";",
"for",
"(",
"ulIdx",
"=",
"0",
";",
"ulIdx",
"<",
"sizeof",
"(",
"g_pucRIT128x96x4Init",
")",
";",
"ulIdx",
"+=",
"g_pucRIT128x96x4Init",
"[",
"ulIdx",
"]",
"+",
"1",
")",
"{",
"RITWriteCommand",
"(",
"g_pucRIT128x96x4Init",
"+",
"ulIdx",
"+",
"1",
",",
"g_pucRIT128x96x4Init",
"[",
"ulIdx",
"]",
"-",
"1",
")",
";",
"}",
"}"
] | Initialize the OLED display. | [
"Initialize",
"the",
"OLED",
"display",
"."
] | [
"//\r",
"// Enable the SSI0 and GPIO port blocks as they are needed by this driver.\r",
"//\r",
"//\r",
"// Configure the SSI0CLK and SSIOTX pins for SSI operation.\r",
"//\r",
"//\r",
"// Configure the GPIO port pin used as a D/Cn signal for OLED device,\r",
"// and the port pin used to enable power to the OLED panel.\r",
"//\r",
"//\r",
"// Configure and enable the SSI0 port for master mode.\r",
"//\r",
"//\r",
"// Clear the frame buffer.\r",
"//\r",
"//\r",
"// Initialize the SSD1329 controller. Loop through the initialization\r",
"// sequence array, sending each command \"string\" to the controller.\r",
"//\r",
"//\r",
"// Send this command.\r",
"//\r"
] | [
{
"param": "ulFrequency",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ulFrequency",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_1_Unicode | null | unsigned long
GrMapISO8859_1_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// There is a 1:1 mapping of characters in ISO8859-1 to Unicode.
//
*pulSkip = 1;
return((unsigned long)((unsigned char)*pcSrcChar));
} | //*****************************************************************************
//
//! Maps an ISO8859-1 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-1 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-1 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is trivial since
//! the bottom 256 characters in Unicode are the ISO8859-1 characters and since
//! ISO8859-1 is not a variable length encoding (every character is exactly 1
//! byte).
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-1.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-1 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-1 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-1 format into 32 bit Unicode
typically used by wide character fonts. This conversion is trivial since
the bottom 256 characters in Unicode are the ISO8859-1 characters and since
ISO8859-1 is not a variable length encoding (every character is exactly 1
byte).
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"1",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"1",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"1",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"trivial",
"since",
"the",
"bottom",
"256",
"characters",
"in",
"Unicode",
"are",
"the",
"ISO8859",
"-",
"1",
"characters",
"and",
"since",
"ISO8859",
"-",
"1",
"is",
"not",
"a",
"variable",
"length",
"encoding",
"(",
"every",
"character",
"is",
"exactly",
"1",
"byte",
")",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_1_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
return((unsigned long)((unsigned char)*pcSrcChar));
} | [
"unsigned",
"long",
"GrMapISO8859_1_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
")",
";",
"}"
] | Maps an ISO8859-1 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"1",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// There is a 1:1 mapping of characters in ISO8859-1 to Unicode.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_2_Unicode | null | unsigned long
GrMapISO8859_2_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_2_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-2 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-2 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-2 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA0 and below map directly to the same code in
//! Unicode and those from 0xA1 to 0xFF are converted using a global data
//! table.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-2.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-2 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-2 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-2 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA0 and below map directly to the same code in
Unicode and those from 0xA1 to 0xFF are converted using a global data
table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"2",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"2",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"2",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_2_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_2_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_2_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_2_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-2 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"2",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_3_Unicode | null | unsigned long
GrMapISO8859_3_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_3_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-3 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-3 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-3 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA0 and below map directly to the same code in
//! Unicode and those from 0xA1 to 0xFF are converted using a global data table.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-3.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-3 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-3 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-3 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA0 and below map directly to the same code in
Unicode and those from 0xA1 to 0xFF are converted using a global data table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"3",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"3",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"3",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_3_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_3_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_3_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_3_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-3 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"3",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_4_Unicode | null | unsigned long
GrMapISO8859_4_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_4_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-4 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-4 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-4 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA0 and below map directly to the same code in
//! Unicode and those from 0xA1 to 0xFF are converted using a global data table.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-4.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-4 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-4 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-4 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA0 and below map directly to the same code in
Unicode and those from 0xA1 to 0xFF are converted using a global data table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"4",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"4",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"4",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_4_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_4_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_4_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_4_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-4 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"4",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_5_Unicode | null | unsigned long
GrMapISO8859_5_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x360);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-5 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-5 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-5 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA0 and below map directly to the same code in
//! Unicode and those from 0xA1 to 0xFF map to the Unicode by adding 0x360 to
//! the ISO8859-5 code.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-5.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-5 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-5 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-5 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA0 and below map directly to the same code in
Unicode and those from 0xA1 to 0xFF map to the Unicode by adding 0x360 to
the ISO8859-5 code.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"5",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"5",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"5",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0x360",
"to",
"the",
"ISO8859",
"-",
"5",
"code",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_5_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x360);
}
} | [
"unsigned",
"long",
"GrMapISO8859_5_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"+",
"0x360",
")",
";",
"}",
"}"
] | Maps an ISO8859-5 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"5",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_6_Unicode | null | unsigned long
GrMapISO8859_6_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if(((unsigned char)*pcSrcChar <= 0xA4) ||
((unsigned char)*pcSrcChar == 0xAD))
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x560);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-6 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-6 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-6 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA4 and below map directly to the same code in
//! Unicode and those from 0xA5 to 0xFF map to the Unicode by adding 0x560 to
//! the ISO8859-5 code. The only odd-man-out is character 0xAD which maps to
//! Unicode 0xAD even though it is above 0xA4.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-6.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-6 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-6 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-6 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA4 and below map directly to the same code in
Unicode and those from 0xA5 to 0xFF map to the Unicode by adding 0x560 to
the ISO8859-5 code. The only odd-man-out is character 0xAD which maps to
Unicode 0xAD even though it is above 0xA4.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"6",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"6",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"6",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA4",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA5",
"to",
"0xFF",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0x560",
"to",
"the",
"ISO8859",
"-",
"5",
"code",
".",
"The",
"only",
"odd",
"-",
"man",
"-",
"out",
"is",
"character",
"0xAD",
"which",
"maps",
"to",
"Unicode",
"0xAD",
"even",
"though",
"it",
"is",
"above",
"0xA4",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_6_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if(((unsigned char)*pcSrcChar <= 0xA4) ||
((unsigned char)*pcSrcChar == 0xAD))
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x560);
}
} | [
"unsigned",
"long",
"GrMapISO8859_6_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA4",
")",
"||",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"==",
"0xAD",
")",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"+",
"0x560",
")",
";",
"}",
"}"
] | Maps an ISO8859-6 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"6",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_7_Unicode | null | unsigned long
GrMapISO8859_7_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
//
// This character is in the basic ASCII range so return it without
// remapping.
//
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if((unsigned char)*pcSrcChar >= 0xBE)
{
//
// This character can be mapped to Unicode by a simple addition.
//
return((unsigned long)((unsigned char)*pcSrcChar) + 0x2D0);
}
else
{
//
// This is one of the characters in the range which we map using a
// table.
//
return(g_pusISO8859_7_Unicode[(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-7 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-7 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-7 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA0 and below map directly to the same code in
//! Unicode, those from 0xBE to 0xFE map to the Unicode by adding 0x2D0 to
//! the ISO8859-7 code and only a few "unusual" mappings exist between
//! codepoints 0xA1 and 0xBD.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-7.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-7 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-7 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-7 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA0 and below map directly to the same code in
Unicode, those from 0xBE to 0xFE map to the Unicode by adding 0x2D0 to
the ISO8859-7 code and only a few "unusual" mappings exist between
codepoints 0xA1 and 0xBD.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"7",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"7",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"7",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"those",
"from",
"0xBE",
"to",
"0xFE",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0x2D0",
"to",
"the",
"ISO8859",
"-",
"7",
"code",
"and",
"only",
"a",
"few",
"\"",
"unusual",
"\"",
"mappings",
"exist",
"between",
"codepoints",
"0xA1",
"and",
"0xBD",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_7_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if((unsigned char)*pcSrcChar >= 0xBE)
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x2D0);
}
else
{
return(g_pusISO8859_7_Unicode[(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_7_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
">=",
"0xBE",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"+",
"0x2D0",
")",
";",
"}",
"else",
"{",
"return",
"(",
"g_pusISO8859_7_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-7 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"7",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r",
"//\r",
"// This character is in the basic ASCII range so return it without\r",
"// remapping.\r",
"//\r",
"//\r",
"// This character can be mapped to Unicode by a simple addition.\r",
"//\r",
"//\r",
"// This is one of the characters in the range which we map using a\r",
"// table.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_8_Unicode | null | unsigned long
GrMapISO8859_8_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xDE)
{
//
// This character is in the basic ASCII range so return it without
// remapping.
//
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if((unsigned char)*pcSrcChar == 0xDF)
{
//
// Return this special case.
//
return(0x2017);
}
else if((unsigned char)*pcSrcChar <= 0xFC)
{
//
// Map this range using a simple addition.
//
return((unsigned char)*pcSrcChar + 0x4F0);
}
else
{
//
// There are only 2 valid characters left at 0xFD and 0xFE. Map these
// to Unicode by adding 0x1F11 to map them to 0x200E and 0x200F.
//
return((unsigned char)*pcSrcChar + 0x1F11);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-8 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-8 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-8 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xDE and below map directly to the same code in
//! Unicode, those from 0xE0 to 0xFA map to the Unicode by adding 0x4F0 to
//! the ISO8859-7 code and only a few "unusual" mappings exist at codepoints
//! 0xDF, 0xFD and 0xFE.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-8.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-8 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-8 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-8 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xDE and below map directly to the same code in
Unicode, those from 0xE0 to 0xFA map to the Unicode by adding 0x4F0 to
the ISO8859-7 code and only a few "unusual" mappings exist at codepoints
0xDF, 0xFD and 0xFE.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"8",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"8",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"8",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xDE",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"those",
"from",
"0xE0",
"to",
"0xFA",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0x4F0",
"to",
"the",
"ISO8859",
"-",
"7",
"code",
"and",
"only",
"a",
"few",
"\"",
"unusual",
"\"",
"mappings",
"exist",
"at",
"codepoints",
"0xDF",
"0xFD",
"and",
"0xFE",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_8_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xDE)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if((unsigned char)*pcSrcChar == 0xDF)
{
return(0x2017);
}
else if((unsigned char)*pcSrcChar <= 0xFC)
{
return((unsigned char)*pcSrcChar + 0x4F0);
}
else
{
return((unsigned char)*pcSrcChar + 0x1F11);
}
} | [
"unsigned",
"long",
"GrMapISO8859_8_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xDE",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"==",
"0xDF",
")",
"{",
"return",
"(",
"0x2017",
")",
";",
"}",
"else",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xFC",
")",
"{",
"return",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"+",
"0x4F0",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"+",
"0x1F11",
")",
";",
"}",
"}"
] | Maps an ISO8859-8 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"8",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r",
"//\r",
"// This character is in the basic ASCII range so return it without\r",
"// remapping.\r",
"//\r",
"//\r",
"// Return this special case.\r",
"//\r",
"//\r",
"// Map this range using a simple addition.\r",
"//\r",
"//\r",
"// There are only 2 valid characters left at 0xFD and 0xFE. Map these\r",
"// to Unicode by adding 0x1F11 to map them to 0x200E and 0x200F.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_9_Unicode | null | unsigned long
GrMapISO8859_9_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Deal with the special cases in this switch.
//
switch((unsigned char)*pcSrcChar)
{
//
// Character 0xD0 in ISO8859-9 maps to U+011E
//
case 0xD0:
{
return(0x11E);
}
//
// Character 0xDD in ISO8859-9 maps to U+0130
//
case 0xDD:
{
return(0x130);
}
//
// Character 0xDE in ISO8859-9 maps to U+015E
//
case 0xDE:
{
return(0x15E);
}
//
// Character 0xF0 in ISO8859-9 maps to U+011F
//
case 0xF0:
{
return(0x11F);
}
//
// Character 0xFD in ISO8859-9 maps to U+0131
//
case 0xFD:
{
return(0x131);
}
//
// Character 0xFE in ISO8859-9 maps to U+015F
//
case 0xFE:
{
return(0x15F);
}
//
// All other characters map directly to Unicode using the same
// codepoints.
//
default:
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
}
} | //*****************************************************************************
//
//! Maps an ISO8859-9 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-9 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-9 format into 32 bit Unicode
//! typically used by wide character fonts. This character set is almost
//! identical to ISO8859-1 but substitutes 6 characters to offer better
//! support for the Turkish language.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-9.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-9 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-9 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-9 format into 32 bit Unicode
typically used by wide character fonts. This character set is almost
identical to ISO8859-1 but substitutes 6 characters to offer better
support for the Turkish language.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"9",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"9",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"9",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"character",
"set",
"is",
"almost",
"identical",
"to",
"ISO8859",
"-",
"1",
"but",
"substitutes",
"6",
"characters",
"to",
"offer",
"better",
"support",
"for",
"the",
"Turkish",
"language",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_9_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
switch((unsigned char)*pcSrcChar)
{
case 0xD0:
{
return(0x11E);
}
case 0xDD:
{
return(0x130);
}
case 0xDE:
{
return(0x15E);
}
case 0xF0:
{
return(0x11F);
}
case 0xFD:
{
return(0x131);
}
case 0xFE:
{
return(0x15F);
}
default:
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
}
} | [
"unsigned",
"long",
"GrMapISO8859_9_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"switch",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"{",
"case",
"0xD0",
":",
"{",
"return",
"(",
"0x11E",
")",
";",
"}",
"case",
"0xDD",
":",
"{",
"return",
"(",
"0x130",
")",
";",
"}",
"case",
"0xDE",
":",
"{",
"return",
"(",
"0x15E",
")",
";",
"}",
"case",
"0xF0",
":",
"{",
"return",
"(",
"0x11F",
")",
";",
"}",
"case",
"0xFD",
":",
"{",
"return",
"(",
"0x131",
")",
";",
"}",
"case",
"0xFE",
":",
"{",
"return",
"(",
"0x15F",
")",
";",
"}",
"default",
":",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"}",
"}"
] | Maps an ISO8859-9 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"9",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Deal with the special cases in this switch.\r",
"//\r",
"//\r",
"// Character 0xD0 in ISO8859-9 maps to U+011E\r",
"//\r",
"//\r",
"// Character 0xDD in ISO8859-9 maps to U+0130\r",
"//\r",
"//\r",
"// Character 0xDE in ISO8859-9 maps to U+015E\r",
"//\r",
"//\r",
"// Character 0xF0 in ISO8859-9 maps to U+011F\r",
"//\r",
"//\r",
"// Character 0xFD in ISO8859-9 maps to U+0131\r",
"//\r",
"//\r",
"// Character 0xFE in ISO8859-9 maps to U+015F\r",
"//\r",
"//\r",
"// All other characters map directly to Unicode using the same\r",
"// codepoints.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_10_Unicode | null | unsigned long
GrMapISO8859_10_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_10_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-10 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-10 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-10 format into 32 bit Unicode
//! typically used by wide character fonts. Character codes 0xA0 and below
//! map directly to the same code in Unicode and those from 0xA1 to 0xFF are
//! converted using a global data table.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-10.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-10 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-10 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-10 format into 32 bit Unicode
typically used by wide character fonts. Character codes 0xA0 and below
map directly to the same code in Unicode and those from 0xA1 to 0xFF are
converted using a global data table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"10",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"10",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"10",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_10_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_10_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_10_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_10_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-10 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"10",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_11_Unicode | null | unsigned long
GrMapISO8859_11_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0xD60);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-11 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-11 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-11 format into 32 bit Unicode
//! typically used by wide character fonts. This conversion is straightforward
//! since character codes 0xA0 and below map directly to the same code in
//! Unicode and those from 0xA1 to 0xFF map to the Unicode by adding 0xD60 to
//! the ISO8859-11 code.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-11.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-11 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-11 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-11 format into 32 bit Unicode
typically used by wide character fonts. This conversion is straightforward
since character codes 0xA0 and below map directly to the same code in
Unicode and those from 0xA1 to 0xFF map to the Unicode by adding 0xD60 to
the ISO8859-11 code.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"11",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"11",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"11",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0xD60",
"to",
"the",
"ISO8859",
"-",
"11",
"code",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_11_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0xD60);
}
} | [
"unsigned",
"long",
"GrMapISO8859_11_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"+",
"0xD60",
")",
";",
"}",
"}"
] | Maps an ISO8859-11 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"11",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_13_Unicode | null | unsigned long
GrMapISO8859_13_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_13_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-13 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-13 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-13 format into 32 bit Unicode
//! typically used by wide character fonts. Character codes 0xA0 and below
//! map directly to the same code in Unicode and those from 0xA1 to 0xFF are
//! converted using a global data table.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-13.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-13 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-13 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-13 format into 32 bit Unicode
typically used by wide character fonts. Character codes 0xA0 and below
map directly to the same code in Unicode and those from 0xA1 to 0xFF are
converted using a global data table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"13",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"13",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"13",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_13_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_13_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_13_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_13_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-13 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"13",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_14_Unicode | null | unsigned long
GrMapISO8859_14_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Deal with the special cases in this switch.
//
switch((unsigned char)*pcSrcChar)
{
//
// Character 0xD0 in ISO8859-14 maps to U+0174
//
case 0xD0:
{
return(0x174);
}
//
// Character 0xD7 in ISO8859-14 maps to U+1E6A
//
case 0xD7:
{
return(0x1E6A);
}
//
// Character 0xDE in ISO8859-14 maps to U+0176
//
case 0xDE:
{
return(0x176);
}
//
// Character 0xF0 in ISO8859-14 maps to U+0175
//
case 0xF0:
{
return(0x175);
}
//
// Character 0xF7 in ISO8859-14 maps to U+1E6B
//
case 0xF7:
{
return(0x1E6B);
}
//
// Character 0xFD in ISO8859-14 maps to U+0177
//
case 0xFD:
{
return(0x131);
}
//
// Other codepoints above 0xC0 map directly to their Unicode
// equivalents. Mappings for characters from 0xA1 to 0xBF are handled
// using a global table.
//
default:
{
if((unsigned char)*pcSrcChar >= 0xC0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_14_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
}
}
} | //*****************************************************************************
//
//! Maps an ISO8859-14 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-14 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-9 format into 32 bit Unicode
//! typically used by wide character fonts. This character set is similar to
//! ISO8859-1 but substitutes several characters to offer support for various
//! Celtic languages.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-14.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-14 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-14 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-9 format into 32 bit Unicode
typically used by wide character fonts. This character set is similar to
ISO8859-1 but substitutes several characters to offer support for various
Celtic languages.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"14",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"14",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"9",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"character",
"set",
"is",
"similar",
"to",
"ISO8859",
"-",
"1",
"but",
"substitutes",
"several",
"characters",
"to",
"offer",
"support",
"for",
"various",
"Celtic",
"languages",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_14_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
switch((unsigned char)*pcSrcChar)
{
case 0xD0:
{
return(0x174);
}
case 0xD7:
{
return(0x1E6A);
}
case 0xDE:
{
return(0x176);
}
case 0xF0:
{
return(0x175);
}
case 0xF7:
{
return(0x1E6B);
}
case 0xFD:
{
return(0x131);
}
default:
{
if((unsigned char)*pcSrcChar >= 0xC0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_14_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
}
}
} | [
"unsigned",
"long",
"GrMapISO8859_14_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"switch",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"{",
"case",
"0xD0",
":",
"{",
"return",
"(",
"0x174",
")",
";",
"}",
"case",
"0xD7",
":",
"{",
"return",
"(",
"0x1E6A",
")",
";",
"}",
"case",
"0xDE",
":",
"{",
"return",
"(",
"0x176",
")",
";",
"}",
"case",
"0xF0",
":",
"{",
"return",
"(",
"0x175",
")",
";",
"}",
"case",
"0xF7",
":",
"{",
"return",
"(",
"0x1E6B",
")",
";",
"}",
"case",
"0xFD",
":",
"{",
"return",
"(",
"0x131",
")",
";",
"}",
"default",
":",
"{",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
">=",
"0xC0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_14_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}",
"}",
"}"
] | Maps an ISO8859-14 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"14",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Deal with the special cases in this switch.\r",
"//\r",
"//\r",
"// Character 0xD0 in ISO8859-14 maps to U+0174\r",
"//\r",
"//\r",
"// Character 0xD7 in ISO8859-14 maps to U+1E6A\r",
"//\r",
"//\r",
"// Character 0xDE in ISO8859-14 maps to U+0176\r",
"//\r",
"//\r",
"// Character 0xF0 in ISO8859-14 maps to U+0175\r",
"//\r",
"//\r",
"// Character 0xF7 in ISO8859-14 maps to U+1E6B\r",
"//\r",
"//\r",
"// Character 0xFD in ISO8859-14 maps to U+0177\r",
"//\r",
"//\r",
"// Other codepoints above 0xC0 map directly to their Unicode\r",
"// equivalents. Mappings for characters from 0xA1 to 0xBF are handled\r",
"// using a global table.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_15_Unicode | null | unsigned long
GrMapISO8859_15_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Deal with the special cases in this switch.
//
switch((unsigned char)*pcSrcChar)
{
//
// Character 0xA4 in ISO8859-15 maps to U+20AC
//
case 0xA4:
{
return(0x20AC);
}
//
// Character 0xA6 in ISO8859-15 maps to U+0160
//
case 0xA6:
{
return(0x160);
}
//
// Character 0xA8 in ISO8859-15 maps to U+0161
//
case 0xA8:
{
return(0x161);
}
//
// Character 0xB4 in ISO8859-15 maps to U+017D
//
case 0xB4:
{
return(0x17D);
}
//
// Character 0xB8 in ISO8859-15 maps to U+017E
//
case 0xB8:
{
return(0x17E);
}
//
// Character 0xBC in ISO8859-15 maps to U+0152
//
case 0xBC:
{
return(0x152);
}
//
// Character 0xBD in ISO8859-15 maps to U+0153
//
case 0xBD:
{
return(0x153);
}
//
// Character 0xBE in ISO8859-15 maps to U+0178
//
case 0xBE:
{
return(0x178);
}
//
// All other codepoints map directly to their Unicode equivalents.
//
default:
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
}
} | //*****************************************************************************
//
//! Maps an ISO8859-15 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-15 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-15 format into 32 bit Unicode
//! typically used by wide character fonts. This character set is similar to
//! ISO8859-1 differing from that codepage in only 8 positions.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-15.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-15 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-15 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-15 format into 32 bit Unicode
typically used by wide character fonts. This character set is similar to
ISO8859-1 differing from that codepage in only 8 positions.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"15",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"15",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"15",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"character",
"set",
"is",
"similar",
"to",
"ISO8859",
"-",
"1",
"differing",
"from",
"that",
"codepage",
"in",
"only",
"8",
"positions",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_15_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
switch((unsigned char)*pcSrcChar)
{
case 0xA4:
{
return(0x20AC);
}
case 0xA6:
{
return(0x160);
}
case 0xA8:
{
return(0x161);
}
case 0xB4:
{
return(0x17D);
}
case 0xB8:
{
return(0x17E);
}
case 0xBC:
{
return(0x152);
}
case 0xBD:
{
return(0x153);
}
case 0xBE:
{
return(0x178);
}
default:
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
}
} | [
"unsigned",
"long",
"GrMapISO8859_15_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"switch",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"{",
"case",
"0xA4",
":",
"{",
"return",
"(",
"0x20AC",
")",
";",
"}",
"case",
"0xA6",
":",
"{",
"return",
"(",
"0x160",
")",
";",
"}",
"case",
"0xA8",
":",
"{",
"return",
"(",
"0x161",
")",
";",
"}",
"case",
"0xB4",
":",
"{",
"return",
"(",
"0x17D",
")",
";",
"}",
"case",
"0xB8",
":",
"{",
"return",
"(",
"0x17E",
")",
";",
"}",
"case",
"0xBC",
":",
"{",
"return",
"(",
"0x152",
")",
";",
"}",
"case",
"0xBD",
":",
"{",
"return",
"(",
"0x153",
")",
";",
"}",
"case",
"0xBE",
":",
"{",
"return",
"(",
"0x178",
")",
";",
"}",
"default",
":",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"}",
"}"
] | Maps an ISO8859-15 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"15",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Deal with the special cases in this switch.\r",
"//\r",
"//\r",
"// Character 0xA4 in ISO8859-15 maps to U+20AC\r",
"//\r",
"//\r",
"// Character 0xA6 in ISO8859-15 maps to U+0160\r",
"//\r",
"//\r",
"// Character 0xA8 in ISO8859-15 maps to U+0161\r",
"//\r",
"//\r",
"// Character 0xB4 in ISO8859-15 maps to U+017D\r",
"//\r",
"//\r",
"// Character 0xB8 in ISO8859-15 maps to U+017E\r",
"//\r",
"//\r",
"// Character 0xBC in ISO8859-15 maps to U+0152\r",
"//\r",
"//\r",
"// Character 0xBD in ISO8859-15 maps to U+0153\r",
"//\r",
"//\r",
"// Character 0xBE in ISO8859-15 maps to U+0178\r",
"//\r",
"//\r",
"// All other codepoints map directly to their Unicode equivalents.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapISO8859_16_Unicode | null | unsigned long
GrMapISO8859_16_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// ISO8859 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_16_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | //*****************************************************************************
//
//! Maps an ISO8859-16 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing ISO8859-16 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in ISO8859-16 format into 32 bit Unicode
//! typically used by wide character fonts. Character codes 0xA0 and below
//! map directly to the same code in Unicode and those from 0xA1 to 0xFF are
//! converted using a global data table.
//!
//! See http://unicode.org/Public/MAPPINGS/ISO8859/8859-16.TXT for more
//! information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an ISO8859-16 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing ISO8859-16 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in ISO8859-16 format into 32 bit Unicode
typically used by wide character fonts. Character codes 0xA0 and below
map directly to the same code in Unicode and those from 0xA1 to 0xFF are
converted using a global data table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"ISO8859",
"-",
"16",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"ISO8859",
"-",
"16",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"ISO8859",
"-",
"16",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Character",
"codes",
"0xA0",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0xA1",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapISO8859_16_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0xA0)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusISO8859_16_Unicode[
(unsigned char)*pcSrcChar - 0xA1]);
}
} | [
"unsigned",
"long",
"GrMapISO8859_16_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xA0",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusISO8859_16_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0xA1",
"]",
")",
";",
"}",
"}"
] | Maps an ISO8859-16 encoded character to its Unicode equivalent. | [
"Maps",
"an",
"ISO8859",
"-",
"16",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// ISO8859 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapUTF8_Unicode | null | unsigned long
GrMapUTF8_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
unsigned long ulUnicode, ulToRead, ulIndex;
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// Clear our our character code storage.
//
ulUnicode = 0;
ulIndex = 0;
//
// While we have bytes left to examine in the buffer and the current byte
// is a continuation code...
//
while(ulCount && ((unsigned char)pcSrcChar[ulIndex] & 0xC0) == 0x80)
{
//
// Skip the byte.
//
ulIndex++;
ulCount--;
}
//
// We are now either at the end of the string or the start of a new
// character unit. Did we get to the end of the string?
//
if(!ulCount)
{
//
// Yes - return 0.
//
return(0);
}
//
// Is this a single byte encoded character of the form 0xxxxxxx?
//
if(!((unsigned char)(pcSrcChar[ulIndex]) & 0x80))
{
//
// Yes - the Unicode equivalent is just the bottom 7 bits of the
// UTF-8 byte.
//
ulUnicode = (unsigned char)(pcSrcChar[ulIndex++]) & 0x7F;
ulToRead = 0;
}
else
{
//
// This is a multi-byte encoded character. Determine how many bytes
// it uses.
//
ulToRead = NumLeadingZeros(
~((unsigned long)pcSrcChar[ulIndex] << 24)) - 1;
//
// There can be a maximum of 5 more bytes to read. If we found more
// than this, then this is an illegal code.
//
if(ulToRead > 5)
{
ulUnicode = 0;
ulToRead = 0;
ulIndex++;
}
else
{
//
// Extract the first bits of the Unicode value from this byte.
//
ulUnicode = (unsigned char)pcSrcChar[ulIndex++] &
((1 << (6 - ulToRead)) - 1);
//
// Read the remaining bytes encoding this character.
//
while(ulCount && ulToRead)
{
//
// Is this a continuation byte with form 10xxxxxx?
//
if(((unsigned char)pcSrcChar[ulIndex] & 0xC0) != 0x80)
{
//
// No - this is an invalid character to return 0 and tell
// the caller to skip past it.
//
*pulSkip = ulIndex;
return(0);
}
else
{
//
// Extract the bottom 6 bits from the continuation
// character and mask them into the Unicode code.
//
ulUnicode = ((ulUnicode << 6) |
((unsigned char)pcSrcChar[ulIndex++] & 0x3F));
ulToRead--;
ulCount--;
}
}
//
// If we get here and we didn't read the expected number of bytes,
// this is an invalid character.
//
if(ulToRead)
{
//
// We ran out of data before reading all the required
// continuation bytes so tell the caller to skip the data and
// return 0 to indicate an error.
//
*pulSkip = ulIndex;
return(0);
}
}
}
//
// Tell the caller how many bytes to skip to get to the next character in
// the string.
//
*pulSkip = ulIndex;
//
// Return the Unicode character code.
//
return(ulUnicode);
} | //*****************************************************************************
//
//! Maps a UTF-8 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing UTF-8 encoded text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in UTF-8 format into 32 bit Unicode typically
//! used by wide character fonts. This conversion will read bytes from the
//! buffer and decode the first full UTF-8 character found, returning the
//! Unicode code for that character and the number of bytes to advance
//! pcSrcChar by to point to the end of the decoded character. If no valid
//! UTF-8 character is found, 0 is returned.
//!
//! See http://en.wikipedia.org/wiki/UTF-8 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps a UTF-8 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing UTF-8 encoded text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in UTF-8 format into 32 bit Unicode typically
used by wide character fonts. This conversion will read bytes from the
buffer and decode the first full UTF-8 character found, returning the
Unicode code for that character and the number of bytes to advance
pcSrcChar by to point to the end of the decoded character. If no valid
UTF-8 character is found, 0 is returned.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"a",
"UTF",
"-",
"8",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"UTF",
"-",
"8",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"UTF",
"-",
"8",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"will",
"read",
"bytes",
"from",
"the",
"buffer",
"and",
"decode",
"the",
"first",
"full",
"UTF",
"-",
"8",
"character",
"found",
"returning",
"the",
"Unicode",
"code",
"for",
"that",
"character",
"and",
"the",
"number",
"of",
"bytes",
"to",
"advance",
"pcSrcChar",
"by",
"to",
"point",
"to",
"the",
"end",
"of",
"the",
"decoded",
"character",
".",
"If",
"no",
"valid",
"UTF",
"-",
"8",
"character",
"is",
"found",
"0",
"is",
"returned",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapUTF8_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
unsigned long ulUnicode, ulToRead, ulIndex;
ASSERT(pulSkip);
ASSERT(pcSrcChar);
ulUnicode = 0;
ulIndex = 0;
while(ulCount && ((unsigned char)pcSrcChar[ulIndex] & 0xC0) == 0x80)
{
ulIndex++;
ulCount--;
}
if(!ulCount)
{
return(0);
}
if(!((unsigned char)(pcSrcChar[ulIndex]) & 0x80))
{
ulUnicode = (unsigned char)(pcSrcChar[ulIndex++]) & 0x7F;
ulToRead = 0;
}
else
{
ulToRead = NumLeadingZeros(
~((unsigned long)pcSrcChar[ulIndex] << 24)) - 1;
if(ulToRead > 5)
{
ulUnicode = 0;
ulToRead = 0;
ulIndex++;
}
else
{
ulUnicode = (unsigned char)pcSrcChar[ulIndex++] &
((1 << (6 - ulToRead)) - 1);
while(ulCount && ulToRead)
{
if(((unsigned char)pcSrcChar[ulIndex] & 0xC0) != 0x80)
{
*pulSkip = ulIndex;
return(0);
}
else
{
ulUnicode = ((ulUnicode << 6) |
((unsigned char)pcSrcChar[ulIndex++] & 0x3F));
ulToRead--;
ulCount--;
}
}
if(ulToRead)
{
*pulSkip = ulIndex;
return(0);
}
}
}
*pulSkip = ulIndex;
return(ulUnicode);
} | [
"unsigned",
"long",
"GrMapUTF8_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"unsigned",
"long",
"ulUnicode",
",",
"ulToRead",
",",
"ulIndex",
";",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"ulUnicode",
"=",
"0",
";",
"ulIndex",
"=",
"0",
";",
"while",
"(",
"ulCount",
"&&",
"(",
"(",
"unsigned",
"char",
")",
"pcSrcChar",
"[",
"ulIndex",
"]",
"&",
"0xC0",
")",
"==",
"0x80",
")",
"{",
"ulIndex",
"++",
";",
"ulCount",
"--",
";",
"}",
"if",
"(",
"!",
"ulCount",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"if",
"(",
"!",
"(",
"(",
"unsigned",
"char",
")",
"(",
"pcSrcChar",
"[",
"ulIndex",
"]",
")",
"&",
"0x80",
")",
")",
"{",
"ulUnicode",
"=",
"(",
"unsigned",
"char",
")",
"(",
"pcSrcChar",
"[",
"ulIndex",
"++",
"]",
")",
"&",
"0x7F",
";",
"ulToRead",
"=",
"0",
";",
"}",
"else",
"{",
"ulToRead",
"=",
"NumLeadingZeros",
"(",
"~",
"(",
"(",
"unsigned",
"long",
")",
"pcSrcChar",
"[",
"ulIndex",
"]",
"<<",
"24",
")",
")",
"-",
"1",
";",
"if",
"(",
"ulToRead",
">",
"5",
")",
"{",
"ulUnicode",
"=",
"0",
";",
"ulToRead",
"=",
"0",
";",
"ulIndex",
"++",
";",
"}",
"else",
"{",
"ulUnicode",
"=",
"(",
"unsigned",
"char",
")",
"pcSrcChar",
"[",
"ulIndex",
"++",
"]",
"&",
"(",
"(",
"1",
"<<",
"(",
"6",
"-",
"ulToRead",
")",
")",
"-",
"1",
")",
";",
"while",
"(",
"ulCount",
"&&",
"ulToRead",
")",
"{",
"if",
"(",
"(",
"(",
"unsigned",
"char",
")",
"pcSrcChar",
"[",
"ulIndex",
"]",
"&",
"0xC0",
")",
"!=",
"0x80",
")",
"{",
"*",
"pulSkip",
"=",
"ulIndex",
";",
"return",
"(",
"0",
")",
";",
"}",
"else",
"{",
"ulUnicode",
"=",
"(",
"(",
"ulUnicode",
"<<",
"6",
")",
"|",
"(",
"(",
"unsigned",
"char",
")",
"pcSrcChar",
"[",
"ulIndex",
"++",
"]",
"&",
"0x3F",
")",
")",
";",
"ulToRead",
"--",
";",
"ulCount",
"--",
";",
"}",
"}",
"if",
"(",
"ulToRead",
")",
"{",
"*",
"pulSkip",
"=",
"ulIndex",
";",
"return",
"(",
"0",
")",
";",
"}",
"}",
"}",
"*",
"pulSkip",
"=",
"ulIndex",
";",
"return",
"(",
"ulUnicode",
")",
";",
"}"
] | Maps a UTF-8 encoded character to its Unicode equivalent. | [
"Maps",
"a",
"UTF",
"-",
"8",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// Clear our our character code storage.\r",
"//\r",
"//\r",
"// While we have bytes left to examine in the buffer and the current byte\r",
"// is a continuation code...\r",
"//\r",
"//\r",
"// Skip the byte.\r",
"//\r",
"//\r",
"// We are now either at the end of the string or the start of a new\r",
"// character unit. Did we get to the end of the string?\r",
"//\r",
"//\r",
"// Yes - return 0.\r",
"//\r",
"//\r",
"// Is this a single byte encoded character of the form 0xxxxxxx?\r",
"//\r",
"//\r",
"// Yes - the Unicode equivalent is just the bottom 7 bits of the\r",
"// UTF-8 byte.\r",
"//\r",
"//\r",
"// This is a multi-byte encoded character. Determine how many bytes\r",
"// it uses.\r",
"//\r",
"//\r",
"// There can be a maximum of 5 more bytes to read. If we found more\r",
"// than this, then this is an illegal code.\r",
"//\r",
"//\r",
"// Extract the first bits of the Unicode value from this byte.\r",
"//\r",
"//\r",
"// Read the remaining bytes encoding this character.\r",
"//\r",
"//\r",
"// Is this a continuation byte with form 10xxxxxx?\r",
"//\r",
"//\r",
"// No - this is an invalid character to return 0 and tell\r",
"// the caller to skip past it.\r",
"//\r",
"//\r",
"// Extract the bottom 6 bits from the continuation\r",
"// character and mask them into the Unicode code.\r",
"//\r",
"//\r",
"// If we get here and we didn't read the expected number of bytes,\r",
"// this is an invalid character.\r",
"//\r",
"//\r",
"// We ran out of data before reading all the required\r",
"// continuation bytes so tell the caller to skip the data and\r",
"// return 0 to indicate an error.\r",
"//\r",
"//\r",
"// Tell the caller how many bytes to skip to get to the next character in\r",
"// the string.\r",
"//\r",
"//\r",
"// Return the Unicode character code.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapUTF16_Unicode | null | static unsigned long
GrMapUTF16_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip, tBoolean bLE)
{
unsigned short usChar, usCharToo;
unsigned long ulCode;
const char *pcChar;
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// Walk the string until we find something valid that we can decode.
//
ulCode = 0;
pcChar = pcSrcChar;
while(ulCount >= 2)
{
//
// Get a word from the string.
//
usChar = bLE ? (pcChar[0] + 256 * pcChar[1]) :
(pcChar[1] + 256 * pcChar[0]);
//
// Move to the next word and update our count.
//
ulCount -= 2;
pcChar += 2;
//
// Is this a valid single-word encoding?
//
if((usChar <= 0xD7FF) || (usChar >= 0xE000))
{
//
// Yes - return the value and tell the caller to skip the
// appropriate number of bytes to get to the end of this character.
//
ulCode = (unsigned long)usChar;
break;
}
else
{
//
// Is this a valid first word for a high surrogate (first word in a
// 2 word encoding)?
//
if((usChar >= 0xD800) && (usChar < 0xDC00))
{
//
// Yes - this is valid. Now look ahead and see if the next
// word is valid as a low surrogate, assuming there are at
// least 2 more bytes for us to look at.
//
if(ulCount >= 2)
{
//
// Get the next word in the string.
//
usCharToo = bLE ? (pcChar[0] + 256 * pcChar[1]) :
(pcChar[1] + 256 * pcChar[0]);
//
// Is this a valid low surrogate?
//
if((usCharToo >= 0xDC00) && (usCharToo < 0xE000))
{
//
// Yes, it's valid. Update our skip count and parse
// the Unicode codepoint from the two words we've read.
//
pcChar += 2;
ulCount -= 2;
ulCode = 0x10000 +
((unsigned long)(usChar - 0xD800) << 10) +
((unsigned long)usCharToo - 0xDC00);
break;
}
}
}
}
}
//
// Set the number of bytes to skip in the string to get past the
// character we just parsed and return the character codepoint if we
// found one.
//
*pulSkip = (unsigned long)(pcChar - pcSrcChar);
return(ulCode);
} | //*****************************************************************************
//
// Maps a UTF-16LE or UTF-16BE encoded character to its Unicode equivalent.
//
// \param pcSrcChar is a pointer to a string containing UTF-16LE encoded text.
// \param ulCount is the number of bytes in the buffer pointed to by
// pcSrcChar.
// \param pulSkip points to storage that will be written with the number of
// bytes to skip in pcSrcChar to get to the next character in the
// buffer.
// \param bLE is \b true if the \e pcSrcChar points to a UTF-16LE encoded
// string or \b false if it points to a UTF-16BE string.
//
// This internal function is used to support GrMapUTF16LE_Unicode and
// GrMapUTF16BE_Unicode.
//
// \return Returns the Unicode character code for the first character in the
// \e pcSrcChar string passed.
//
//*****************************************************************************
| Maps a UTF-16LE or UTF-16BE encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing UTF-16LE encoded text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
\param bLE is \b true if the \e pcSrcChar points to a UTF-16LE encoded
string or \b false if it points to a UTF-16BE string.
This internal function is used to support GrMapUTF16LE_Unicode and
GrMapUTF16BE_Unicode.
\return Returns the Unicode character code for the first character in the
\e pcSrcChar string passed. | [
"Maps",
"a",
"UTF",
"-",
"16LE",
"or",
"UTF",
"-",
"16BE",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"UTF",
"-",
"16LE",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"\\",
"param",
"bLE",
"is",
"\\",
"b",
"true",
"if",
"the",
"\\",
"e",
"pcSrcChar",
"points",
"to",
"a",
"UTF",
"-",
"16LE",
"encoded",
"string",
"or",
"\\",
"b",
"false",
"if",
"it",
"points",
"to",
"a",
"UTF",
"-",
"16BE",
"string",
".",
"This",
"internal",
"function",
"is",
"used",
"to",
"support",
"GrMapUTF16LE_Unicode",
"and",
"GrMapUTF16BE_Unicode",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"\\",
"e",
"pcSrcChar",
"string",
"passed",
"."
] | static unsigned long
GrMapUTF16_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip, tBoolean bLE)
{
unsigned short usChar, usCharToo;
unsigned long ulCode;
const char *pcChar;
ASSERT(pulSkip);
ASSERT(pcSrcChar);
ulCode = 0;
pcChar = pcSrcChar;
while(ulCount >= 2)
{
usChar = bLE ? (pcChar[0] + 256 * pcChar[1]) :
(pcChar[1] + 256 * pcChar[0]);
ulCount -= 2;
pcChar += 2;
if((usChar <= 0xD7FF) || (usChar >= 0xE000))
{
ulCode = (unsigned long)usChar;
break;
}
else
{
if((usChar >= 0xD800) && (usChar < 0xDC00))
{
if(ulCount >= 2)
{
usCharToo = bLE ? (pcChar[0] + 256 * pcChar[1]) :
(pcChar[1] + 256 * pcChar[0]);
if((usCharToo >= 0xDC00) && (usCharToo < 0xE000))
{
pcChar += 2;
ulCount -= 2;
ulCode = 0x10000 +
((unsigned long)(usChar - 0xD800) << 10) +
((unsigned long)usCharToo - 0xDC00);
break;
}
}
}
}
}
*pulSkip = (unsigned long)(pcChar - pcSrcChar);
return(ulCode);
} | [
"static",
"unsigned",
"long",
"GrMapUTF16_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
",",
"tBoolean",
"bLE",
")",
"{",
"unsigned",
"short",
"usChar",
",",
"usCharToo",
";",
"unsigned",
"long",
"ulCode",
";",
"const",
"char",
"*",
"pcChar",
";",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"ulCode",
"=",
"0",
";",
"pcChar",
"=",
"pcSrcChar",
";",
"while",
"(",
"ulCount",
">=",
"2",
")",
"{",
"usChar",
"=",
"bLE",
"?",
"(",
"pcChar",
"[",
"0",
"]",
"+",
"256",
"*",
"pcChar",
"[",
"1",
"]",
")",
":",
"(",
"pcChar",
"[",
"1",
"]",
"+",
"256",
"*",
"pcChar",
"[",
"0",
"]",
")",
";",
"ulCount",
"-=",
"2",
";",
"pcChar",
"+=",
"2",
";",
"if",
"(",
"(",
"usChar",
"<=",
"0xD7FF",
")",
"||",
"(",
"usChar",
">=",
"0xE000",
")",
")",
"{",
"ulCode",
"=",
"(",
"unsigned",
"long",
")",
"usChar",
";",
"break",
";",
"}",
"else",
"{",
"if",
"(",
"(",
"usChar",
">=",
"0xD800",
")",
"&&",
"(",
"usChar",
"<",
"0xDC00",
")",
")",
"{",
"if",
"(",
"ulCount",
">=",
"2",
")",
"{",
"usCharToo",
"=",
"bLE",
"?",
"(",
"pcChar",
"[",
"0",
"]",
"+",
"256",
"*",
"pcChar",
"[",
"1",
"]",
")",
":",
"(",
"pcChar",
"[",
"1",
"]",
"+",
"256",
"*",
"pcChar",
"[",
"0",
"]",
")",
";",
"if",
"(",
"(",
"usCharToo",
">=",
"0xDC00",
")",
"&&",
"(",
"usCharToo",
"<",
"0xE000",
")",
")",
"{",
"pcChar",
"+=",
"2",
";",
"ulCount",
"-=",
"2",
";",
"ulCode",
"=",
"0x10000",
"+",
"(",
"(",
"unsigned",
"long",
")",
"(",
"usChar",
"-",
"0xD800",
")",
"<<",
"10",
")",
"+",
"(",
"(",
"unsigned",
"long",
")",
"usCharToo",
"-",
"0xDC00",
")",
";",
"break",
";",
"}",
"}",
"}",
"}",
"}",
"*",
"pulSkip",
"=",
"(",
"unsigned",
"long",
")",
"(",
"pcChar",
"-",
"pcSrcChar",
")",
";",
"return",
"(",
"ulCode",
")",
";",
"}"
] | Maps a UTF-16LE or UTF-16BE encoded character to its Unicode equivalent. | [
"Maps",
"a",
"UTF",
"-",
"16LE",
"or",
"UTF",
"-",
"16BE",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// Walk the string until we find something valid that we can decode.\r",
"//\r",
"//\r",
"// Get a word from the string.\r",
"//\r",
"//\r",
"// Move to the next word and update our count.\r",
"//\r",
"//\r",
"// Is this a valid single-word encoding?\r",
"//\r",
"//\r",
"// Yes - return the value and tell the caller to skip the\r",
"// appropriate number of bytes to get to the end of this character.\r",
"//\r",
"//\r",
"// Is this a valid first word for a high surrogate (first word in a\r",
"// 2 word encoding)?\r",
"//\r",
"//\r",
"// Yes - this is valid. Now look ahead and see if the next\r",
"// word is valid as a low surrogate, assuming there are at\r",
"// least 2 more bytes for us to look at.\r",
"//\r",
"//\r",
"// Get the next word in the string.\r",
"//\r",
"//\r",
"// Is this a valid low surrogate?\r",
"//\r",
"//\r",
"// Yes, it's valid. Update our skip count and parse\r",
"// the Unicode codepoint from the two words we've read.\r",
"//\r",
"//\r",
"// Set the number of bytes to skip in the string to get past the\r",
"// character we just parsed and return the character codepoint if we\r",
"// found one.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
},
{
"param": "bLE",
"type": "tBoolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bLE",
"type": "tBoolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapUTF16LE_Unicode | null | unsigned long
GrMapUTF16LE_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Call the low level UTF parsing function and return the result.
//
return(GrMapUTF16_Unicode(pcSrcChar, ulCount, pulSkip, true));
} | //*****************************************************************************
//
//! Maps a UTF-16LE encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing UTF-16LE encoded text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in UTF-16LE format into 32 bit Unicode
//! typically used by wide character fonts. This conversion will read bytes
//! from the buffer and decode the first full UTF-16LE character found,
//! returning the Unicode code for that character and the number of bytes to
//! advance \e pcSrcChar by to point to the end of the decoded character. If
//! no valid UTF-16LE character is found, 0 is returned.
//!
//! See http://en.wikipedia.org/wiki/UTF-16 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! \e pcSrcChar string passed.
//
//*****************************************************************************
| Maps a UTF-16LE encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing UTF-16LE encoded text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in UTF-16LE format into 32 bit Unicode
typically used by wide character fonts. This conversion will read bytes
from the buffer and decode the first full UTF-16LE character found,
returning the Unicode code for that character and the number of bytes to
advance \e pcSrcChar by to point to the end of the decoded character. If
no valid UTF-16LE character is found, 0 is returned.
\return Returns the Unicode character code for the first character in the
\e pcSrcChar string passed. | [
"Maps",
"a",
"UTF",
"-",
"16LE",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"UTF",
"-",
"16LE",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"UTF",
"-",
"16LE",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"will",
"read",
"bytes",
"from",
"the",
"buffer",
"and",
"decode",
"the",
"first",
"full",
"UTF",
"-",
"16LE",
"character",
"found",
"returning",
"the",
"Unicode",
"code",
"for",
"that",
"character",
"and",
"the",
"number",
"of",
"bytes",
"to",
"advance",
"\\",
"e",
"pcSrcChar",
"by",
"to",
"point",
"to",
"the",
"end",
"of",
"the",
"decoded",
"character",
".",
"If",
"no",
"valid",
"UTF",
"-",
"16LE",
"character",
"is",
"found",
"0",
"is",
"returned",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"\\",
"e",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapUTF16LE_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
return(GrMapUTF16_Unicode(pcSrcChar, ulCount, pulSkip, true));
} | [
"unsigned",
"long",
"GrMapUTF16LE_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"return",
"(",
"GrMapUTF16_Unicode",
"(",
"pcSrcChar",
",",
"ulCount",
",",
"pulSkip",
",",
"true",
")",
")",
";",
"}"
] | Maps a UTF-16LE encoded character to its Unicode equivalent. | [
"Maps",
"a",
"UTF",
"-",
"16LE",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Call the low level UTF parsing function and return the result.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapUTF16BE_Unicode | null | unsigned long
GrMapUTF16BE_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Call the low level UTF parsing function and return the result.
//
return(GrMapUTF16_Unicode(pcSrcChar, ulCount, pulSkip, false));
} | //*****************************************************************************
//
//! Maps a UTF-16BE encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing UTF-16BE encoded text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in UTF-16BE format into 32 bit Unicode
//! typically used by wide character fonts. This conversion will read bytes
//! from the buffer and decode the first full UTF-16BE character found,
//! returning the Unicode code for that character and the number of bytes to
//! advance \e pcSrcChar by to point to the end of the decoded character. If
//! no valid UTF-16BE character is found, 0 is returned.
//!
//! See http://en.wikipedia.org/wiki/UTF-16 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! \e pcSrcChar string passed.
//
//*****************************************************************************
| Maps a UTF-16BE encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing UTF-16BE encoded text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in UTF-16BE format into 32 bit Unicode
typically used by wide character fonts. This conversion will read bytes
from the buffer and decode the first full UTF-16BE character found,
returning the Unicode code for that character and the number of bytes to
advance \e pcSrcChar by to point to the end of the decoded character. If
no valid UTF-16BE character is found, 0 is returned.
\return Returns the Unicode character code for the first character in the
\e pcSrcChar string passed. | [
"Maps",
"a",
"UTF",
"-",
"16BE",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"UTF",
"-",
"16BE",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"UTF",
"-",
"16BE",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"conversion",
"will",
"read",
"bytes",
"from",
"the",
"buffer",
"and",
"decode",
"the",
"first",
"full",
"UTF",
"-",
"16BE",
"character",
"found",
"returning",
"the",
"Unicode",
"code",
"for",
"that",
"character",
"and",
"the",
"number",
"of",
"bytes",
"to",
"advance",
"\\",
"e",
"pcSrcChar",
"by",
"to",
"point",
"to",
"the",
"end",
"of",
"the",
"decoded",
"character",
".",
"If",
"no",
"valid",
"UTF",
"-",
"16BE",
"character",
"is",
"found",
"0",
"is",
"returned",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"\\",
"e",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapUTF16BE_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
return(GrMapUTF16_Unicode(pcSrcChar, ulCount, pulSkip, false));
} | [
"unsigned",
"long",
"GrMapUTF16BE_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"return",
"(",
"GrMapUTF16_Unicode",
"(",
"pcSrcChar",
",",
"ulCount",
",",
"pulSkip",
",",
"false",
")",
")",
";",
"}"
] | Maps a UTF-16BE encoded character to its Unicode equivalent. | [
"Maps",
"a",
"UTF",
"-",
"16BE",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Call the low level UTF parsing function and return the result.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapUnicode_Unicode | null | unsigned long
GrMapUnicode_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// Do we have enough bytes to pull out a single 32 bit character code?
//
if(ulCount < 4)
{
//
// Return 0 to indicate an error since we don't have enough data to
// extract a single character code.
//
return(0);
}
else
{
//
// We have at least 4 bytes so tell the caller to skip 4 bytes to get
// the following character and return the Unicode codepoint represented
// by the first 4 bytes in the buffer.
//
*pulSkip = 4;
return(pcSrcChar[0] | (pcSrcChar[1] << 8) | (pcSrcChar[2] << 16) |
(pcSrcChar[3] << 24));
}
} | //*****************************************************************************
//
//! Maps an 32 bit Unicode encoded character to itself.
//!
//! \param pcSrcChar is a pointer to a string containing 32 bit Unicode text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in Unicode (UTF32) format into 32 bit
//! Unicode typically used by wide character fonts. This identity conversion is
//! trivial - we merely read 4 bytes at a time and return the 32 bit value they
//! contain. It is assumed that the text is encoded in little endian format.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps an 32 bit Unicode encoded character to itself.
\param pcSrcChar is a pointer to a string containing 32 bit Unicode text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in Unicode (UTF32) format into 32 bit
Unicode typically used by wide character fonts. This identity conversion is
trivial - we merely read 4 bytes at a time and return the 32 bit value they
contain. It is assumed that the text is encoded in little endian format.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"an",
"32",
"bit",
"Unicode",
"encoded",
"character",
"to",
"itself",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"32",
"bit",
"Unicode",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"Unicode",
"(",
"UTF32",
")",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"This",
"identity",
"conversion",
"is",
"trivial",
"-",
"we",
"merely",
"read",
"4",
"bytes",
"at",
"a",
"time",
"and",
"return",
"the",
"32",
"bit",
"value",
"they",
"contain",
".",
"It",
"is",
"assumed",
"that",
"the",
"text",
"is",
"encoded",
"in",
"little",
"endian",
"format",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapUnicode_Unicode(const char *pcSrcChar,
unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
if(ulCount < 4)
{
return(0);
}
else
{
*pulSkip = 4;
return(pcSrcChar[0] | (pcSrcChar[1] << 8) | (pcSrcChar[2] << 16) |
(pcSrcChar[3] << 24));
}
} | [
"unsigned",
"long",
"GrMapUnicode_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"if",
"(",
"ulCount",
"<",
"4",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"else",
"{",
"*",
"pulSkip",
"=",
"4",
";",
"return",
"(",
"pcSrcChar",
"[",
"0",
"]",
"|",
"(",
"pcSrcChar",
"[",
"1",
"]",
"<<",
"8",
")",
"|",
"(",
"pcSrcChar",
"[",
"2",
"]",
"<<",
"16",
")",
"|",
"(",
"pcSrcChar",
"[",
"3",
"]",
"<<",
"24",
")",
")",
";",
"}",
"}"
] | Maps an 32 bit Unicode encoded character to itself. | [
"Maps",
"an",
"32",
"bit",
"Unicode",
"encoded",
"character",
"to",
"itself",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// Do we have enough bytes to pull out a single 32 bit character code?\r",
"//\r",
"//\r",
"// Return 0 to indicate an error since we don't have enough data to\r",
"// extract a single character code.\r",
"//\r",
"//\r",
"// We have at least 4 bytes so tell the caller to skip 4 bytes to get\r",
"// the following character and return the Unicode codepoint represented\r",
"// by the first 4 bytes in the buffer.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapWIN1250_Unicode | null | unsigned long
GrMapWIN1250_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// WIN1250 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0x7F)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusWIN1250_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
} | //*****************************************************************************
//
//! Maps a WIN1250 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing WIN1250 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in WIN1250 format into 32 bit Unicode
//! typically used by wide character fonts. Windows-1250 is a codepage commonly
//! used in processing eastern European text. This conversion is
//! straightforward since character codes 0x7F and below map directly to the
//! same code in Unicode, and those from 0x80 to 0xFF are converted using a
//! global data table.
//!
//! See http://en.wikipedia.org/wiki/Windows-1250 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps a WIN1250 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing WIN1250 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in WIN1250 format into 32 bit Unicode
typically used by wide character fonts. Windows-1250 is a codepage commonly
used in processing eastern European text. This conversion is
straightforward since character codes 0x7F and below map directly to the
same code in Unicode, and those from 0x80 to 0xFF are converted using a
global data table.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"a",
"WIN1250",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"WIN1250",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"WIN1250",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Windows",
"-",
"1250",
"is",
"a",
"codepage",
"commonly",
"used",
"in",
"processing",
"eastern",
"European",
"text",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0x7F",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0x80",
"to",
"0xFF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapWIN1250_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0x7F)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusWIN1250_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
} | [
"unsigned",
"long",
"GrMapWIN1250_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0x7F",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusWIN1250_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0x80",
"]",
")",
";",
"}",
"}"
] | Maps a WIN1250 encoded character to its Unicode equivalent. | [
"Maps",
"a",
"WIN1250",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// WIN1250 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapWIN1251_Unicode | null | unsigned long
GrMapWIN1251_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// WIN1251 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0x7F)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if(((unsigned char)*pcSrcChar >= 0x80) &&
((unsigned char)*pcSrcChar <= 0xBF))
{
return((unsigned long)g_pusWIN1251_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x350);
}
} | //*****************************************************************************
//
//! Maps a WIN1251 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing WIN1251 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in WIN1251 format into 32 bit Unicode
//! typically used by wide character fonts. Windows-1251 is a codepage commonly
//! used in processing Cyrillic text. This conversion is straightforward
//! since character codes 0x7F and below map directly to the same code in
//! Unicode, those from 0x80 to 0xBF are converted using a global data table
//! and those from 0xC0 to 0xFF map to the Unicode by adding 0x350 to
//! the WIN1251 code.
//!
//! See http://en.wikipedia.org/wiki/Windows-1251 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps a WIN1251 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing WIN1251 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in WIN1251 format into 32 bit Unicode
typically used by wide character fonts. Windows-1251 is a codepage commonly
used in processing Cyrillic text. This conversion is straightforward
since character codes 0x7F and below map directly to the same code in
Unicode, those from 0x80 to 0xBF are converted using a global data table
and those from 0xC0 to 0xFF map to the Unicode by adding 0x350 to
the WIN1251 code.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"a",
"WIN1251",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"WIN1251",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"WIN1251",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Windows",
"-",
"1251",
"is",
"a",
"codepage",
"commonly",
"used",
"in",
"processing",
"Cyrillic",
"text",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0x7F",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"those",
"from",
"0x80",
"to",
"0xBF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
"and",
"those",
"from",
"0xC0",
"to",
"0xFF",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0x350",
"to",
"the",
"WIN1251",
"code",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapWIN1251_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0x7F)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if(((unsigned char)*pcSrcChar >= 0x80) &&
((unsigned char)*pcSrcChar <= 0xBF))
{
return((unsigned long)g_pusWIN1251_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x350);
}
} | [
"unsigned",
"long",
"GrMapWIN1251_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0x7F",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
">=",
"0x80",
")",
"&&",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xBF",
")",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusWIN1251_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0x80",
"]",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"+",
"0x350",
")",
";",
"}",
"}"
] | Maps a WIN1251 encoded character to its Unicode equivalent. | [
"Maps",
"a",
"WIN1251",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// WIN1251 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapWIN1252_Unicode | null | unsigned long
GrMapWIN1252_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// WIN1252 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if(((unsigned char)*pcSrcChar <= 0x7F) ||
((unsigned char)*pcSrcChar >= 0xA0))
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusWIN1252_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
} | //*****************************************************************************
//
//! Maps a WIN1252 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing WIN1252 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in WIN1252 format into 32 bit Unicode
//! typically used by wide character fonts. Windows-1252 is a codepage commonly
//! used in processing western European text. This conversion is
//! straightforward since character codes 0x7F and below, and 0xA0 and above
//! map directly to the same code in Unicode, and those from 0x80 to 0x9F are
//! converted using a global data table. This codepage can be thought of as a
//! superset of ISO8859-1 and text purported to be encoded in ISO8859-1 is
//! frequently processed using this codepage instead.
//!
//! See http://en.wikipedia.org/wiki/Windows-1252 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps a WIN1252 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing WIN1252 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in WIN1252 format into 32 bit Unicode
typically used by wide character fonts. Windows-1252 is a codepage commonly
used in processing western European text. This conversion is
straightforward since character codes 0x7F and below, and 0xA0 and above
map directly to the same code in Unicode, and those from 0x80 to 0x9F are
converted using a global data table. This codepage can be thought of as a
superset of ISO8859-1 and text purported to be encoded in ISO8859-1 is
frequently processed using this codepage instead.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"a",
"WIN1252",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"WIN1252",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"WIN1252",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Windows",
"-",
"1252",
"is",
"a",
"codepage",
"commonly",
"used",
"in",
"processing",
"western",
"European",
"text",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0x7F",
"and",
"below",
"and",
"0xA0",
"and",
"above",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"and",
"those",
"from",
"0x80",
"to",
"0x9F",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
".",
"This",
"codepage",
"can",
"be",
"thought",
"of",
"as",
"a",
"superset",
"of",
"ISO8859",
"-",
"1",
"and",
"text",
"purported",
"to",
"be",
"encoded",
"in",
"ISO8859",
"-",
"1",
"is",
"frequently",
"processed",
"using",
"this",
"codepage",
"instead",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapWIN1252_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if(((unsigned char)*pcSrcChar <= 0x7F) ||
((unsigned char)*pcSrcChar >= 0xA0))
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else
{
return((unsigned long)g_pusWIN1252_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
} | [
"unsigned",
"long",
"GrMapWIN1252_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0x7F",
")",
"||",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
">=",
"0xA0",
")",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusWIN1252_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0x80",
"]",
")",
";",
"}",
"}"
] | Maps a WIN1252 encoded character to its Unicode equivalent. | [
"Maps",
"a",
"WIN1252",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// WIN1252 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapWIN1253_Unicode | null | unsigned long
GrMapWIN1253_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// WIN1253 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if((unsigned char)*pcSrcChar <= 0x7F)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if(((unsigned char)*pcSrcChar >= 0x80) &&
((unsigned char)*pcSrcChar <= 0xBF))
{
//
// This is a character we remap via the global table.
//
return((unsigned long)g_pusWIN1253_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
else
{
//
// This is a character we can calculate the Unicode character code for.
//
return((unsigned long)((unsigned char)*pcSrcChar) + 0x2D0);
}
} | //*****************************************************************************
//
//! Maps a WIN1253 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing WIN1253 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in WIN1253 format into 32 bit Unicode
//! typically used by wide character fonts. Windows-1253 is a codepage commonly
//! used in processing Greek text. This conversion is straightforward
//! since character codes 0x7F and below map directly to the same code in
//! Unicode, those from 0x80 to 0xBF are converted using a global data table
//! and those from 0xC0 to 0xFF map to the Unicode by adding 0x2D0 to
//! the WIN1253 code.
//!
//! See http://en.wikipedia.org/wiki/Windows-1253 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps a WIN1253 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing WIN1253 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in WIN1253 format into 32 bit Unicode
typically used by wide character fonts. Windows-1253 is a codepage commonly
used in processing Greek text. This conversion is straightforward
since character codes 0x7F and below map directly to the same code in
Unicode, those from 0x80 to 0xBF are converted using a global data table
and those from 0xC0 to 0xFF map to the Unicode by adding 0x2D0 to
the WIN1253 code.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"a",
"WIN1253",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"WIN1253",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"WIN1253",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Windows",
"-",
"1253",
"is",
"a",
"codepage",
"commonly",
"used",
"in",
"processing",
"Greek",
"text",
".",
"This",
"conversion",
"is",
"straightforward",
"since",
"character",
"codes",
"0x7F",
"and",
"below",
"map",
"directly",
"to",
"the",
"same",
"code",
"in",
"Unicode",
"those",
"from",
"0x80",
"to",
"0xBF",
"are",
"converted",
"using",
"a",
"global",
"data",
"table",
"and",
"those",
"from",
"0xC0",
"to",
"0xFF",
"map",
"to",
"the",
"Unicode",
"by",
"adding",
"0x2D0",
"to",
"the",
"WIN1253",
"code",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapWIN1253_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if((unsigned char)*pcSrcChar <= 0x7F)
{
return((unsigned long)(unsigned char)*pcSrcChar);
}
else if(((unsigned char)*pcSrcChar >= 0x80) &&
((unsigned char)*pcSrcChar <= 0xBF))
{
return((unsigned long)g_pusWIN1253_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
else
{
return((unsigned long)((unsigned char)*pcSrcChar) + 0x2D0);
}
} | [
"unsigned",
"long",
"GrMapWIN1253_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0x7F",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
";",
"}",
"else",
"if",
"(",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
">=",
"0x80",
")",
"&&",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0xBF",
")",
")",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusWIN1253_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0x80",
"]",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
")",
"+",
"0x2D0",
")",
";",
"}",
"}"
] | Maps a WIN1253 encoded character to its Unicode equivalent. | [
"Maps",
"a",
"WIN1253",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// WIN1253 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r",
"//\r",
"// This is a character we remap via the global table.\r",
"//\r",
"//\r",
"// This is a character we can calculate the Unicode character code for.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
8f516b385d74de4c893fde31fd2eb24291aab11a | junyanl-code/Luminary-Micro-Library | grlib/charmap.c | [
"BSD-3-Clause"
] | C | GrMapWIN1254_Unicode | null | unsigned long
GrMapWIN1254_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
//
// Parameter sanity check.
//
ASSERT(pulSkip);
ASSERT(pcSrcChar);
//
// WIN1254 mappings are all 8 bits so we skip a single byte for each
// character.
//
*pulSkip = 1;
//
// Is this character one of those which maps directly to Unicode?
//
if(((unsigned char)*pcSrcChar <= 0x7F) ||
((unsigned char)*pcSrcChar >= 0xA0))
{
return(GrMapISO8859_9_Unicode(pcSrcChar, ulCount, pulSkip));
}
else
{
//
// This is a character we remap via the global table.
//
return((unsigned long)g_pusWIN1254_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
} | //*****************************************************************************
//
//! Maps a WIN1254 encoded character to its Unicode equivalent.
//!
//! \param pcSrcChar is a pointer to a string containing WIN1254 encoded
//! text.
//! \param ulCount is the number of bytes in the buffer pointed to by
//! pcSrcChar.
//! \param pulSkip points to storage that will be written with the number of
//! bytes to skip in pcSrcChar to get to the next character in the
//! buffer.
//!
//! This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
//! structure to map source text in WIN1254 format into 32 bit Unicode
//! typically used by wide character fonts. Windows-1254 is a codepage commonly
//! used in processing Turkish text. It is compatible with ISO8859-9 but adds
//! several printable characters in the 0x80-0x9F range.
//!
//! See http://en.wikipedia.org/wiki/Windows-1254 for more information.
//!
//! \return Returns the Unicode character code for the first character in the
//! pcSrcChar string passed.
//
//*****************************************************************************
| Maps a WIN1254 encoded character to its Unicode equivalent.
\param pcSrcChar is a pointer to a string containing WIN1254 encoded
text.
\param ulCount is the number of bytes in the buffer pointed to by
pcSrcChar.
\param pulSkip points to storage that will be written with the number of
bytes to skip in pcSrcChar to get to the next character in the
buffer.
This function may be passed to GrCodepageMapTableSet() in a tCodePointMap
structure to map source text in WIN1254 format into 32 bit Unicode
typically used by wide character fonts. Windows-1254 is a codepage commonly
used in processing Turkish text. It is compatible with ISO8859-9 but adds
several printable characters in the 0x80-0x9F range.
\return Returns the Unicode character code for the first character in the
pcSrcChar string passed. | [
"Maps",
"a",
"WIN1254",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
".",
"\\",
"param",
"pcSrcChar",
"is",
"a",
"pointer",
"to",
"a",
"string",
"containing",
"WIN1254",
"encoded",
"text",
".",
"\\",
"param",
"ulCount",
"is",
"the",
"number",
"of",
"bytes",
"in",
"the",
"buffer",
"pointed",
"to",
"by",
"pcSrcChar",
".",
"\\",
"param",
"pulSkip",
"points",
"to",
"storage",
"that",
"will",
"be",
"written",
"with",
"the",
"number",
"of",
"bytes",
"to",
"skip",
"in",
"pcSrcChar",
"to",
"get",
"to",
"the",
"next",
"character",
"in",
"the",
"buffer",
".",
"This",
"function",
"may",
"be",
"passed",
"to",
"GrCodepageMapTableSet",
"()",
"in",
"a",
"tCodePointMap",
"structure",
"to",
"map",
"source",
"text",
"in",
"WIN1254",
"format",
"into",
"32",
"bit",
"Unicode",
"typically",
"used",
"by",
"wide",
"character",
"fonts",
".",
"Windows",
"-",
"1254",
"is",
"a",
"codepage",
"commonly",
"used",
"in",
"processing",
"Turkish",
"text",
".",
"It",
"is",
"compatible",
"with",
"ISO8859",
"-",
"9",
"but",
"adds",
"several",
"printable",
"characters",
"in",
"the",
"0x80",
"-",
"0x9F",
"range",
".",
"\\",
"return",
"Returns",
"the",
"Unicode",
"character",
"code",
"for",
"the",
"first",
"character",
"in",
"the",
"pcSrcChar",
"string",
"passed",
"."
] | unsigned long
GrMapWIN1254_Unicode(const char *pcSrcChar, unsigned long ulCount,
unsigned long *pulSkip)
{
ASSERT(pulSkip);
ASSERT(pcSrcChar);
*pulSkip = 1;
if(((unsigned char)*pcSrcChar <= 0x7F) ||
((unsigned char)*pcSrcChar >= 0xA0))
{
return(GrMapISO8859_9_Unicode(pcSrcChar, ulCount, pulSkip));
}
else
{
return((unsigned long)g_pusWIN1254_Unicode[
(unsigned char)*pcSrcChar - 0x80]);
}
} | [
"unsigned",
"long",
"GrMapWIN1254_Unicode",
"(",
"const",
"char",
"*",
"pcSrcChar",
",",
"unsigned",
"long",
"ulCount",
",",
"unsigned",
"long",
"*",
"pulSkip",
")",
"{",
"ASSERT",
"(",
"pulSkip",
")",
";",
"ASSERT",
"(",
"pcSrcChar",
")",
";",
"*",
"pulSkip",
"=",
"1",
";",
"if",
"(",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"<=",
"0x7F",
")",
"||",
"(",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
">=",
"0xA0",
")",
")",
"{",
"return",
"(",
"GrMapISO8859_9_Unicode",
"(",
"pcSrcChar",
",",
"ulCount",
",",
"pulSkip",
")",
")",
";",
"}",
"else",
"{",
"return",
"(",
"(",
"unsigned",
"long",
")",
"g_pusWIN1254_Unicode",
"[",
"(",
"unsigned",
"char",
")",
"*",
"pcSrcChar",
"-",
"0x80",
"]",
")",
";",
"}",
"}"
] | Maps a WIN1254 encoded character to its Unicode equivalent. | [
"Maps",
"a",
"WIN1254",
"encoded",
"character",
"to",
"its",
"Unicode",
"equivalent",
"."
] | [
"//\r",
"// Parameter sanity check.\r",
"//\r",
"//\r",
"// WIN1254 mappings are all 8 bits so we skip a single byte for each\r",
"// character.\r",
"//\r",
"//\r",
"// Is this character one of those which maps directly to Unicode?\r",
"//\r",
"//\r",
"// This is a character we remap via the global table.\r",
"//\r"
] | [
{
"param": "pcSrcChar",
"type": "char"
},
{
"param": "ulCount",
"type": "unsigned long"
},
{
"param": "pulSkip",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcSrcChar",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulCount",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pulSkip",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | SetStatusText | void | void
SetStatusText(const char *pcTitle, const char *pcLine1, const char *pcLine2,
const char *pcLine3)
{
static const char cBlankLine[] = " ";
//
// Check to see if each parameter was passed, and if so then update its
// text field on the status dislay.
//
pcTitle = pcTitle ? pcTitle : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS_TITLE, pcTitle);
pcLine1 = pcLine1 ? pcLine1 : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS1, pcLine1);
pcLine2 = pcLine2 ? pcLine2 : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS2, pcLine2);
pcLine3 = pcLine3 ? pcLine3 : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS3, pcLine3);
//
// Force a repaint after all the status text fields have been updated.
//
WidgetPaint(WIDGET_ROOT);
WidgetMessageQueueProcess();
} | //*****************************************************************************
//
// Provide a simple function so other parts of the application can update
// a status display.
//
//*****************************************************************************
| Provide a simple function so other parts of the application can update
a status display. | [
"Provide",
"a",
"simple",
"function",
"so",
"other",
"parts",
"of",
"the",
"application",
"can",
"update",
"a",
"status",
"display",
"."
] | void
SetStatusText(const char *pcTitle, const char *pcLine1, const char *pcLine2,
const char *pcLine3)
{
static const char cBlankLine[] = " ";
pcTitle = pcTitle ? pcTitle : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS_TITLE, pcTitle);
pcLine1 = pcLine1 ? pcLine1 : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS1, pcLine1);
pcLine2 = pcLine2 ? pcLine2 : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS2, pcLine2);
pcLine3 = pcLine3 ? pcLine3 : cBlankLine;
MenuUpdateText(TEXT_ITEM_STATUS3, pcLine3);
WidgetPaint(WIDGET_ROOT);
WidgetMessageQueueProcess();
} | [
"void",
"SetStatusText",
"(",
"const",
"char",
"*",
"pcTitle",
",",
"const",
"char",
"*",
"pcLine1",
",",
"const",
"char",
"*",
"pcLine2",
",",
"const",
"char",
"*",
"pcLine3",
")",
"{",
"static",
"const",
"char",
"cBlankLine",
"[",
"]",
"=",
"\"",
"\"",
";",
"pcTitle",
"=",
"pcTitle",
"?",
"pcTitle",
":",
"cBlankLine",
";",
"MenuUpdateText",
"(",
"TEXT_ITEM_STATUS_TITLE",
",",
"pcTitle",
")",
";",
"pcLine1",
"=",
"pcLine1",
"?",
"pcLine1",
":",
"cBlankLine",
";",
"MenuUpdateText",
"(",
"TEXT_ITEM_STATUS1",
",",
"pcLine1",
")",
";",
"pcLine2",
"=",
"pcLine2",
"?",
"pcLine2",
":",
"cBlankLine",
";",
"MenuUpdateText",
"(",
"TEXT_ITEM_STATUS2",
",",
"pcLine2",
")",
";",
"pcLine3",
"=",
"pcLine3",
"?",
"pcLine3",
":",
"cBlankLine",
";",
"MenuUpdateText",
"(",
"TEXT_ITEM_STATUS3",
",",
"pcLine3",
")",
";",
"WidgetPaint",
"(",
"WIDGET_ROOT",
")",
";",
"WidgetMessageQueueProcess",
"(",
")",
";",
"}"
] | Provide a simple function so other parts of the application can update
a status display. | [
"Provide",
"a",
"simple",
"function",
"so",
"other",
"parts",
"of",
"the",
"application",
"can",
"update",
"a",
"status",
"display",
"."
] | [
"//\r",
"// Check to see if each parameter was passed, and if so then update its\r",
"// text field on the status dislay.\r",
"//\r",
"//\r",
"// Force a repaint after all the status text fields have been updated.\r",
"//\r"
] | [
{
"param": "pcTitle",
"type": "char"
},
{
"param": "pcLine1",
"type": "char"
},
{
"param": "pcLine2",
"type": "char"
},
{
"param": "pcLine3",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcTitle",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pcLine1",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pcLine2",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pcLine3",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | SysTickIntHandler | void | void
SysTickIntHandler(void)
{
//
// Increment the tick count.
//
g_ulTickCount++;
} | //*****************************************************************************
//
// Handles the SysTick timeout interrupt.
//
//*****************************************************************************
| Handles the SysTick timeout interrupt. | [
"Handles",
"the",
"SysTick",
"timeout",
"interrupt",
"."
] | void
SysTickIntHandler(void)
{
g_ulTickCount++;
} | [
"void",
"SysTickIntHandler",
"(",
"void",
")",
"{",
"g_ulTickCount",
"++",
";",
"}"
] | Handles the SysTick timeout interrupt. | [
"Handles",
"the",
"SysTick",
"timeout",
"interrupt",
"."
] | [
"//\r",
"// Increment the tick count.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | GetTickms | null | unsigned long
GetTickms(void)
{
unsigned long ulRetVal;
unsigned long ulSaved;
static unsigned long ulLastTick = 0;
ulRetVal = g_ulTickCount;
ulSaved = ulRetVal;
if(ulSaved > ulLastTick)
{
ulRetVal = ulSaved - ulLastTick;
}
else
{
ulRetVal = ulLastTick - ulSaved;
}
//
// This could miss a few milliseconds but the timings here are on a
// much larger scale.
//
ulLastTick = ulSaved;
//
// Return the number of milliseconds since the last time this was called.
//
return(ulRetVal * MS_PER_SYSTICK);
} | //*****************************************************************************
//
// This function returns the number of ticks since the last time this function
// was called.
//
//*****************************************************************************
| This function returns the number of ticks since the last time this function
was called. | [
"This",
"function",
"returns",
"the",
"number",
"of",
"ticks",
"since",
"the",
"last",
"time",
"this",
"function",
"was",
"called",
"."
] | unsigned long
GetTickms(void)
{
unsigned long ulRetVal;
unsigned long ulSaved;
static unsigned long ulLastTick = 0;
ulRetVal = g_ulTickCount;
ulSaved = ulRetVal;
if(ulSaved > ulLastTick)
{
ulRetVal = ulSaved - ulLastTick;
}
else
{
ulRetVal = ulLastTick - ulSaved;
}
ulLastTick = ulSaved;
return(ulRetVal * MS_PER_SYSTICK);
} | [
"unsigned",
"long",
"GetTickms",
"(",
"void",
")",
"{",
"unsigned",
"long",
"ulRetVal",
";",
"unsigned",
"long",
"ulSaved",
";",
"static",
"unsigned",
"long",
"ulLastTick",
"=",
"0",
";",
"ulRetVal",
"=",
"g_ulTickCount",
";",
"ulSaved",
"=",
"ulRetVal",
";",
"if",
"(",
"ulSaved",
">",
"ulLastTick",
")",
"{",
"ulRetVal",
"=",
"ulSaved",
"-",
"ulLastTick",
";",
"}",
"else",
"{",
"ulRetVal",
"=",
"ulLastTick",
"-",
"ulSaved",
";",
"}",
"ulLastTick",
"=",
"ulSaved",
";",
"return",
"(",
"ulRetVal",
"*",
"MS_PER_SYSTICK",
")",
";",
"}"
] | This function returns the number of ticks since the last time this function
was called. | [
"This",
"function",
"returns",
"the",
"number",
"of",
"ticks",
"since",
"the",
"last",
"time",
"this",
"function",
"was",
"called",
"."
] | [
"//\r",
"// This could miss a few milliseconds but the timings here are on a\r",
"// much larger scale.\r",
"//\r",
"//\r",
"// Return the number of milliseconds since the last time this was called.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | ModeCallback | void | static void
ModeCallback(unsigned long ulIndex, tUSBMode eMode)
{
//
// Save the new mode.
//
g_eCurrentUSBMode = eMode;
//
// Mode-specific handling code could go here.
//
switch(eMode)
{
case USB_MODE_HOST:
{
break;
}
case USB_MODE_DEVICE:
{
break;
}
case USB_MODE_NONE:
{
break;
}
default:
{
break;
}
}
} | //*****************************************************************************
//
// Callback function for USB OTG mode changes.
//
//*****************************************************************************
| Callback function for USB OTG mode changes. | [
"Callback",
"function",
"for",
"USB",
"OTG",
"mode",
"changes",
"."
] | static void
ModeCallback(unsigned long ulIndex, tUSBMode eMode)
{
g_eCurrentUSBMode = eMode;
switch(eMode)
{
case USB_MODE_HOST:
{
break;
}
case USB_MODE_DEVICE:
{
break;
}
case USB_MODE_NONE:
{
break;
}
default:
{
break;
}
}
} | [
"static",
"void",
"ModeCallback",
"(",
"unsigned",
"long",
"ulIndex",
",",
"tUSBMode",
"eMode",
")",
"{",
"g_eCurrentUSBMode",
"=",
"eMode",
";",
"switch",
"(",
"eMode",
")",
"{",
"case",
"USB_MODE_HOST",
":",
"{",
"break",
";",
"}",
"case",
"USB_MODE_DEVICE",
":",
"{",
"break",
";",
"}",
"case",
"USB_MODE_NONE",
":",
"{",
"break",
";",
"}",
"default",
":",
"{",
"break",
";",
"}",
"}",
"}"
] | Callback function for USB OTG mode changes. | [
"Callback",
"function",
"for",
"USB",
"OTG",
"mode",
"changes",
"."
] | [
"//\r",
"// Save the new mode.\r",
"//\r",
"//\r",
"// Mode-specific handling code could go here.\r",
"//\r"
] | [
{
"param": "ulIndex",
"type": "unsigned long"
},
{
"param": "eMode",
"type": "tUSBMode"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ulIndex",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "eMode",
"type": "tUSBMode",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | GetSavedState | int | static int
GetSavedState(tConfigState *pState)
{
unsigned long ulStateLen = sizeof(tConfigState) / 4;
unsigned short usCrc16;
//
// Check the arguments
//
ASSERT(pState);
if(!pState)
{
return(1);
}
//
// Read a block from hibernation memory into the application state
// structure.
//
HibernateDataGet((unsigned long *)pState, ulStateLen);
//
// Check first to see if the "cookie" value is correct.
//
if(pState->ulCookie != STATE_COOKIE)
{
return(1);
}
//
// Find the 16-bit CRC of the block. The CRC is stored in the last
// location, so subtract 1 word from the count.
//
usCrc16 = ROM_Crc16Array(ulStateLen - 1, (const unsigned long *)pState);
//
// If the CRC does not match, then the block is not good.
//
if(pState->ulCrc16 != (unsigned long)usCrc16)
{
return(1);
}
//
// At this point the state structure that was retrieved from the
// battery backed memory has been validated, so return it as a valid
// logger state configuration.
//
return(0);
} | //*****************************************************************************
//
// Gets the logger configuration from battery backed memory.
// The configuration is read from the memory in the Hibernate module.
// It is checked for validity. If found to be valid the function returns a
// 0. If not valid, then it returns non-zero.
//
//*****************************************************************************
| Gets the logger configuration from battery backed memory.
The configuration is read from the memory in the Hibernate module.
It is checked for validity. If found to be valid the function returns a
0. If not valid, then it returns non-zero. | [
"Gets",
"the",
"logger",
"configuration",
"from",
"battery",
"backed",
"memory",
".",
"The",
"configuration",
"is",
"read",
"from",
"the",
"memory",
"in",
"the",
"Hibernate",
"module",
".",
"It",
"is",
"checked",
"for",
"validity",
".",
"If",
"found",
"to",
"be",
"valid",
"the",
"function",
"returns",
"a",
"0",
".",
"If",
"not",
"valid",
"then",
"it",
"returns",
"non",
"-",
"zero",
"."
] | static int
GetSavedState(tConfigState *pState)
{
unsigned long ulStateLen = sizeof(tConfigState) / 4;
unsigned short usCrc16;
ASSERT(pState);
if(!pState)
{
return(1);
}
HibernateDataGet((unsigned long *)pState, ulStateLen);
if(pState->ulCookie != STATE_COOKIE)
{
return(1);
}
usCrc16 = ROM_Crc16Array(ulStateLen - 1, (const unsigned long *)pState);
if(pState->ulCrc16 != (unsigned long)usCrc16)
{
return(1);
}
return(0);
} | [
"static",
"int",
"GetSavedState",
"(",
"tConfigState",
"*",
"pState",
")",
"{",
"unsigned",
"long",
"ulStateLen",
"=",
"sizeof",
"(",
"tConfigState",
")",
"/",
"4",
";",
"unsigned",
"short",
"usCrc16",
";",
"ASSERT",
"(",
"pState",
")",
";",
"if",
"(",
"!",
"pState",
")",
"{",
"return",
"(",
"1",
")",
";",
"}",
"HibernateDataGet",
"(",
"(",
"unsigned",
"long",
"*",
")",
"pState",
",",
"ulStateLen",
")",
";",
"if",
"(",
"pState",
"->",
"ulCookie",
"!=",
"STATE_COOKIE",
")",
"{",
"return",
"(",
"1",
")",
";",
"}",
"usCrc16",
"=",
"ROM_Crc16Array",
"(",
"ulStateLen",
"-",
"1",
",",
"(",
"const",
"unsigned",
"long",
"*",
")",
"pState",
")",
";",
"if",
"(",
"pState",
"->",
"ulCrc16",
"!=",
"(",
"unsigned",
"long",
")",
"usCrc16",
")",
"{",
"return",
"(",
"1",
")",
";",
"}",
"return",
"(",
"0",
")",
";",
"}"
] | Gets the logger configuration from battery backed memory. | [
"Gets",
"the",
"logger",
"configuration",
"from",
"battery",
"backed",
"memory",
"."
] | [
"//\r",
"// Check the arguments\r",
"//\r",
"//\r",
"// Read a block from hibernation memory into the application state\r",
"// structure.\r",
"//\r",
"//\r",
"// Check first to see if the \"cookie\" value is correct.\r",
"//\r",
"//\r",
"// Find the 16-bit CRC of the block. The CRC is stored in the last\r",
"// location, so subtract 1 word from the count.\r",
"//\r",
"//\r",
"// If the CRC does not match, then the block is not good.\r",
"//\r",
"//\r",
"// At this point the state structure that was retrieved from the\r",
"// battery backed memory has been validated, so return it as a valid\r",
"// logger state configuration.\r",
"//\r"
] | [
{
"param": "pState",
"type": "tConfigState"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pState",
"type": "tConfigState",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | SetSavedState | void | static void
SetSavedState(tConfigState *pState)
{
unsigned long ulStateLen = sizeof(tConfigState) / 4;
unsigned short usCrc16;
//
// Check the arguments.
//
ASSERT(pState);
if(pState)
{
//
// Write the cookie value to the block
//
pState->ulCookie = STATE_COOKIE;
//
// Find the 16-bit CRC of the block. The CRC is stored in the last
// location, so subtract 1 word from the count.
//
usCrc16 = ROM_Crc16Array(ulStateLen - 1,
(const unsigned long *)pState);
//
// Save the computed CRC into the structure.
//
pState->ulCrc16 = (unsigned long)usCrc16;
//
// Now write the entire block to the Hibernate memory.
//
HibernateDataSet((unsigned long *)pState, ulStateLen);
}
} | //*****************************************************************************
//
// Stores the logger configuration to battery backed memory in the
// Hibernation module. The configuration is saved with a cookie value and
// a CRC in order to ensure validity.
//
//*****************************************************************************
| Stores the logger configuration to battery backed memory in the
Hibernation module. The configuration is saved with a cookie value and
a CRC in order to ensure validity. | [
"Stores",
"the",
"logger",
"configuration",
"to",
"battery",
"backed",
"memory",
"in",
"the",
"Hibernation",
"module",
".",
"The",
"configuration",
"is",
"saved",
"with",
"a",
"cookie",
"value",
"and",
"a",
"CRC",
"in",
"order",
"to",
"ensure",
"validity",
"."
] | static void
SetSavedState(tConfigState *pState)
{
unsigned long ulStateLen = sizeof(tConfigState) / 4;
unsigned short usCrc16;
ASSERT(pState);
if(pState)
{
pState->ulCookie = STATE_COOKIE;
usCrc16 = ROM_Crc16Array(ulStateLen - 1,
(const unsigned long *)pState);
pState->ulCrc16 = (unsigned long)usCrc16;
HibernateDataSet((unsigned long *)pState, ulStateLen);
}
} | [
"static",
"void",
"SetSavedState",
"(",
"tConfigState",
"*",
"pState",
")",
"{",
"unsigned",
"long",
"ulStateLen",
"=",
"sizeof",
"(",
"tConfigState",
")",
"/",
"4",
";",
"unsigned",
"short",
"usCrc16",
";",
"ASSERT",
"(",
"pState",
")",
";",
"if",
"(",
"pState",
")",
"{",
"pState",
"->",
"ulCookie",
"=",
"STATE_COOKIE",
";",
"usCrc16",
"=",
"ROM_Crc16Array",
"(",
"ulStateLen",
"-",
"1",
",",
"(",
"const",
"unsigned",
"long",
"*",
")",
"pState",
")",
";",
"pState",
"->",
"ulCrc16",
"=",
"(",
"unsigned",
"long",
")",
"usCrc16",
";",
"HibernateDataSet",
"(",
"(",
"unsigned",
"long",
"*",
")",
"pState",
",",
"ulStateLen",
")",
";",
"}",
"}"
] | Stores the logger configuration to battery backed memory in the
Hibernation module. | [
"Stores",
"the",
"logger",
"configuration",
"to",
"battery",
"backed",
"memory",
"in",
"the",
"Hibernation",
"module",
"."
] | [
"//\r",
"// Check the arguments.\r",
"//\r",
"//\r",
"// Write the cookie value to the block\r",
"//\r",
"//\r",
"// Find the 16-bit CRC of the block. The CRC is stored in the last\r",
"// location, so subtract 1 word from the count.\r",
"//\r",
"//\r",
"// Save the computed CRC into the structure.\r",
"//\r",
"//\r",
"// Now write the entire block to the Hibernate memory.\r",
"//\r"
] | [
{
"param": "pState",
"type": "tConfigState"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pState",
"type": "tConfigState",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | GetDefaultState | void | static void
GetDefaultState(tConfigState *pState)
{
//
// Check the arguments
//
ASSERT(pState);
if(pState)
{
//
// get the default values from the menu system
//
MenuGetDefaultState(pState);
//
// Set the filename to a null string
//
pState->cFilename[0] = 0;
//
// Set bogus address for flash storage
//
pState->ulFlashStore = 0;
//
// Turn off sleep logging
//
pState->ulSleepLogging = 0;
}
} | //*****************************************************************************
//
// Populate the application configuration with default values.
//
//*****************************************************************************
| Populate the application configuration with default values. | [
"Populate",
"the",
"application",
"configuration",
"with",
"default",
"values",
"."
] | static void
GetDefaultState(tConfigState *pState)
{
ASSERT(pState);
if(pState)
{
MenuGetDefaultState(pState);
pState->cFilename[0] = 0;
pState->ulFlashStore = 0;
pState->ulSleepLogging = 0;
}
} | [
"static",
"void",
"GetDefaultState",
"(",
"tConfigState",
"*",
"pState",
")",
"{",
"ASSERT",
"(",
"pState",
")",
";",
"if",
"(",
"pState",
")",
"{",
"MenuGetDefaultState",
"(",
"pState",
")",
";",
"pState",
"->",
"cFilename",
"[",
"0",
"]",
"=",
"0",
";",
"pState",
"->",
"ulFlashStore",
"=",
"0",
";",
"pState",
"->",
"ulSleepLogging",
"=",
"0",
";",
"}",
"}"
] | Populate the application configuration with default values. | [
"Populate",
"the",
"application",
"configuration",
"with",
"default",
"values",
"."
] | [
"//\r",
"// Check the arguments\r",
"//\r",
"//\r",
"// get the default values from the menu system\r",
"//\r",
"//\r",
"// Set the filename to a null string\r",
"//\r",
"//\r",
"// Set bogus address for flash storage\r",
"//\r",
"//\r",
"// Turn off sleep logging\r",
"//\r"
] | [
{
"param": "pState",
"type": "tConfigState"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pState",
"type": "tConfigState",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | SendWidgetKeyMessage | void | static void
SendWidgetKeyMessage(unsigned long ulMsg)
{
WidgetMessageQueueAdd(WIDGET_ROOT, ulMsg, g_ulKeyFocusWidgetHandle,
0, 1, 1);
} | //*****************************************************************************
//
// Sends a button press message to whichever widget has the button focus.
//
//*****************************************************************************
| Sends a button press message to whichever widget has the button focus. | [
"Sends",
"a",
"button",
"press",
"message",
"to",
"whichever",
"widget",
"has",
"the",
"button",
"focus",
"."
] | static void
SendWidgetKeyMessage(unsigned long ulMsg)
{
WidgetMessageQueueAdd(WIDGET_ROOT, ulMsg, g_ulKeyFocusWidgetHandle,
0, 1, 1);
} | [
"static",
"void",
"SendWidgetKeyMessage",
"(",
"unsigned",
"long",
"ulMsg",
")",
"{",
"WidgetMessageQueueAdd",
"(",
"WIDGET_ROOT",
",",
"ulMsg",
",",
"g_ulKeyFocusWidgetHandle",
",",
"0",
",",
"1",
",",
"1",
")",
";",
"}"
] | Sends a button press message to whichever widget has the button focus. | [
"Sends",
"a",
"button",
"press",
"message",
"to",
"whichever",
"widget",
"has",
"the",
"button",
"focus",
"."
] | [] | [
{
"param": "ulMsg",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "ulMsg",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | WidgetActivated | void | static void
WidgetActivated(tWidget *pWidget, tSlideMenuItem *pMenuItem,
tBoolean bActivated)
{
char *pcMenuText;
//
// Handle the activation or deactivation of the strip chart. The
// strip chart widget is activated when the user selects the START menu.
//
if(pWidget == &g_sStripChart.sBase)
{
//
// If the strip chart is activated, start the logger running.
//
if(bActivated)
{
//
// Get the current state of the menus
//
MenuGetState(&g_sConfigState);
//
// Save the state in battery backed memory
//
SetSavedState(&g_sConfigState);
//
// Start logger and update the logger state
//
AcquireStart(&g_sConfigState);
g_sLoggerState = STATE_LOGGING;
}
//
// If the strip chart is deactivated, stop the logger.
//
else
{
AcquireStop();
g_sLoggerState = STATE_IDLE;
}
}
//
// Handle the activation or deactivation of any of the container
// canvas that is used for showing the acquired data as a numerical
// display. This happens when the VIEW menu is used.
//
else if((pWidget == &g_sAINContainerCanvas.sBase) ||
(pWidget == &g_sAccelContainerCanvas.sBase) ||
(pWidget == &g_sCurrentContainerCanvas.sBase) ||
(pWidget == &g_sClockContainerCanvas.sBase) ||
(pWidget == &g_sTempContainerCanvas.sBase))
{
//
// A viewer has been activated.
//
if(bActivated)
{
static tConfigState sLocalState;
//
// Get the current menu configuration state and save it in a local
// storage.
//
MenuGetState(&sLocalState);
//
// Modify the state to set values that are suitable for using
// with the viewer. The acquisition rate is set to 1/2 second
// and all channels are selected. The storage medium is set to
// "viewer" so the acquistion module will write the value of
// acquired data to the appropriate viewing canvas.
//
sLocalState.ucStorage = CONFIG_STORAGE_VIEWER;
sLocalState.ulPeriod = 0x00000040;
sLocalState.usSelectedMask = 0x3ff;
//
// Start the acquisition module running.
//
AcquireStart(&sLocalState);
g_sLoggerState = STATE_VIEWING;
}
//
// The viewer has been deactivated so turn off the acquisition module.
//
else
{
AcquireStop();
g_sLoggerState = STATE_IDLE;
}
}
//
// Handle the case when a status display has been activated. This can
// occur when any of several menu items are selected.
//
else if(pWidget == &g_sStatusContainerCanvas.sBase)
{
//
// Get pointer to the text of the current menu item.
//
if(pMenuItem)
{
pcMenuText = pMenuItem->pcText;
}
else
{
return;
}
//
// If activated from the SAVE menu, then the flash data needs to be
// saved to USB stick. Enter the saving state.
//
if(!strcmp(pcMenuText, "SAVE"))
{
if(bActivated)
{
g_sLoggerState = STATE_SAVING;
}
else
{
g_sLoggerState = STATE_IDLE;
}
}
//
// If activated from the ERASE menu, then the flash data needs to be
// erased. Enter the erasing state.
//
else if(!strcmp(pcMenuText, "ERASE DATA?"))
{
if(bActivated)
{
g_sLoggerState = STATE_ERASING;
}
else
{
g_sLoggerState = STATE_IDLE;
}
}
//
// If activated from the FLASH SPACE menu, then the user will be shown
// a report on the amount of free space in flash. Enter the reporting
// state.
//
else if(!strcmp(pcMenuText, "FLASH SPACE"))
{
if(bActivated)
{
g_sLoggerState = STATE_FREEFLASH;
}
else
{
g_sLoggerState = STATE_IDLE;
}
}
}
//
// Handle the activation of the clock setting widget. Deactivation is
// handled through a separate callback.
//
else if(pWidget == &g_sClockSetter.sBase)
{
unsigned long ulRTC;
//
// If the clock setter is activated, load the time structure fields.
//
if(bActivated)
{
//
// Get the current time in seconds from the RTC.
//
ulRTC = HibernateRTCGet();
//
// Convert the RTC time to a time structure.
//
ulocaltime(ulRTC, &g_sTimeClock);
//
// Set the callback that will be called when the clock setting
// widget is deactivated. Since the clock setting widget needs
// to take over the focus for button events, it uses a separate
// callback when it is finsihed.
//
ClockSetCallbackSet((tClockSetWidget *)pWidget,
ClockSetOkCallback);
//
// Give the clock setter widget focus for the button events
//
g_ulKeyFocusWidgetHandle = (unsigned long)pWidget;
g_sLoggerState = STATE_CLOCKSET;
}
}
} | //*****************************************************************************
//
// Callback function from the menu widget. This function is called whenever
// the menu is used to activate a child widget that is associated with the
// menu. It is also called when the widget is deactivated and control is
// returned to the menu widget. It can be used to trigger different actions
// depending on which menus are chosen, and to track the state of the
// application and control focus for the user interface.
//
// This function is called in the context of widget tree message processing
// so care should be taken if doing any operation that affects the display
// or widget tree.
//
//*****************************************************************************
| Callback function from the menu widget. This function is called whenever
the menu is used to activate a child widget that is associated with the
menu. It is also called when the widget is deactivated and control is
returned to the menu widget. It can be used to trigger different actions
depending on which menus are chosen, and to track the state of the
application and control focus for the user interface.
This function is called in the context of widget tree message processing
so care should be taken if doing any operation that affects the display
or widget tree. | [
"Callback",
"function",
"from",
"the",
"menu",
"widget",
".",
"This",
"function",
"is",
"called",
"whenever",
"the",
"menu",
"is",
"used",
"to",
"activate",
"a",
"child",
"widget",
"that",
"is",
"associated",
"with",
"the",
"menu",
".",
"It",
"is",
"also",
"called",
"when",
"the",
"widget",
"is",
"deactivated",
"and",
"control",
"is",
"returned",
"to",
"the",
"menu",
"widget",
".",
"It",
"can",
"be",
"used",
"to",
"trigger",
"different",
"actions",
"depending",
"on",
"which",
"menus",
"are",
"chosen",
"and",
"to",
"track",
"the",
"state",
"of",
"the",
"application",
"and",
"control",
"focus",
"for",
"the",
"user",
"interface",
".",
"This",
"function",
"is",
"called",
"in",
"the",
"context",
"of",
"widget",
"tree",
"message",
"processing",
"so",
"care",
"should",
"be",
"taken",
"if",
"doing",
"any",
"operation",
"that",
"affects",
"the",
"display",
"or",
"widget",
"tree",
"."
] | static void
WidgetActivated(tWidget *pWidget, tSlideMenuItem *pMenuItem,
tBoolean bActivated)
{
char *pcMenuText;
if(pWidget == &g_sStripChart.sBase)
{
if(bActivated)
{
MenuGetState(&g_sConfigState);
SetSavedState(&g_sConfigState);
AcquireStart(&g_sConfigState);
g_sLoggerState = STATE_LOGGING;
}
else
{
AcquireStop();
g_sLoggerState = STATE_IDLE;
}
}
else if((pWidget == &g_sAINContainerCanvas.sBase) ||
(pWidget == &g_sAccelContainerCanvas.sBase) ||
(pWidget == &g_sCurrentContainerCanvas.sBase) ||
(pWidget == &g_sClockContainerCanvas.sBase) ||
(pWidget == &g_sTempContainerCanvas.sBase))
{
if(bActivated)
{
static tConfigState sLocalState;
MenuGetState(&sLocalState);
sLocalState.ucStorage = CONFIG_STORAGE_VIEWER;
sLocalState.ulPeriod = 0x00000040;
sLocalState.usSelectedMask = 0x3ff;
AcquireStart(&sLocalState);
g_sLoggerState = STATE_VIEWING;
}
else
{
AcquireStop();
g_sLoggerState = STATE_IDLE;
}
}
else if(pWidget == &g_sStatusContainerCanvas.sBase)
{
if(pMenuItem)
{
pcMenuText = pMenuItem->pcText;
}
else
{
return;
}
if(!strcmp(pcMenuText, "SAVE"))
{
if(bActivated)
{
g_sLoggerState = STATE_SAVING;
}
else
{
g_sLoggerState = STATE_IDLE;
}
}
else if(!strcmp(pcMenuText, "ERASE DATA?"))
{
if(bActivated)
{
g_sLoggerState = STATE_ERASING;
}
else
{
g_sLoggerState = STATE_IDLE;
}
}
else if(!strcmp(pcMenuText, "FLASH SPACE"))
{
if(bActivated)
{
g_sLoggerState = STATE_FREEFLASH;
}
else
{
g_sLoggerState = STATE_IDLE;
}
}
}
else if(pWidget == &g_sClockSetter.sBase)
{
unsigned long ulRTC;
if(bActivated)
{
ulRTC = HibernateRTCGet();
ulocaltime(ulRTC, &g_sTimeClock);
ClockSetCallbackSet((tClockSetWidget *)pWidget,
ClockSetOkCallback);
g_ulKeyFocusWidgetHandle = (unsigned long)pWidget;
g_sLoggerState = STATE_CLOCKSET;
}
}
} | [
"static",
"void",
"WidgetActivated",
"(",
"tWidget",
"*",
"pWidget",
",",
"tSlideMenuItem",
"*",
"pMenuItem",
",",
"tBoolean",
"bActivated",
")",
"{",
"char",
"*",
"pcMenuText",
";",
"if",
"(",
"pWidget",
"==",
"&",
"g_sStripChart",
".",
"sBase",
")",
"{",
"if",
"(",
"bActivated",
")",
"{",
"MenuGetState",
"(",
"&",
"g_sConfigState",
")",
";",
"SetSavedState",
"(",
"&",
"g_sConfigState",
")",
";",
"AcquireStart",
"(",
"&",
"g_sConfigState",
")",
";",
"g_sLoggerState",
"=",
"STATE_LOGGING",
";",
"}",
"else",
"{",
"AcquireStop",
"(",
")",
";",
"g_sLoggerState",
"=",
"STATE_IDLE",
";",
"}",
"}",
"else",
"if",
"(",
"(",
"pWidget",
"==",
"&",
"g_sAINContainerCanvas",
".",
"sBase",
")",
"||",
"(",
"pWidget",
"==",
"&",
"g_sAccelContainerCanvas",
".",
"sBase",
")",
"||",
"(",
"pWidget",
"==",
"&",
"g_sCurrentContainerCanvas",
".",
"sBase",
")",
"||",
"(",
"pWidget",
"==",
"&",
"g_sClockContainerCanvas",
".",
"sBase",
")",
"||",
"(",
"pWidget",
"==",
"&",
"g_sTempContainerCanvas",
".",
"sBase",
")",
")",
"{",
"if",
"(",
"bActivated",
")",
"{",
"static",
"tConfigState",
"sLocalState",
";",
"MenuGetState",
"(",
"&",
"sLocalState",
")",
";",
"sLocalState",
".",
"ucStorage",
"=",
"CONFIG_STORAGE_VIEWER",
";",
"sLocalState",
".",
"ulPeriod",
"=",
"0x00000040",
";",
"sLocalState",
".",
"usSelectedMask",
"=",
"0x3ff",
";",
"AcquireStart",
"(",
"&",
"sLocalState",
")",
";",
"g_sLoggerState",
"=",
"STATE_VIEWING",
";",
"}",
"else",
"{",
"AcquireStop",
"(",
")",
";",
"g_sLoggerState",
"=",
"STATE_IDLE",
";",
"}",
"}",
"else",
"if",
"(",
"pWidget",
"==",
"&",
"g_sStatusContainerCanvas",
".",
"sBase",
")",
"{",
"if",
"(",
"pMenuItem",
")",
"{",
"pcMenuText",
"=",
"pMenuItem",
"->",
"pcText",
";",
"}",
"else",
"{",
"return",
";",
"}",
"if",
"(",
"!",
"strcmp",
"(",
"pcMenuText",
",",
"\"",
"\"",
")",
")",
"{",
"if",
"(",
"bActivated",
")",
"{",
"g_sLoggerState",
"=",
"STATE_SAVING",
";",
"}",
"else",
"{",
"g_sLoggerState",
"=",
"STATE_IDLE",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"pcMenuText",
",",
"\"",
"\"",
")",
")",
"{",
"if",
"(",
"bActivated",
")",
"{",
"g_sLoggerState",
"=",
"STATE_ERASING",
";",
"}",
"else",
"{",
"g_sLoggerState",
"=",
"STATE_IDLE",
";",
"}",
"}",
"else",
"if",
"(",
"!",
"strcmp",
"(",
"pcMenuText",
",",
"\"",
"\"",
")",
")",
"{",
"if",
"(",
"bActivated",
")",
"{",
"g_sLoggerState",
"=",
"STATE_FREEFLASH",
";",
"}",
"else",
"{",
"g_sLoggerState",
"=",
"STATE_IDLE",
";",
"}",
"}",
"}",
"else",
"if",
"(",
"pWidget",
"==",
"&",
"g_sClockSetter",
".",
"sBase",
")",
"{",
"unsigned",
"long",
"ulRTC",
";",
"if",
"(",
"bActivated",
")",
"{",
"ulRTC",
"=",
"HibernateRTCGet",
"(",
")",
";",
"ulocaltime",
"(",
"ulRTC",
",",
"&",
"g_sTimeClock",
")",
";",
"ClockSetCallbackSet",
"(",
"(",
"tClockSetWidget",
"*",
")",
"pWidget",
",",
"ClockSetOkCallback",
")",
";",
"g_ulKeyFocusWidgetHandle",
"=",
"(",
"unsigned",
"long",
")",
"pWidget",
";",
"g_sLoggerState",
"=",
"STATE_CLOCKSET",
";",
"}",
"}",
"}"
] | Callback function from the menu widget. | [
"Callback",
"function",
"from",
"the",
"menu",
"widget",
"."
] | [
"//\r",
"// Handle the activation or deactivation of the strip chart. The\r",
"// strip chart widget is activated when the user selects the START menu.\r",
"//\r",
"//\r",
"// If the strip chart is activated, start the logger running.\r",
"//\r",
"//\r",
"// Get the current state of the menus\r",
"//\r",
"//\r",
"// Save the state in battery backed memory\r",
"//\r",
"//\r",
"// Start logger and update the logger state\r",
"//\r",
"//\r",
"// If the strip chart is deactivated, stop the logger.\r",
"//\r",
"//\r",
"// Handle the activation or deactivation of any of the container\r",
"// canvas that is used for showing the acquired data as a numerical\r",
"// display. This happens when the VIEW menu is used.\r",
"//\r",
"//\r",
"// A viewer has been activated.\r",
"//\r",
"//\r",
"// Get the current menu configuration state and save it in a local\r",
"// storage.\r",
"//\r",
"//\r",
"// Modify the state to set values that are suitable for using\r",
"// with the viewer. The acquisition rate is set to 1/2 second\r",
"// and all channels are selected. The storage medium is set to\r",
"// \"viewer\" so the acquistion module will write the value of\r",
"// acquired data to the appropriate viewing canvas.\r",
"//\r",
"//\r",
"// Start the acquisition module running.\r",
"//\r",
"//\r",
"// The viewer has been deactivated so turn off the acquisition module.\r",
"//\r",
"//\r",
"// Handle the case when a status display has been activated. This can\r",
"// occur when any of several menu items are selected.\r",
"//\r",
"//\r",
"// Get pointer to the text of the current menu item.\r",
"//\r",
"//\r",
"// If activated from the SAVE menu, then the flash data needs to be\r",
"// saved to USB stick. Enter the saving state.\r",
"//\r",
"//\r",
"// If activated from the ERASE menu, then the flash data needs to be\r",
"// erased. Enter the erasing state.\r",
"//\r",
"//\r",
"// If activated from the FLASH SPACE menu, then the user will be shown\r",
"// a report on the amount of free space in flash. Enter the reporting\r",
"// state.\r",
"//\r",
"//\r",
"// Handle the activation of the clock setting widget. Deactivation is\r",
"// handled through a separate callback.\r",
"//\r",
"//\r",
"// If the clock setter is activated, load the time structure fields.\r",
"//\r",
"//\r",
"// Get the current time in seconds from the RTC.\r",
"//\r",
"//\r",
"// Convert the RTC time to a time structure.\r",
"//\r",
"//\r",
"// Set the callback that will be called when the clock setting\r",
"// widget is deactivated. Since the clock setting widget needs\r",
"// to take over the focus for button events, it uses a separate\r",
"// callback when it is finsihed.\r",
"//\r",
"//\r",
"// Give the clock setter widget focus for the button events\r",
"//\r"
] | [
{
"param": "pWidget",
"type": "tWidget"
},
{
"param": "pMenuItem",
"type": "tSlideMenuItem"
},
{
"param": "bActivated",
"type": "tBoolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pWidget",
"type": "tWidget",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "pMenuItem",
"type": "tSlideMenuItem",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bActivated",
"type": "tBoolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
55528de65506c087ade5aa49fb35e3dad9fe9818 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/qs-logger.c | [
"BSD-3-Clause"
] | C | ClockSetOkCallback | void | static void
ClockSetOkCallback(tWidget *pWidget, tBoolean bOk)
{
unsigned long ulRTC;
//
// Only update the RTC if the OK button was selected.
//
if(bOk)
{
//
// Convert the time structure that was altered by the clock setting
// widget into seconds.
//
ulRTC = umktime(&g_sTimeClock);
//
// If the conversion was valid, then write the updated clock to the
// Hibernate RTC.
//
if(ulRTC != (unsigned long)(-1))
{
HibernateRTCSet(ulRTC);
}
}
//
// Set the state to clock exit so some cleanup can be done from the
// main loop.
//
g_sLoggerState = STATE_CLOCKEXIT;
} | //*****************************************************************************
//
// This function is called when the user clicks OK or CANCEL in the clock
// setting widget.
//
//*****************************************************************************
| This function is called when the user clicks OK or CANCEL in the clock
setting widget. | [
"This",
"function",
"is",
"called",
"when",
"the",
"user",
"clicks",
"OK",
"or",
"CANCEL",
"in",
"the",
"clock",
"setting",
"widget",
"."
] | static void
ClockSetOkCallback(tWidget *pWidget, tBoolean bOk)
{
unsigned long ulRTC;
if(bOk)
{
ulRTC = umktime(&g_sTimeClock);
if(ulRTC != (unsigned long)(-1))
{
HibernateRTCSet(ulRTC);
}
}
g_sLoggerState = STATE_CLOCKEXIT;
} | [
"static",
"void",
"ClockSetOkCallback",
"(",
"tWidget",
"*",
"pWidget",
",",
"tBoolean",
"bOk",
")",
"{",
"unsigned",
"long",
"ulRTC",
";",
"if",
"(",
"bOk",
")",
"{",
"ulRTC",
"=",
"umktime",
"(",
"&",
"g_sTimeClock",
")",
";",
"if",
"(",
"ulRTC",
"!=",
"(",
"unsigned",
"long",
")",
"(",
"-1",
")",
")",
"{",
"HibernateRTCSet",
"(",
"ulRTC",
")",
";",
"}",
"}",
"g_sLoggerState",
"=",
"STATE_CLOCKEXIT",
";",
"}"
] | This function is called when the user clicks OK or CANCEL in the clock
setting widget. | [
"This",
"function",
"is",
"called",
"when",
"the",
"user",
"clicks",
"OK",
"or",
"CANCEL",
"in",
"the",
"clock",
"setting",
"widget",
"."
] | [
"//\r",
"// Only update the RTC if the OK button was selected.\r",
"//\r",
"//\r",
"// Convert the time structure that was altered by the clock setting\r",
"// widget into seconds.\r",
"//\r",
"//\r",
"// If the conversion was valid, then write the updated clock to the\r",
"// Hibernate RTC.\r",
"//\r",
"//\r",
"// Set the state to clock exit so some cleanup can be done from the\r",
"// main loop.\r",
"//\r"
] | [
{
"param": "pWidget",
"type": "tWidget"
},
{
"param": "bOk",
"type": "tBoolean"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pWidget",
"type": "tWidget",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "bOk",
"type": "tBoolean",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7b515cd22f8b7624c416b2680022f089c747cc60 | junyanl-code/Luminary-Micro-Library | boards/dk-lm3s9d96/usb_dev_audio/usb_dev_audio.c | [
"BSD-3-Clause"
] | C | USBBufferCallback | void | void
USBBufferCallback(void *pvBuffer, unsigned long ulParam, unsigned long ulEvent)
{
//
// Increment the fill pointer.
//
g_sBuffer.pucFill += AUDIO_PACKET_SIZE;
//
// At the mid point of the fill buffer check for sample rate drift.
//
if((g_sBuffer.pucFill - g_sBuffer.pucBuffer) == (AUDIO_BUFFER_SIZE >> 1))
{
//
// See if we are running slow or fast.
//
if(g_sBuffer.pucPlay > g_sBuffer.pucFill)
{
//
// See if the play buffer has fallen behind enough to trigger
// adjusting the sample rate.
//
if((g_sBuffer.pucBuffer + AUDIO_BUFFER_SIZE -
(AUDIO_PACKET_SIZE * 2)) > g_sBuffer.pucPlay)
{
//
// Only allow an adjustment of at most one fractional bit.
//
if(g_sBuffer.iAdjust >= 0)
{
//
// Adjust the sample rate down slightly
//
SysCtlI2SMClkAdjust(-1);
g_sBuffer.iAdjust--;
}
}
}
else
{
//
// See if the play buffer has started leading by enough to trigger
// adjusting the sample rate.
//
if((g_sBuffer.pucBuffer + (AUDIO_PACKET_SIZE * 2)) <
g_sBuffer.pucPlay)
{
//
// Only allow an adjustment of at most one fractional bit.
//
if(g_sBuffer.iAdjust <= 0)
{
//
// Adjust the sample rate up slightly
//
SysCtlI2SMClkAdjust(1);
g_sBuffer.iAdjust++;
}
}
}
//
// See if the device is currently playing.
//
if((g_sBuffer.ulFlags & SBUFFER_FLAGS_PLAYING) == 0)
{
//
// Start playing at the current play pointer.
//
g_sBuffer.ulFlags |= SBUFFER_FLAGS_PLAYING;
SoundBufferPlay((unsigned char *)g_sBuffer.pucPlay,
AUDIO_PACKET_SIZE, SoundBufferCallback);
}
}
//
// Wrap the buffer back to the beginning.
//
if((g_sBuffer.pucFill - g_sBuffer.pucBuffer) == AUDIO_BUFFER_SIZE)
{
g_sBuffer.pucFill = g_sBuffer.pucBuffer;
}
//
// Allow the USB audio class to fill the next buffer.
//
USBAudioBufferOut(g_pvAudioDevice, (unsigned char *)g_sBuffer.pucFill,
AUDIO_PACKET_SIZE, USBBufferCallback);
} | //****************************************************************************
//
// Handler for buffers coming from the USB audio device class.
//
//****************************************************************************
| Handler for buffers coming from the USB audio device class. | [
"Handler",
"for",
"buffers",
"coming",
"from",
"the",
"USB",
"audio",
"device",
"class",
"."
] | void
USBBufferCallback(void *pvBuffer, unsigned long ulParam, unsigned long ulEvent)
{
g_sBuffer.pucFill += AUDIO_PACKET_SIZE;
if((g_sBuffer.pucFill - g_sBuffer.pucBuffer) == (AUDIO_BUFFER_SIZE >> 1))
{
if(g_sBuffer.pucPlay > g_sBuffer.pucFill)
{
if((g_sBuffer.pucBuffer + AUDIO_BUFFER_SIZE -
(AUDIO_PACKET_SIZE * 2)) > g_sBuffer.pucPlay)
{
if(g_sBuffer.iAdjust >= 0)
{
SysCtlI2SMClkAdjust(-1);
g_sBuffer.iAdjust--;
}
}
}
else
{
if((g_sBuffer.pucBuffer + (AUDIO_PACKET_SIZE * 2)) <
g_sBuffer.pucPlay)
{
if(g_sBuffer.iAdjust <= 0)
{
SysCtlI2SMClkAdjust(1);
g_sBuffer.iAdjust++;
}
}
}
if((g_sBuffer.ulFlags & SBUFFER_FLAGS_PLAYING) == 0)
{
g_sBuffer.ulFlags |= SBUFFER_FLAGS_PLAYING;
SoundBufferPlay((unsigned char *)g_sBuffer.pucPlay,
AUDIO_PACKET_SIZE, SoundBufferCallback);
}
}
if((g_sBuffer.pucFill - g_sBuffer.pucBuffer) == AUDIO_BUFFER_SIZE)
{
g_sBuffer.pucFill = g_sBuffer.pucBuffer;
}
USBAudioBufferOut(g_pvAudioDevice, (unsigned char *)g_sBuffer.pucFill,
AUDIO_PACKET_SIZE, USBBufferCallback);
} | [
"void",
"USBBufferCallback",
"(",
"void",
"*",
"pvBuffer",
",",
"unsigned",
"long",
"ulParam",
",",
"unsigned",
"long",
"ulEvent",
")",
"{",
"g_sBuffer",
".",
"pucFill",
"+=",
"AUDIO_PACKET_SIZE",
";",
"if",
"(",
"(",
"g_sBuffer",
".",
"pucFill",
"-",
"g_sBuffer",
".",
"pucBuffer",
")",
"==",
"(",
"AUDIO_BUFFER_SIZE",
">>",
"1",
")",
")",
"{",
"if",
"(",
"g_sBuffer",
".",
"pucPlay",
">",
"g_sBuffer",
".",
"pucFill",
")",
"{",
"if",
"(",
"(",
"g_sBuffer",
".",
"pucBuffer",
"+",
"AUDIO_BUFFER_SIZE",
"-",
"(",
"AUDIO_PACKET_SIZE",
"*",
"2",
")",
")",
">",
"g_sBuffer",
".",
"pucPlay",
")",
"{",
"if",
"(",
"g_sBuffer",
".",
"iAdjust",
">=",
"0",
")",
"{",
"SysCtlI2SMClkAdjust",
"(",
"-1",
")",
";",
"g_sBuffer",
".",
"iAdjust",
"--",
";",
"}",
"}",
"}",
"else",
"{",
"if",
"(",
"(",
"g_sBuffer",
".",
"pucBuffer",
"+",
"(",
"AUDIO_PACKET_SIZE",
"*",
"2",
")",
")",
"<",
"g_sBuffer",
".",
"pucPlay",
")",
"{",
"if",
"(",
"g_sBuffer",
".",
"iAdjust",
"<=",
"0",
")",
"{",
"SysCtlI2SMClkAdjust",
"(",
"1",
")",
";",
"g_sBuffer",
".",
"iAdjust",
"++",
";",
"}",
"}",
"}",
"if",
"(",
"(",
"g_sBuffer",
".",
"ulFlags",
"&",
"SBUFFER_FLAGS_PLAYING",
")",
"==",
"0",
")",
"{",
"g_sBuffer",
".",
"ulFlags",
"|=",
"SBUFFER_FLAGS_PLAYING",
";",
"SoundBufferPlay",
"(",
"(",
"unsigned",
"char",
"*",
")",
"g_sBuffer",
".",
"pucPlay",
",",
"AUDIO_PACKET_SIZE",
",",
"SoundBufferCallback",
")",
";",
"}",
"}",
"if",
"(",
"(",
"g_sBuffer",
".",
"pucFill",
"-",
"g_sBuffer",
".",
"pucBuffer",
")",
"==",
"AUDIO_BUFFER_SIZE",
")",
"{",
"g_sBuffer",
".",
"pucFill",
"=",
"g_sBuffer",
".",
"pucBuffer",
";",
"}",
"USBAudioBufferOut",
"(",
"g_pvAudioDevice",
",",
"(",
"unsigned",
"char",
"*",
")",
"g_sBuffer",
".",
"pucFill",
",",
"AUDIO_PACKET_SIZE",
",",
"USBBufferCallback",
")",
";",
"}"
] | Handler for buffers coming from the USB audio device class. | [
"Handler",
"for",
"buffers",
"coming",
"from",
"the",
"USB",
"audio",
"device",
"class",
"."
] | [
"//\r",
"// Increment the fill pointer.\r",
"//\r",
"//\r",
"// At the mid point of the fill buffer check for sample rate drift.\r",
"//\r",
"//\r",
"// See if we are running slow or fast.\r",
"//\r",
"//\r",
"// See if the play buffer has fallen behind enough to trigger\r",
"// adjusting the sample rate.\r",
"//\r",
"//\r",
"// Only allow an adjustment of at most one fractional bit.\r",
"//\r",
"//\r",
"// Adjust the sample rate down slightly\r",
"//\r",
"//\r",
"// See if the play buffer has started leading by enough to trigger\r",
"// adjusting the sample rate.\r",
"//\r",
"//\r",
"// Only allow an adjustment of at most one fractional bit.\r",
"//\r",
"//\r",
"// Adjust the sample rate up slightly\r",
"//\r",
"//\r",
"// See if the device is currently playing.\r",
"//\r",
"//\r",
"// Start playing at the current play pointer.\r",
"//\r",
"//\r",
"// Wrap the buffer back to the beginning.\r",
"//\r",
"//\r",
"// Allow the USB audio class to fill the next buffer.\r",
"//\r"
] | [
{
"param": "pvBuffer",
"type": "void"
},
{
"param": "ulParam",
"type": "unsigned long"
},
{
"param": "ulEvent",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pvBuffer",
"type": "void",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulParam",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulEvent",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
7b515cd22f8b7624c416b2680022f089c747cc60 | junyanl-code/Luminary-Micro-Library | boards/dk-lm3s9d96/usb_dev_audio/usb_dev_audio.c | [
"BSD-3-Clause"
] | C | UpdateVolume | void | void
UpdateVolume(void)
{
char cString[12];
short sVolume;
//
// Get the current volume in percentage.
//
sVolume = CONVERT_TO_PERCENT(g_sVolume);
//
// Create the volume string.
//
usprintf(cString, "Volume:%3d%%", sVolume);
//
// Update the volume string.
//
GrStringDraw(&g_sContext, cString, -1, 120,
DISPLAY_STATUS_TEXT_POSY, 1);
//
// Don't update the actual volume if muted.
//
if(HWREGBITW(&g_ulFlags, FLAG_MUTED) == 0)
{
//
// Set the volume to the current setting.
//
SoundVolumeSet(sVolume);
}
} | //****************************************************************************
//
// This function updates the volume as well as the volume status bar.
//
//****************************************************************************
| This function updates the volume as well as the volume status bar. | [
"This",
"function",
"updates",
"the",
"volume",
"as",
"well",
"as",
"the",
"volume",
"status",
"bar",
"."
] | void
UpdateVolume(void)
{
char cString[12];
short sVolume;
sVolume = CONVERT_TO_PERCENT(g_sVolume);
usprintf(cString, "Volume:%3d%%", sVolume);
GrStringDraw(&g_sContext, cString, -1, 120,
DISPLAY_STATUS_TEXT_POSY, 1);
if(HWREGBITW(&g_ulFlags, FLAG_MUTED) == 0)
{
SoundVolumeSet(sVolume);
}
} | [
"void",
"UpdateVolume",
"(",
"void",
")",
"{",
"char",
"cString",
"[",
"12",
"]",
";",
"short",
"sVolume",
";",
"sVolume",
"=",
"CONVERT_TO_PERCENT",
"(",
"g_sVolume",
")",
";",
"usprintf",
"(",
"cString",
",",
"\"",
"\"",
",",
"sVolume",
")",
";",
"GrStringDraw",
"(",
"&",
"g_sContext",
",",
"cString",
",",
"-1",
",",
"120",
",",
"DISPLAY_STATUS_TEXT_POSY",
",",
"1",
")",
";",
"if",
"(",
"HWREGBITW",
"(",
"&",
"g_ulFlags",
",",
"FLAG_MUTED",
")",
"==",
"0",
")",
"{",
"SoundVolumeSet",
"(",
"sVolume",
")",
";",
"}",
"}"
] | This function updates the volume as well as the volume status bar. | [
"This",
"function",
"updates",
"the",
"volume",
"as",
"well",
"as",
"the",
"volume",
"status",
"bar",
"."
] | [
"//\r",
"// Get the current volume in percentage.\r",
"//\r",
"//\r",
"// Create the volume string.\r",
"//\r",
"//\r",
"// Update the volume string.\r",
"//\r",
"//\r",
"// Don't update the actual volume if muted.\r",
"//\r",
"//\r",
"// Set the volume to the current setting.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
7b515cd22f8b7624c416b2680022f089c747cc60 | junyanl-code/Luminary-Micro-Library | boards/dk-lm3s9d96/usb_dev_audio/usb_dev_audio.c | [
"BSD-3-Clause"
] | C | UpdateStatus | void | void
UpdateStatus(void)
{
tRectangle sRect;
//
// Fill the bottom rows of the screen with blue to create the status area.
//
sRect.sXMin = 0;
sRect.sYMin = GrContextDpyHeightGet(&g_sContext) -
DISPLAY_BANNER_HEIGHT - 1;
sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT;
GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG);
GrRectFill(&g_sContext, &sRect);
//
// Put a white box around the banner.
//
GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_FG);
GrRectDraw(&g_sContext, &sRect);
//
// Put the application name in the middle of the banner.
//
GrContextFontSet(&g_sContext, g_pFontFixed6x8);
GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG);
//
// Update the status on the screen.
//
if(HWREGBITW(&g_ulFlags, FLAG_CONNECTED))
{
//
// Device is currently connected.
//
GrStringDraw(&g_sContext, "Connected", -1, 4, DISPLAY_STATUS_TEXT_POSY,
0);
//
// Update the current mute setting.
//
UpdateMute();
//
// Update the current volume setting.
//
UpdateVolume();
}
else
{
//
// Keyboard is currently disconnected.
//
GrStringDraw(&g_sContext, "Disconnected", -1, 4, sRect.sYMin + 8, 0);
}
} | //****************************************************************************
//
// This function updates the status area of the screen. It uses the current
// state of the application to print the status bar.
//
//****************************************************************************
| This function updates the status area of the screen. It uses the current
state of the application to print the status bar. | [
"This",
"function",
"updates",
"the",
"status",
"area",
"of",
"the",
"screen",
".",
"It",
"uses",
"the",
"current",
"state",
"of",
"the",
"application",
"to",
"print",
"the",
"status",
"bar",
"."
] | void
UpdateStatus(void)
{
tRectangle sRect;
sRect.sXMin = 0;
sRect.sYMin = GrContextDpyHeightGet(&g_sContext) -
DISPLAY_BANNER_HEIGHT - 1;
sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1;
sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT;
GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG);
GrRectFill(&g_sContext, &sRect);
GrContextForegroundSet(&g_sContext, DISPLAY_TEXT_FG);
GrRectDraw(&g_sContext, &sRect);
GrContextFontSet(&g_sContext, g_pFontFixed6x8);
GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG);
if(HWREGBITW(&g_ulFlags, FLAG_CONNECTED))
{
GrStringDraw(&g_sContext, "Connected", -1, 4, DISPLAY_STATUS_TEXT_POSY,
0);
UpdateMute();
UpdateVolume();
}
else
{
GrStringDraw(&g_sContext, "Disconnected", -1, 4, sRect.sYMin + 8, 0);
}
} | [
"void",
"UpdateStatus",
"(",
"void",
")",
"{",
"tRectangle",
"sRect",
";",
"sRect",
".",
"sXMin",
"=",
"0",
";",
"sRect",
".",
"sYMin",
"=",
"GrContextDpyHeightGet",
"(",
"&",
"g_sContext",
")",
"-",
"DISPLAY_BANNER_HEIGHT",
"-",
"1",
";",
"sRect",
".",
"sXMax",
"=",
"GrContextDpyWidthGet",
"(",
"&",
"g_sContext",
")",
"-",
"1",
";",
"sRect",
".",
"sYMax",
"=",
"sRect",
".",
"sYMin",
"+",
"DISPLAY_BANNER_HEIGHT",
";",
"GrContextForegroundSet",
"(",
"&",
"g_sContext",
",",
"DISPLAY_BANNER_BG",
")",
";",
"GrRectFill",
"(",
"&",
"g_sContext",
",",
"&",
"sRect",
")",
";",
"GrContextForegroundSet",
"(",
"&",
"g_sContext",
",",
"DISPLAY_TEXT_FG",
")",
";",
"GrRectDraw",
"(",
"&",
"g_sContext",
",",
"&",
"sRect",
")",
";",
"GrContextFontSet",
"(",
"&",
"g_sContext",
",",
"g_pFontFixed6x8",
")",
";",
"GrContextBackgroundSet",
"(",
"&",
"g_sContext",
",",
"DISPLAY_BANNER_BG",
")",
";",
"if",
"(",
"HWREGBITW",
"(",
"&",
"g_ulFlags",
",",
"FLAG_CONNECTED",
")",
")",
"{",
"GrStringDraw",
"(",
"&",
"g_sContext",
",",
"\"",
"\"",
",",
"-1",
",",
"4",
",",
"DISPLAY_STATUS_TEXT_POSY",
",",
"0",
")",
";",
"UpdateMute",
"(",
")",
";",
"UpdateVolume",
"(",
")",
";",
"}",
"else",
"{",
"GrStringDraw",
"(",
"&",
"g_sContext",
",",
"\"",
"\"",
",",
"-1",
",",
"4",
",",
"sRect",
".",
"sYMin",
"+",
"8",
",",
"0",
")",
";",
"}",
"}"
] | This function updates the status area of the screen. | [
"This",
"function",
"updates",
"the",
"status",
"area",
"of",
"the",
"screen",
"."
] | [
"//\r",
"// Fill the bottom rows of the screen with blue to create the status area.\r",
"//\r",
"//\r",
"// Put a white box around the banner.\r",
"//\r",
"//\r",
"// Put the application name in the middle of the banner.\r",
"//\r",
"//\r",
"// Update the status on the screen.\r",
"//\r",
"//\r",
"// Device is currently connected.\r",
"//\r",
"//\r",
"// Update the current mute setting.\r",
"//\r",
"//\r",
"// Update the current volume setting.\r",
"//\r",
"//\r",
"// Keyboard is currently disconnected.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
79f21ffe16743c7ef1e338330fe3ac1ec919dc72 | junyanl-code/Luminary-Micro-Library | boards/ek-lm3s3748/sd_card/sd_card.c | [
"BSD-3-Clause"
] | C | Cmd_ls | int | int
Cmd_ls(int argc, char *argv[])
{
unsigned long ulTotalSize;
unsigned long ulFileCount;
unsigned long ulDirCount;
FRESULT fresult;
FATFS *pFatFs;
//
// Open the current directory for access.
//
fresult = f_opendir(&g_sDirObject, g_cCwdBuf);
//
// Check for error and return if there is a problem.
//
if(fresult != FR_OK)
{
return(fresult);
}
ulTotalSize = 0;
ulFileCount = 0;
ulDirCount = 0;
//
// Give an extra blank line before the listing.
//
UARTprintf("\n");
//
// Enter loop to enumerate through all directory entries.
//
for(;;)
{
//
// Read an entry from the directory.
//
fresult = f_readdir(&g_sDirObject, &g_sFileInfo);
//
// Check for error and return if there is a problem.
//
if(fresult != FR_OK)
{
return(fresult);
}
//
// If the file name is blank, then this is the end of the listing.
//
if(!g_sFileInfo.fname[0])
{
break;
}
//
// If the attribue is directory, then increment the directory count.
//
if(g_sFileInfo.fattrib & AM_DIR)
{
ulDirCount++;
}
//
// Otherwise, it is a file. Increment the file count, and add in the
// file size to the total.
//
else
{
ulFileCount++;
ulTotalSize += g_sFileInfo.fsize;
}
//
// Print the entry information on a single line with formatting to show
// the attributes, date, time, size, and name.
//
UARTprintf("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9u %s\n",
(g_sFileInfo.fattrib & AM_DIR) ? 'D' : '-',
(g_sFileInfo.fattrib & AM_RDO) ? 'R' : '-',
(g_sFileInfo.fattrib & AM_HID) ? 'H' : '-',
(g_sFileInfo.fattrib & AM_SYS) ? 'S' : '-',
(g_sFileInfo.fattrib & AM_ARC) ? 'A' : '-',
(g_sFileInfo.fdate >> 9) + 1980,
(g_sFileInfo.fdate >> 5) & 15,
g_sFileInfo.fdate & 31,
(g_sFileInfo.ftime >> 11),
(g_sFileInfo.ftime >> 5) & 63,
g_sFileInfo.fsize,
g_sFileInfo.fname);
}
//
// Print summary lines showing the file, dir, and size totals.
//
UARTprintf("\n%4u File(s),%10u bytes total\n%4u Dir(s)",
ulFileCount, ulTotalSize, ulDirCount);
//
// Get the free space.
//
fresult = f_getfree("/", &ulTotalSize, &pFatFs);
//
// Check for error and return if there is a problem.
//
if(fresult != FR_OK)
{
return(fresult);
}
//
// Display the amount of free space that was calculated.
//
UARTprintf(", %10uK bytes free\n", ulTotalSize * pFatFs->sects_clust / 2);
//
// Made it to here, return with no errors.
//
return(0);
} | //*****************************************************************************
//
// This function implements the "ls" command. It opens the current directory
// and enumerates through the contents, and prints a line for each item it
// finds. It shows details such as file attributes, time and date, and the
// file size, along with the name. It shows a summary of file sizes at the end
// along with free space.
//
//*****************************************************************************
| This function implements the "ls" command. It opens the current directory
and enumerates through the contents, and prints a line for each item it
finds. It shows details such as file attributes, time and date, and the
file size, along with the name. It shows a summary of file sizes at the end
along with free space. | [
"This",
"function",
"implements",
"the",
"\"",
"ls",
"\"",
"command",
".",
"It",
"opens",
"the",
"current",
"directory",
"and",
"enumerates",
"through",
"the",
"contents",
"and",
"prints",
"a",
"line",
"for",
"each",
"item",
"it",
"finds",
".",
"It",
"shows",
"details",
"such",
"as",
"file",
"attributes",
"time",
"and",
"date",
"and",
"the",
"file",
"size",
"along",
"with",
"the",
"name",
".",
"It",
"shows",
"a",
"summary",
"of",
"file",
"sizes",
"at",
"the",
"end",
"along",
"with",
"free",
"space",
"."
] | int
Cmd_ls(int argc, char *argv[])
{
unsigned long ulTotalSize;
unsigned long ulFileCount;
unsigned long ulDirCount;
FRESULT fresult;
FATFS *pFatFs;
fresult = f_opendir(&g_sDirObject, g_cCwdBuf);
if(fresult != FR_OK)
{
return(fresult);
}
ulTotalSize = 0;
ulFileCount = 0;
ulDirCount = 0;
UARTprintf("\n");
for(;;)
{
fresult = f_readdir(&g_sDirObject, &g_sFileInfo);
if(fresult != FR_OK)
{
return(fresult);
}
if(!g_sFileInfo.fname[0])
{
break;
}
if(g_sFileInfo.fattrib & AM_DIR)
{
ulDirCount++;
}
else
{
ulFileCount++;
ulTotalSize += g_sFileInfo.fsize;
}
UARTprintf("%c%c%c%c%c %u/%02u/%02u %02u:%02u %9u %s\n",
(g_sFileInfo.fattrib & AM_DIR) ? 'D' : '-',
(g_sFileInfo.fattrib & AM_RDO) ? 'R' : '-',
(g_sFileInfo.fattrib & AM_HID) ? 'H' : '-',
(g_sFileInfo.fattrib & AM_SYS) ? 'S' : '-',
(g_sFileInfo.fattrib & AM_ARC) ? 'A' : '-',
(g_sFileInfo.fdate >> 9) + 1980,
(g_sFileInfo.fdate >> 5) & 15,
g_sFileInfo.fdate & 31,
(g_sFileInfo.ftime >> 11),
(g_sFileInfo.ftime >> 5) & 63,
g_sFileInfo.fsize,
g_sFileInfo.fname);
}
UARTprintf("\n%4u File(s),%10u bytes total\n%4u Dir(s)",
ulFileCount, ulTotalSize, ulDirCount);
fresult = f_getfree("/", &ulTotalSize, &pFatFs);
if(fresult != FR_OK)
{
return(fresult);
}
UARTprintf(", %10uK bytes free\n", ulTotalSize * pFatFs->sects_clust / 2);
return(0);
} | [
"int",
"Cmd_ls",
"(",
"int",
"argc",
",",
"char",
"*",
"argv",
"[",
"]",
")",
"{",
"unsigned",
"long",
"ulTotalSize",
";",
"unsigned",
"long",
"ulFileCount",
";",
"unsigned",
"long",
"ulDirCount",
";",
"FRESULT",
"fresult",
";",
"FATFS",
"*",
"pFatFs",
";",
"fresult",
"=",
"f_opendir",
"(",
"&",
"g_sDirObject",
",",
"g_cCwdBuf",
")",
";",
"if",
"(",
"fresult",
"!=",
"FR_OK",
")",
"{",
"return",
"(",
"fresult",
")",
";",
"}",
"ulTotalSize",
"=",
"0",
";",
"ulFileCount",
"=",
"0",
";",
"ulDirCount",
"=",
"0",
";",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"fresult",
"=",
"f_readdir",
"(",
"&",
"g_sDirObject",
",",
"&",
"g_sFileInfo",
")",
";",
"if",
"(",
"fresult",
"!=",
"FR_OK",
")",
"{",
"return",
"(",
"fresult",
")",
";",
"}",
"if",
"(",
"!",
"g_sFileInfo",
".",
"fname",
"[",
"0",
"]",
")",
"{",
"break",
";",
"}",
"if",
"(",
"g_sFileInfo",
".",
"fattrib",
"&",
"AM_DIR",
")",
"{",
"ulDirCount",
"++",
";",
"}",
"else",
"{",
"ulFileCount",
"++",
";",
"ulTotalSize",
"+=",
"g_sFileInfo",
".",
"fsize",
";",
"}",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"(",
"g_sFileInfo",
".",
"fattrib",
"&",
"AM_DIR",
")",
"?",
"'",
"'",
":",
"'",
"'",
",",
"(",
"g_sFileInfo",
".",
"fattrib",
"&",
"AM_RDO",
")",
"?",
"'",
"'",
":",
"'",
"'",
",",
"(",
"g_sFileInfo",
".",
"fattrib",
"&",
"AM_HID",
")",
"?",
"'",
"'",
":",
"'",
"'",
",",
"(",
"g_sFileInfo",
".",
"fattrib",
"&",
"AM_SYS",
")",
"?",
"'",
"'",
":",
"'",
"'",
",",
"(",
"g_sFileInfo",
".",
"fattrib",
"&",
"AM_ARC",
")",
"?",
"'",
"'",
":",
"'",
"'",
",",
"(",
"g_sFileInfo",
".",
"fdate",
">>",
"9",
")",
"+",
"1980",
",",
"(",
"g_sFileInfo",
".",
"fdate",
">>",
"5",
")",
"&",
"15",
",",
"g_sFileInfo",
".",
"fdate",
"&",
"31",
",",
"(",
"g_sFileInfo",
".",
"ftime",
">>",
"11",
")",
",",
"(",
"g_sFileInfo",
".",
"ftime",
">>",
"5",
")",
"&",
"63",
",",
"g_sFileInfo",
".",
"fsize",
",",
"g_sFileInfo",
".",
"fname",
")",
";",
"}",
"UARTprintf",
"(",
"\"",
"\\n",
"\\n",
"\"",
",",
"ulFileCount",
",",
"ulTotalSize",
",",
"ulDirCount",
")",
";",
"fresult",
"=",
"f_getfree",
"(",
"\"",
"\"",
",",
"&",
"ulTotalSize",
",",
"&",
"pFatFs",
")",
";",
"if",
"(",
"fresult",
"!=",
"FR_OK",
")",
"{",
"return",
"(",
"fresult",
")",
";",
"}",
"UARTprintf",
"(",
"\"",
"\\n",
"\"",
",",
"ulTotalSize",
"*",
"pFatFs",
"->",
"sects_clust",
"/",
"2",
")",
";",
"return",
"(",
"0",
")",
";",
"}"
] | This function implements the "ls" command. | [
"This",
"function",
"implements",
"the",
"\"",
"ls",
"\"",
"command",
"."
] | [
"//\r",
"// Open the current directory for access.\r",
"//\r",
"//\r",
"// Check for error and return if there is a problem.\r",
"//\r",
"//\r",
"// Give an extra blank line before the listing.\r",
"//\r",
"//\r",
"// Enter loop to enumerate through all directory entries.\r",
"//\r",
"//\r",
"// Read an entry from the directory.\r",
"//\r",
"//\r",
"// Check for error and return if there is a problem.\r",
"//\r",
"//\r",
"// If the file name is blank, then this is the end of the listing.\r",
"//\r",
"//\r",
"// If the attribue is directory, then increment the directory count.\r",
"//\r",
"//\r",
"// Otherwise, it is a file. Increment the file count, and add in the\r",
"// file size to the total.\r",
"//\r",
"//\r",
"// Print the entry information on a single line with formatting to show\r",
"// the attributes, date, time, size, and name.\r",
"//\r",
"//\r",
"// Print summary lines showing the file, dir, and size totals.\r",
"//\r",
"//\r",
"// Get the free space.\r",
"//\r",
"//\r",
"// Check for error and return if there is a problem.\r",
"//\r",
"//\r",
"// Display the amount of free space that was calculated.\r",
"//\r",
"//\r",
"// Made it to here, return with no errors.\r",
"//\r"
] | [
{
"param": "argc",
"type": "int"
},
{
"param": "argv",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "argc",
"type": "int",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "argv",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e9eeae4f74207f5aaf87d209ae703ff65975f7b8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/usbstick.c | [
"BSD-3-Clause"
] | C | USBStickInit | void | void
USBStickInit(void)
{
//
// Enable the uDMA controller and set up the control table base.
// The uDMA controller is used by the USB library.
//
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
ROM_uDMAEnable();
ROM_uDMAControlBaseSet(g_sDMAControlTable);
//
// Initially wait for device connection.
//
g_eState = STATE_NO_DEVICE;
//
// Register the host class drivers.
//
USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ulNumHostClassDrivers);
//
// Open an instance of the mass storage class driver.
//
g_ulMSCInstance = USBHMSCDriveOpen(0, MSCCallback);
//
// Initialize the power configuration. This sets the power enable signal
// to be active high and does not enable the power fault.
//
USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);
//
// Run initial pass through USB host stack.
//
USBHCDMain();
//
// Initialize the file system.
//
FileInit();
} | //*****************************************************************************
//
// Initializes the USB stack for mass storage.
//
//*****************************************************************************
| Initializes the USB stack for mass storage. | [
"Initializes",
"the",
"USB",
"stack",
"for",
"mass",
"storage",
"."
] | void
USBStickInit(void)
{
ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA);
ROM_uDMAEnable();
ROM_uDMAControlBaseSet(g_sDMAControlTable);
g_eState = STATE_NO_DEVICE;
USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ulNumHostClassDrivers);
g_ulMSCInstance = USBHMSCDriveOpen(0, MSCCallback);
USBHCDPowerConfigInit(0, USBHCD_VBUS_AUTO_HIGH | USBHCD_VBUS_FILTER);
USBHCDMain();
FileInit();
} | [
"void",
"USBStickInit",
"(",
"void",
")",
"{",
"ROM_SysCtlPeripheralEnable",
"(",
"SYSCTL_PERIPH_UDMA",
")",
";",
"ROM_uDMAEnable",
"(",
")",
";",
"ROM_uDMAControlBaseSet",
"(",
"g_sDMAControlTable",
")",
";",
"g_eState",
"=",
"STATE_NO_DEVICE",
";",
"USBHCDRegisterDrivers",
"(",
"0",
",",
"g_ppHostClassDrivers",
",",
"g_ulNumHostClassDrivers",
")",
";",
"g_ulMSCInstance",
"=",
"USBHMSCDriveOpen",
"(",
"0",
",",
"MSCCallback",
")",
";",
"USBHCDPowerConfigInit",
"(",
"0",
",",
"USBHCD_VBUS_AUTO_HIGH",
"|",
"USBHCD_VBUS_FILTER",
")",
";",
"USBHCDMain",
"(",
")",
";",
"FileInit",
"(",
")",
";",
"}"
] | Initializes the USB stack for mass storage. | [
"Initializes",
"the",
"USB",
"stack",
"for",
"mass",
"storage",
"."
] | [
"//\r",
"// Enable the uDMA controller and set up the control table base.\r",
"// The uDMA controller is used by the USB library.\r",
"//\r",
"//\r",
"// Initially wait for device connection.\r",
"//\r",
"//\r",
"// Register the host class drivers.\r",
"//\r",
"//\r",
"// Open an instance of the mass storage class driver.\r",
"//\r",
"//\r",
"// Initialize the power configuration. This sets the power enable signal\r",
"// to be active high and does not enable the power fault.\r",
"//\r",
"//\r",
"// Run initial pass through USB host stack.\r",
"//\r",
"//\r",
"// Initialize the file system.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e9eeae4f74207f5aaf87d209ae703ff65975f7b8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/usbstick.c | [
"BSD-3-Clause"
] | C | USBStickRun | void | void
USBStickRun(void)
{
//
// Call the USB stack to keep it running.
//
USBHCDMain();
//
// Take action based on the application state.
//
switch(g_eState)
{
//
// A device has enumerated.
//
case STATE_DEVICE_ENUM:
{
//
// Check to see if the device is ready. If not then stay
// in this state and we will check it again on the next pass.
//
if(USBHMSCDriveReady(g_ulMSCInstance) != 0)
{
//
// Wait about 500ms before attempting to check if the
// device is ready again.
//
ROM_SysCtlDelay(ROM_SysCtlClockGet()/3);
break;
}
//
// If there were no errors reported, we are ready for
// MSC operation.
//
g_eState = STATE_DEVICE_READY;
//
// Set the Device Present flag.
//
g_ulFlags = FLAGS_DEVICE_PRESENT;
break;
}
//
// If there is no device then just wait for one.
//
case STATE_NO_DEVICE:
{
if(g_ulFlags == FLAGS_DEVICE_PRESENT)
{
//
// Clear the Device Present flag.
//
g_ulFlags &= ~(FLAGS_DEVICE_PRESENT | FLAGS_FILE_OPENED);
}
break;
}
//
// An unknown device was connected.
//
case STATE_UNKNOWN_DEVICE:
{
//
// If this is a new device then change the status.
//
if((g_ulFlags & FLAGS_DEVICE_PRESENT) == 0)
{
//
// Unknown device is present
//
}
//
// Set the Device Present flag even though the unknown device
// is not useful to us.
//
g_ulFlags = FLAGS_DEVICE_PRESENT;
break;
}
//
// The device is ready and in use.
//
case STATE_DEVICE_READY:
{
break;
}
//
// Something has caused a power fault.
//
case STATE_POWER_FAULT:
{
break;
}
//
// Unexpected USB state. Set back to default.
//
default:
{
g_eState = STATE_NO_DEVICE;
g_ulFlags &= ~(FLAGS_DEVICE_PRESENT | FLAGS_FILE_OPENED);
break;
}
}
} | //*****************************************************************************
//
// This is called by the application main loop to perform regular processing.
// It keeps the USB host stack running and tracks the state of the attached
// device.
//
//*****************************************************************************
| This is called by the application main loop to perform regular processing.
It keeps the USB host stack running and tracks the state of the attached
device. | [
"This",
"is",
"called",
"by",
"the",
"application",
"main",
"loop",
"to",
"perform",
"regular",
"processing",
".",
"It",
"keeps",
"the",
"USB",
"host",
"stack",
"running",
"and",
"tracks",
"the",
"state",
"of",
"the",
"attached",
"device",
"."
] | void
USBStickRun(void)
{
USBHCDMain();
switch(g_eState)
{
case STATE_DEVICE_ENUM:
{
if(USBHMSCDriveReady(g_ulMSCInstance) != 0)
{
ROM_SysCtlDelay(ROM_SysCtlClockGet()/3);
break;
}
g_eState = STATE_DEVICE_READY;
g_ulFlags = FLAGS_DEVICE_PRESENT;
break;
}
case STATE_NO_DEVICE:
{
if(g_ulFlags == FLAGS_DEVICE_PRESENT)
{
g_ulFlags &= ~(FLAGS_DEVICE_PRESENT | FLAGS_FILE_OPENED);
}
break;
}
case STATE_UNKNOWN_DEVICE:
{
if((g_ulFlags & FLAGS_DEVICE_PRESENT) == 0)
{
}
g_ulFlags = FLAGS_DEVICE_PRESENT;
break;
}
case STATE_DEVICE_READY:
{
break;
}
case STATE_POWER_FAULT:
{
break;
}
default:
{
g_eState = STATE_NO_DEVICE;
g_ulFlags &= ~(FLAGS_DEVICE_PRESENT | FLAGS_FILE_OPENED);
break;
}
}
} | [
"void",
"USBStickRun",
"(",
"void",
")",
"{",
"USBHCDMain",
"(",
")",
";",
"switch",
"(",
"g_eState",
")",
"{",
"case",
"STATE_DEVICE_ENUM",
":",
"{",
"if",
"(",
"USBHMSCDriveReady",
"(",
"g_ulMSCInstance",
")",
"!=",
"0",
")",
"{",
"ROM_SysCtlDelay",
"(",
"ROM_SysCtlClockGet",
"(",
")",
"/",
"3",
")",
";",
"break",
";",
"}",
"g_eState",
"=",
"STATE_DEVICE_READY",
";",
"g_ulFlags",
"=",
"FLAGS_DEVICE_PRESENT",
";",
"break",
";",
"}",
"case",
"STATE_NO_DEVICE",
":",
"{",
"if",
"(",
"g_ulFlags",
"==",
"FLAGS_DEVICE_PRESENT",
")",
"{",
"g_ulFlags",
"&=",
"~",
"(",
"FLAGS_DEVICE_PRESENT",
"|",
"FLAGS_FILE_OPENED",
")",
";",
"}",
"break",
";",
"}",
"case",
"STATE_UNKNOWN_DEVICE",
":",
"{",
"if",
"(",
"(",
"g_ulFlags",
"&",
"FLAGS_DEVICE_PRESENT",
")",
"==",
"0",
")",
"{",
"}",
"g_ulFlags",
"=",
"FLAGS_DEVICE_PRESENT",
";",
"break",
";",
"}",
"case",
"STATE_DEVICE_READY",
":",
"{",
"break",
";",
"}",
"case",
"STATE_POWER_FAULT",
":",
"{",
"break",
";",
"}",
"default",
":",
"{",
"g_eState",
"=",
"STATE_NO_DEVICE",
";",
"g_ulFlags",
"&=",
"~",
"(",
"FLAGS_DEVICE_PRESENT",
"|",
"FLAGS_FILE_OPENED",
")",
";",
"break",
";",
"}",
"}",
"}"
] | This is called by the application main loop to perform regular processing. | [
"This",
"is",
"called",
"by",
"the",
"application",
"main",
"loop",
"to",
"perform",
"regular",
"processing",
"."
] | [
"//\r",
"// Call the USB stack to keep it running.\r",
"//\r",
"//\r",
"// Take action based on the application state.\r",
"//\r",
"//\r",
"// A device has enumerated.\r",
"//\r",
"//\r",
"// Check to see if the device is ready. If not then stay\r",
"// in this state and we will check it again on the next pass.\r",
"//\r",
"//\r",
"// Wait about 500ms before attempting to check if the\r",
"// device is ready again.\r",
"//\r",
"//\r",
"// If there were no errors reported, we are ready for\r",
"// MSC operation.\r",
"//\r",
"//\r",
"// Set the Device Present flag.\r",
"//\r",
"//\r",
"// If there is no device then just wait for one.\r",
"//\r",
"//\r",
"// Clear the Device Present flag.\r",
"//\r",
"//\r",
"// An unknown device was connected.\r",
"//\r",
"//\r",
"// If this is a new device then change the status.\r",
"//\r",
"//\r",
"// Unknown device is present\r",
"//\r",
"//\r",
"// Set the Device Present flag even though the unknown device\r",
"// is not useful to us.\r",
"//\r",
"//\r",
"// The device is ready and in use.\r",
"//\r",
"//\r",
"// Something has caused a power fault.\r",
"//\r",
"//\r",
"// Unexpected USB state. Set back to default.\r",
"//\r"
] | [] | {
"returns": [],
"raises": [],
"params": [],
"outlier_params": [],
"others": []
} |
e9eeae4f74207f5aaf87d209ae703ff65975f7b8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/usbstick.c | [
"BSD-3-Clause"
] | C | CreateFileName | int | static int
CreateFileName(char *pcFilename, unsigned long ulLen)
{
FRESULT fresult;
unsigned long ulFileNum = 0;
//
// Enter loop to search for available file name
//
do
{
//
// Prepare a numerical based file name and attempt to open it
//
usnprintf(pcFilename, ulLen, "LOG%04d.CSV", ulFileNum);
fresult = f_open(&g_sFileObject, pcFilename, FA_OPEN_EXISTING);
//
// If file does not exist, then we have found a useable file name
//
if(fresult == FR_NO_FILE)
{
//
// Return to caller, indicating that a file name has been found.
//
return(0);
}
//
// Otherwise, advance to the next number in the file name sequence.
//
ulFileNum++;
} while(ulFileNum < 1000);
//
// If we reach this point, it means that no useable file name was found
// after attempting 10000 file names.
//
return(1);
} | //*****************************************************************************
//
// Create a file name for the file to be saved on the memory stick.
// This function uses an incrementing numerical search scheme to determine
// an available file name. It tries opening file names in succession until
// it finds a file that does not yet exist.
// The file name will be of the form LOGnnnn.CSV.
// The caller supplies storage for the file name through the pcFilename
// parameter.
// The function will return 0 if successful and non-zero if a file name could
// not be found.
//
//*****************************************************************************
| Create a file name for the file to be saved on the memory stick.
This function uses an incrementing numerical search scheme to determine
an available file name. It tries opening file names in succession until
it finds a file that does not yet exist.
The file name will be of the form LOGnnnn.CSV.
The caller supplies storage for the file name through the pcFilename
parameter.
The function will return 0 if successful and non-zero if a file name could
not be found. | [
"Create",
"a",
"file",
"name",
"for",
"the",
"file",
"to",
"be",
"saved",
"on",
"the",
"memory",
"stick",
".",
"This",
"function",
"uses",
"an",
"incrementing",
"numerical",
"search",
"scheme",
"to",
"determine",
"an",
"available",
"file",
"name",
".",
"It",
"tries",
"opening",
"file",
"names",
"in",
"succession",
"until",
"it",
"finds",
"a",
"file",
"that",
"does",
"not",
"yet",
"exist",
".",
"The",
"file",
"name",
"will",
"be",
"of",
"the",
"form",
"LOGnnnn",
".",
"CSV",
".",
"The",
"caller",
"supplies",
"storage",
"for",
"the",
"file",
"name",
"through",
"the",
"pcFilename",
"parameter",
".",
"The",
"function",
"will",
"return",
"0",
"if",
"successful",
"and",
"non",
"-",
"zero",
"if",
"a",
"file",
"name",
"could",
"not",
"be",
"found",
"."
] | static int
CreateFileName(char *pcFilename, unsigned long ulLen)
{
FRESULT fresult;
unsigned long ulFileNum = 0;
do
{
usnprintf(pcFilename, ulLen, "LOG%04d.CSV", ulFileNum);
fresult = f_open(&g_sFileObject, pcFilename, FA_OPEN_EXISTING);
if(fresult == FR_NO_FILE)
{
return(0);
}
ulFileNum++;
} while(ulFileNum < 1000);
return(1);
} | [
"static",
"int",
"CreateFileName",
"(",
"char",
"*",
"pcFilename",
",",
"unsigned",
"long",
"ulLen",
")",
"{",
"FRESULT",
"fresult",
";",
"unsigned",
"long",
"ulFileNum",
"=",
"0",
";",
"do",
"{",
"usnprintf",
"(",
"pcFilename",
",",
"ulLen",
",",
"\"",
"\"",
",",
"ulFileNum",
")",
";",
"fresult",
"=",
"f_open",
"(",
"&",
"g_sFileObject",
",",
"pcFilename",
",",
"FA_OPEN_EXISTING",
")",
";",
"if",
"(",
"fresult",
"==",
"FR_NO_FILE",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"ulFileNum",
"++",
";",
"}",
"while",
"(",
"ulFileNum",
"<",
"1000",
")",
";",
"return",
"(",
"1",
")",
";",
"}"
] | Create a file name for the file to be saved on the memory stick. | [
"Create",
"a",
"file",
"name",
"for",
"the",
"file",
"to",
"be",
"saved",
"on",
"the",
"memory",
"stick",
"."
] | [
"//\r",
"// Enter loop to search for available file name\r",
"//\r",
"//\r",
"// Prepare a numerical based file name and attempt to open it\r",
"//\r",
"//\r",
"// If file does not exist, then we have found a useable file name\r",
"//\r",
"//\r",
"// Return to caller, indicating that a file name has been found.\r",
"//\r",
"//\r",
"// Otherwise, advance to the next number in the file name sequence.\r",
"//\r",
"//\r",
"// If we reach this point, it means that no useable file name was found\r",
"// after attempting 10000 file names.\r",
"//\r"
] | [
{
"param": "pcFilename",
"type": "char"
},
{
"param": "ulLen",
"type": "unsigned long"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcFilename",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
},
{
"identifier": "ulLen",
"type": "unsigned long",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e9eeae4f74207f5aaf87d209ae703ff65975f7b8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/usbstick.c | [
"BSD-3-Clause"
] | C | USBStickOpenLogFile | char | char *
USBStickOpenLogFile(char *pcFilename8)
{
FRESULT fresult;
unsigned short usBytesWritten;
static char cFilename[16];
unsigned long ulLen;
//
// Check state for ready device
//
g_ulFlags &= ~FLAGS_FILE_OPENED;
if(g_eState == STATE_DEVICE_READY)
{
//
// If a file name is specified then open that file
//
if(pcFilename8 && pcFilename8[0])
{
//
// Copy the filename into local storage and cap at 8 characters
// length.
//
memcpy(cFilename, pcFilename8, 8);
cFilename[8] = 0;
//
// Find the actual length of the string (8 chars or less) so
// we know where to add the extension.
//
ulLen = strlen(cFilename);
//
// Add the extension to the file name.
//
usnprintf(&cFilename[ulLen], 5, ".CSV");
}
//
// Otherwise no file name was specified so create a new one.
//
else
{
if(CreateFileName(cFilename, sizeof(cFilename)))
{
//
// There was a problem creating a file name so return an error
//
return(0);
}
}
//
// Open the file by name that was determined above. If the file exists
// it will be opened, and if not it will be created.
//
fresult = f_open(&g_sFileObject, cFilename, FA_OPEN_ALWAYS | FA_WRITE);
if(fresult != FR_OK)
{
return(0);
}
//
// Since it is possible that the file already existed when opened,
// seek to the end of the file so new data will be appended. If this
// is a new file then this will just be the beginning of the file.
//
fresult = f_lseek(&g_sFileObject, g_sFileObject.fsize);
if(fresult != FR_OK)
{
return(0);
}
//
// Set flag to indicate file is now opened.
//
g_ulFlags |= FLAGS_FILE_OPENED;
//
// If no file name was specified, then this is a new file so write a
// header line with column titles to the CSV file.
//
if(!pcFilename8 || !pcFilename8[0])
{
//
// Write a header line to the CSV file
//
fresult = f_write(&g_sFileObject, g_cCSVHeaderLine,
sizeof(g_cCSVHeaderLine),
&usBytesWritten);
if(fresult != FR_OK)
{
g_ulFlags &= ~FLAGS_FILE_OPENED;
return(0);
}
//
// Since no file name was specified that means a file name was
// created. Terminate the new file name at the '.' separator
// and return it to the caller. We know that created file names
// are always 7 characters. Return the newly created file name
// (the part before the '.')
//
cFilename[7] = 0;
return(cFilename);
}
//
// Otherwise, a file name was specified, so no need to write a
// header row. The caller's file name is unchanged so return the
// same value back.
//
else
{
return(pcFilename8);
}
}
else
{
//
// Device not ready so return NULL.
//
return(0);
}
} | //*****************************************************************************
//
// This is called at the start of logging to open a file on the storage
// device in preparation for saving data. If no file name is specified, then
// a new file will be created.
//
// If a file name is specified, then that will be used instead of searching
// for an available file. The file name that is passed in must be a maximum
// of 8 characters (9 including trailing 0) and represents the first part of
// the file name not including the extension.
//
// The function returns a pointer to the first part of the file name
// (without file extension). It can be up to 8 characters (9 including the
// trailing 0). If there is any error then a NULL pointer is returned.
//
//*****************************************************************************
| This is called at the start of logging to open a file on the storage
device in preparation for saving data. If no file name is specified, then
a new file will be created.
If a file name is specified, then that will be used instead of searching
for an available file. The file name that is passed in must be a maximum
of 8 characters (9 including trailing 0) and represents the first part of
the file name not including the extension.
The function returns a pointer to the first part of the file name
(without file extension). It can be up to 8 characters (9 including the
trailing 0). If there is any error then a NULL pointer is returned. | [
"This",
"is",
"called",
"at",
"the",
"start",
"of",
"logging",
"to",
"open",
"a",
"file",
"on",
"the",
"storage",
"device",
"in",
"preparation",
"for",
"saving",
"data",
".",
"If",
"no",
"file",
"name",
"is",
"specified",
"then",
"a",
"new",
"file",
"will",
"be",
"created",
".",
"If",
"a",
"file",
"name",
"is",
"specified",
"then",
"that",
"will",
"be",
"used",
"instead",
"of",
"searching",
"for",
"an",
"available",
"file",
".",
"The",
"file",
"name",
"that",
"is",
"passed",
"in",
"must",
"be",
"a",
"maximum",
"of",
"8",
"characters",
"(",
"9",
"including",
"trailing",
"0",
")",
"and",
"represents",
"the",
"first",
"part",
"of",
"the",
"file",
"name",
"not",
"including",
"the",
"extension",
".",
"The",
"function",
"returns",
"a",
"pointer",
"to",
"the",
"first",
"part",
"of",
"the",
"file",
"name",
"(",
"without",
"file",
"extension",
")",
".",
"It",
"can",
"be",
"up",
"to",
"8",
"characters",
"(",
"9",
"including",
"the",
"trailing",
"0",
")",
".",
"If",
"there",
"is",
"any",
"error",
"then",
"a",
"NULL",
"pointer",
"is",
"returned",
"."
] | char *
USBStickOpenLogFile(char *pcFilename8)
{
FRESULT fresult;
unsigned short usBytesWritten;
static char cFilename[16];
unsigned long ulLen;
g_ulFlags &= ~FLAGS_FILE_OPENED;
if(g_eState == STATE_DEVICE_READY)
{
if(pcFilename8 && pcFilename8[0])
{
memcpy(cFilename, pcFilename8, 8);
cFilename[8] = 0;
ulLen = strlen(cFilename);
usnprintf(&cFilename[ulLen], 5, ".CSV");
}
else
{
if(CreateFileName(cFilename, sizeof(cFilename)))
{
return(0);
}
}
fresult = f_open(&g_sFileObject, cFilename, FA_OPEN_ALWAYS | FA_WRITE);
if(fresult != FR_OK)
{
return(0);
}
fresult = f_lseek(&g_sFileObject, g_sFileObject.fsize);
if(fresult != FR_OK)
{
return(0);
}
g_ulFlags |= FLAGS_FILE_OPENED;
if(!pcFilename8 || !pcFilename8[0])
{
fresult = f_write(&g_sFileObject, g_cCSVHeaderLine,
sizeof(g_cCSVHeaderLine),
&usBytesWritten);
if(fresult != FR_OK)
{
g_ulFlags &= ~FLAGS_FILE_OPENED;
return(0);
}
cFilename[7] = 0;
return(cFilename);
}
else
{
return(pcFilename8);
}
}
else
{
return(0);
}
} | [
"char",
"*",
"USBStickOpenLogFile",
"(",
"char",
"*",
"pcFilename8",
")",
"{",
"FRESULT",
"fresult",
";",
"unsigned",
"short",
"usBytesWritten",
";",
"static",
"char",
"cFilename",
"[",
"16",
"]",
";",
"unsigned",
"long",
"ulLen",
";",
"g_ulFlags",
"&=",
"~",
"FLAGS_FILE_OPENED",
";",
"if",
"(",
"g_eState",
"==",
"STATE_DEVICE_READY",
")",
"{",
"if",
"(",
"pcFilename8",
"&&",
"pcFilename8",
"[",
"0",
"]",
")",
"{",
"memcpy",
"(",
"cFilename",
",",
"pcFilename8",
",",
"8",
")",
";",
"cFilename",
"[",
"8",
"]",
"=",
"0",
";",
"ulLen",
"=",
"strlen",
"(",
"cFilename",
")",
";",
"usnprintf",
"(",
"&",
"cFilename",
"[",
"ulLen",
"]",
",",
"5",
",",
"\"",
"\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"CreateFileName",
"(",
"cFilename",
",",
"sizeof",
"(",
"cFilename",
")",
")",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"}",
"fresult",
"=",
"f_open",
"(",
"&",
"g_sFileObject",
",",
"cFilename",
",",
"FA_OPEN_ALWAYS",
"|",
"FA_WRITE",
")",
";",
"if",
"(",
"fresult",
"!=",
"FR_OK",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"fresult",
"=",
"f_lseek",
"(",
"&",
"g_sFileObject",
",",
"g_sFileObject",
".",
"fsize",
")",
";",
"if",
"(",
"fresult",
"!=",
"FR_OK",
")",
"{",
"return",
"(",
"0",
")",
";",
"}",
"g_ulFlags",
"|=",
"FLAGS_FILE_OPENED",
";",
"if",
"(",
"!",
"pcFilename8",
"||",
"!",
"pcFilename8",
"[",
"0",
"]",
")",
"{",
"fresult",
"=",
"f_write",
"(",
"&",
"g_sFileObject",
",",
"g_cCSVHeaderLine",
",",
"sizeof",
"(",
"g_cCSVHeaderLine",
")",
",",
"&",
"usBytesWritten",
")",
";",
"if",
"(",
"fresult",
"!=",
"FR_OK",
")",
"{",
"g_ulFlags",
"&=",
"~",
"FLAGS_FILE_OPENED",
";",
"return",
"(",
"0",
")",
";",
"}",
"cFilename",
"[",
"7",
"]",
"=",
"0",
";",
"return",
"(",
"cFilename",
")",
";",
"}",
"else",
"{",
"return",
"(",
"pcFilename8",
")",
";",
"}",
"}",
"else",
"{",
"return",
"(",
"0",
")",
";",
"}",
"}"
] | This is called at the start of logging to open a file on the storage
device in preparation for saving data. | [
"This",
"is",
"called",
"at",
"the",
"start",
"of",
"logging",
"to",
"open",
"a",
"file",
"on",
"the",
"storage",
"device",
"in",
"preparation",
"for",
"saving",
"data",
"."
] | [
"//\r",
"// Check state for ready device\r",
"//\r",
"//\r",
"// If a file name is specified then open that file\r",
"//\r",
"//\r",
"// Copy the filename into local storage and cap at 8 characters\r",
"// length.\r",
"//\r",
"//\r",
"// Find the actual length of the string (8 chars or less) so\r",
"// we know where to add the extension.\r",
"//\r",
"//\r",
"// Add the extension to the file name.\r",
"//\r",
"//\r",
"// Otherwise no file name was specified so create a new one.\r",
"//\r",
"//\r",
"// There was a problem creating a file name so return an error\r",
"//\r",
"//\r",
"// Open the file by name that was determined above. If the file exists\r",
"// it will be opened, and if not it will be created.\r",
"//\r",
"//\r",
"// Since it is possible that the file already existed when opened,\r",
"// seek to the end of the file so new data will be appended. If this\r",
"// is a new file then this will just be the beginning of the file.\r",
"//\r",
"//\r",
"// Set flag to indicate file is now opened.\r",
"//\r",
"//\r",
"// If no file name was specified, then this is a new file so write a\r",
"// header line with column titles to the CSV file.\r",
"//\r",
"//\r",
"// Write a header line to the CSV file\r",
"//\r",
"//\r",
"// Since no file name was specified that means a file name was\r",
"// created. Terminate the new file name at the '.' separator\r",
"// and return it to the caller. We know that created file names\r",
"// are always 7 characters. Return the newly created file name\r",
"// (the part before the '.')\r",
"//\r",
"//\r",
"// Otherwise, a file name was specified, so no need to write a\r",
"// header row. The caller's file name is unchanged so return the\r",
"// same value back.\r",
"//\r",
"//\r",
"// Device not ready so return NULL.\r",
"//\r"
] | [
{
"param": "pcFilename8",
"type": "char"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pcFilename8",
"type": "char",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
e9eeae4f74207f5aaf87d209ae703ff65975f7b8 | junyanl-code/Luminary-Micro-Library | boards/ek-lm4f232/qs-logger/usbstick.c | [
"BSD-3-Clause"
] | C | USBStickWriteRecord | int | int
USBStickWriteRecord(tLogRecord *pRecord)
{
static char cBuf[256];
unsigned long ulIdx;
unsigned long ulBufIdx = 0;
unsigned long ulRecordIdx;
unsigned long ulSelected;
FRESULT fresult;
unsigned short usBytesWritten;
//
// Check the arguments
//
ASSERT(pRecord);
if(!pRecord)
{
return(1);
}
//
// Check state for ready device and opened file
//
if((g_eState != STATE_DEVICE_READY) || !(g_ulFlags & FLAGS_FILE_OPENED))
{
return(1);
}
//
// Print time stamp columns
//
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx, "%u,%u",
pRecord->ulSeconds, pRecord->usSubseconds);
//
// Iterate through selected data items and print to CSV buffer
//
ulRecordIdx = 0;
ulSelected = pRecord->usItemMask;
for(ulIdx = 0; ulIdx < NUM_LOG_ITEMS; ulIdx++)
{
//
// If this data item is selected, then print a value to the CSV buffer
//
if(ulSelected & 1)
{
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx,
",%d", pRecord->sItems[ulRecordIdx]);
ulRecordIdx++;
}
//
// Otherwise, this column of data is not selected so emit just a comma
//
else
{
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx,
",");
}
//
// Next selected item ...
//
ulSelected >>= 1;
}
//
// Append a CRLF to the end
//
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx, "\r\n");
//
// Now write the entire buffer to the USB stick file
//
fresult = f_write(&g_sFileObject, cBuf, ulBufIdx, &usBytesWritten);
//
// Check for errors
//
if((fresult != FR_OK) || (usBytesWritten != ulBufIdx))
{
//
// Some error occurred
//
g_ulFlags &= ~FLAGS_FILE_OPENED;
return(1);
}
//
// No errors occurred, return success
//
else
{
return(0);
}
} | //*****************************************************************************
//
// This is called each time there is a new data record to log to the storage
// device. A line of text in CSV format will be written to the file.
//
//*****************************************************************************
| This is called each time there is a new data record to log to the storage
device. A line of text in CSV format will be written to the file. | [
"This",
"is",
"called",
"each",
"time",
"there",
"is",
"a",
"new",
"data",
"record",
"to",
"log",
"to",
"the",
"storage",
"device",
".",
"A",
"line",
"of",
"text",
"in",
"CSV",
"format",
"will",
"be",
"written",
"to",
"the",
"file",
"."
] | int
USBStickWriteRecord(tLogRecord *pRecord)
{
static char cBuf[256];
unsigned long ulIdx;
unsigned long ulBufIdx = 0;
unsigned long ulRecordIdx;
unsigned long ulSelected;
FRESULT fresult;
unsigned short usBytesWritten;
ASSERT(pRecord);
if(!pRecord)
{
return(1);
}
if((g_eState != STATE_DEVICE_READY) || !(g_ulFlags & FLAGS_FILE_OPENED))
{
return(1);
}
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx, "%u,%u",
pRecord->ulSeconds, pRecord->usSubseconds);
ulRecordIdx = 0;
ulSelected = pRecord->usItemMask;
for(ulIdx = 0; ulIdx < NUM_LOG_ITEMS; ulIdx++)
{
if(ulSelected & 1)
{
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx,
",%d", pRecord->sItems[ulRecordIdx]);
ulRecordIdx++;
}
else
{
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx,
",");
}
ulSelected >>= 1;
}
ulBufIdx += usnprintf(&cBuf[ulBufIdx], sizeof(cBuf) - ulBufIdx, "\r\n");
fresult = f_write(&g_sFileObject, cBuf, ulBufIdx, &usBytesWritten);
if((fresult != FR_OK) || (usBytesWritten != ulBufIdx))
{
g_ulFlags &= ~FLAGS_FILE_OPENED;
return(1);
}
else
{
return(0);
}
} | [
"int",
"USBStickWriteRecord",
"(",
"tLogRecord",
"*",
"pRecord",
")",
"{",
"static",
"char",
"cBuf",
"[",
"256",
"]",
";",
"unsigned",
"long",
"ulIdx",
";",
"unsigned",
"long",
"ulBufIdx",
"=",
"0",
";",
"unsigned",
"long",
"ulRecordIdx",
";",
"unsigned",
"long",
"ulSelected",
";",
"FRESULT",
"fresult",
";",
"unsigned",
"short",
"usBytesWritten",
";",
"ASSERT",
"(",
"pRecord",
")",
";",
"if",
"(",
"!",
"pRecord",
")",
"{",
"return",
"(",
"1",
")",
";",
"}",
"if",
"(",
"(",
"g_eState",
"!=",
"STATE_DEVICE_READY",
")",
"||",
"!",
"(",
"g_ulFlags",
"&",
"FLAGS_FILE_OPENED",
")",
")",
"{",
"return",
"(",
"1",
")",
";",
"}",
"ulBufIdx",
"+=",
"usnprintf",
"(",
"&",
"cBuf",
"[",
"ulBufIdx",
"]",
",",
"sizeof",
"(",
"cBuf",
")",
"-",
"ulBufIdx",
",",
"\"",
"\"",
",",
"pRecord",
"->",
"ulSeconds",
",",
"pRecord",
"->",
"usSubseconds",
")",
";",
"ulRecordIdx",
"=",
"0",
";",
"ulSelected",
"=",
"pRecord",
"->",
"usItemMask",
";",
"for",
"(",
"ulIdx",
"=",
"0",
";",
"ulIdx",
"<",
"NUM_LOG_ITEMS",
";",
"ulIdx",
"++",
")",
"{",
"if",
"(",
"ulSelected",
"&",
"1",
")",
"{",
"ulBufIdx",
"+=",
"usnprintf",
"(",
"&",
"cBuf",
"[",
"ulBufIdx",
"]",
",",
"sizeof",
"(",
"cBuf",
")",
"-",
"ulBufIdx",
",",
"\"",
"\"",
",",
"pRecord",
"->",
"sItems",
"[",
"ulRecordIdx",
"]",
")",
";",
"ulRecordIdx",
"++",
";",
"}",
"else",
"{",
"ulBufIdx",
"+=",
"usnprintf",
"(",
"&",
"cBuf",
"[",
"ulBufIdx",
"]",
",",
"sizeof",
"(",
"cBuf",
")",
"-",
"ulBufIdx",
",",
"\"",
"\"",
")",
";",
"}",
"ulSelected",
">>=",
"1",
";",
"}",
"ulBufIdx",
"+=",
"usnprintf",
"(",
"&",
"cBuf",
"[",
"ulBufIdx",
"]",
",",
"sizeof",
"(",
"cBuf",
")",
"-",
"ulBufIdx",
",",
"\"",
"\\r",
"\\n",
"\"",
")",
";",
"fresult",
"=",
"f_write",
"(",
"&",
"g_sFileObject",
",",
"cBuf",
",",
"ulBufIdx",
",",
"&",
"usBytesWritten",
")",
";",
"if",
"(",
"(",
"fresult",
"!=",
"FR_OK",
")",
"||",
"(",
"usBytesWritten",
"!=",
"ulBufIdx",
")",
")",
"{",
"g_ulFlags",
"&=",
"~",
"FLAGS_FILE_OPENED",
";",
"return",
"(",
"1",
")",
";",
"}",
"else",
"{",
"return",
"(",
"0",
")",
";",
"}",
"}"
] | This is called each time there is a new data record to log to the storage
device. | [
"This",
"is",
"called",
"each",
"time",
"there",
"is",
"a",
"new",
"data",
"record",
"to",
"log",
"to",
"the",
"storage",
"device",
"."
] | [
"//\r",
"// Check the arguments\r",
"//\r",
"//\r",
"// Check state for ready device and opened file\r",
"//\r",
"//\r",
"// Print time stamp columns\r",
"//\r",
"//\r",
"// Iterate through selected data items and print to CSV buffer\r",
"//\r",
"//\r",
"// If this data item is selected, then print a value to the CSV buffer\r",
"//\r",
"//\r",
"// Otherwise, this column of data is not selected so emit just a comma\r",
"//\r",
"//\r",
"// Next selected item ...\r",
"//\r",
"//\r",
"// Append a CRLF to the end\r",
"//\r",
"//\r",
"// Now write the entire buffer to the USB stick file\r",
"//\r",
"//\r",
"// Check for errors\r",
"//\r",
"//\r",
"// Some error occurred\r",
"//\r",
"//\r",
"// No errors occurred, return success\r",
"//\r"
] | [
{
"param": "pRecord",
"type": "tLogRecord"
}
] | {
"returns": [],
"raises": [],
"params": [
{
"identifier": "pRecord",
"type": "tLogRecord",
"docstring": null,
"docstring_tokens": [],
"default": null,
"is_optional": null
}
],
"outlier_params": [],
"others": []
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.