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
7af7a4c032adeb546fa2416f9c9d5f933f4602a1
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/enet_uip/enet_uip.c
[ "BSD-3-Clause" ]
C
UpdateStatus
void
void UpdateStatus(char *pcStatus) { tRectangle sRect; // // Dump that status string to the serial port. // UARTprintf("%s\n", pcStatus); // // Clear any previous status message. // sRect.sXMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMin = STATUS_Y - 16; sRect.sYMax = STATUS_Y + 16; GrContextForegroundSet(&g_sContext, ClrBlack); GrRectFill(&g_sContext, &sRect); // // Display the new status string. // GrContextFontSet(&g_sContext, g_pFontCmss20); GrContextForegroundSet(&g_sContext, ClrWhite); GrStringDrawCentered(&g_sContext, pcStatus, -1, GrContextDpyWidthGet(&g_sContext) / 2, STATUS_Y, 0); }
//***************************************************************************** // // Display a status string on the LCD and also transmit it via the serial port. // //*****************************************************************************
Display a status string on the LCD and also transmit it via the serial port.
[ "Display", "a", "status", "string", "on", "the", "LCD", "and", "also", "transmit", "it", "via", "the", "serial", "port", "." ]
void UpdateStatus(char *pcStatus) { tRectangle sRect; UARTprintf("%s\n", pcStatus); sRect.sXMin = 0; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 1; sRect.sYMin = STATUS_Y - 16; sRect.sYMax = STATUS_Y + 16; GrContextForegroundSet(&g_sContext, ClrBlack); GrRectFill(&g_sContext, &sRect); GrContextFontSet(&g_sContext, g_pFontCmss20); GrContextForegroundSet(&g_sContext, ClrWhite); GrStringDrawCentered(&g_sContext, pcStatus, -1, GrContextDpyWidthGet(&g_sContext) / 2, STATUS_Y, 0); }
[ "void", "UpdateStatus", "(", "char", "*", "pcStatus", ")", "{", "tRectangle", "sRect", ";", "UARTprintf", "(", "\"", "\\n", "\"", ",", "pcStatus", ")", ";", "sRect", ".", "sXMin", "=", "0", ";", "sRect", ".", "sXMax", "=", "GrContextDpyWidthGet", "(", "&", "g_sContext", ")", "-", "1", ";", "sRect", ".", "sYMin", "=", "STATUS_Y", "-", "16", ";", "sRect", ".", "sYMax", "=", "STATUS_Y", "+", "16", ";", "GrContextForegroundSet", "(", "&", "g_sContext", ",", "ClrBlack", ")", ";", "GrRectFill", "(", "&", "g_sContext", ",", "&", "sRect", ")", ";", "GrContextFontSet", "(", "&", "g_sContext", ",", "g_pFontCmss20", ")", ";", "GrContextForegroundSet", "(", "&", "g_sContext", ",", "ClrWhite", ")", ";", "GrStringDrawCentered", "(", "&", "g_sContext", ",", "pcStatus", ",", "-1", ",", "GrContextDpyWidthGet", "(", "&", "g_sContext", ")", "/", "2", ",", "STATUS_Y", ",", "0", ")", ";", "}" ]
Display a status string on the LCD and also transmit it via the serial port.
[ "Display", "a", "status", "string", "on", "the", "LCD", "and", "also", "transmit", "it", "via", "the", "serial", "port", "." ]
[ "//\r", "// Dump that status string to the serial port.\r", "//\r", "//\r", "// Clear any previous status message.\r", "//\r", "//\r", "// Display the new status string.\r", "//\r" ]
[ { "param": "pcStatus", "type": "char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pcStatus", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7af7a4c032adeb546fa2416f9c9d5f933f4602a1
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/enet_uip/enet_uip.c
[ "BSD-3-Clause" ]
C
EthernetIntHandler
void
void EthernetIntHandler(void) { unsigned long ulTemp; // // Read and Clear the interrupt. // ulTemp = ROM_EthernetIntStatus(ETH_BASE, false); ROM_EthernetIntClear(ETH_BASE, ulTemp); // // Check to see if an RX Interrupt has occurred. // if(ulTemp & ETH_INT_RX) { // // Indicate that a packet has been received. // HWREGBITW(&g_ulFlags, FLAG_RXPKT) = 1; // // Disable Ethernet RX Interrupt. // ROM_EthernetIntDisable(ETH_BASE, ETH_INT_RX); } // // Check to see if waiting on a DMA to complete. // if(HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) == 1) { // // Verify the channel transfer is done // if(uDMAChannelModeGet(UDMA_CHANNEL_ETH0RX) == UDMA_MODE_STOP) { // // Indicate that a data has been read in. // HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) = 0; } } // // Check to see if the Ethernet TX uDMA channel was pending. // if(HWREGBITW(&g_ulFlags, FLAG_TXPKT) == 1) { // // Verify the channel transfer is done // if(uDMAChannelModeGet(UDMA_CHANNEL_ETH0TX) == UDMA_MODE_STOP) { // // Trigger the transmission of the data. // HWREG(ETH_BASE + MAC_O_TR) = MAC_TR_NEWTX; // // Indicate that a packet has been sent. // HWREGBITW(&g_ulFlags, FLAG_TXPKT) = 0; } } }
//***************************************************************************** // // The interrupt handler for the Ethernet interrupt. // //*****************************************************************************
The interrupt handler for the Ethernet interrupt.
[ "The", "interrupt", "handler", "for", "the", "Ethernet", "interrupt", "." ]
void EthernetIntHandler(void) { unsigned long ulTemp; ulTemp = ROM_EthernetIntStatus(ETH_BASE, false); ROM_EthernetIntClear(ETH_BASE, ulTemp); if(ulTemp & ETH_INT_RX) { HWREGBITW(&g_ulFlags, FLAG_RXPKT) = 1; ROM_EthernetIntDisable(ETH_BASE, ETH_INT_RX); } if(HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) == 1) { if(uDMAChannelModeGet(UDMA_CHANNEL_ETH0RX) == UDMA_MODE_STOP) { HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) = 0; } } if(HWREGBITW(&g_ulFlags, FLAG_TXPKT) == 1) { if(uDMAChannelModeGet(UDMA_CHANNEL_ETH0TX) == UDMA_MODE_STOP) { HWREG(ETH_BASE + MAC_O_TR) = MAC_TR_NEWTX; HWREGBITW(&g_ulFlags, FLAG_TXPKT) = 0; } } }
[ "void", "EthernetIntHandler", "(", "void", ")", "{", "unsigned", "long", "ulTemp", ";", "ulTemp", "=", "ROM_EthernetIntStatus", "(", "ETH_BASE", ",", "false", ")", ";", "ROM_EthernetIntClear", "(", "ETH_BASE", ",", "ulTemp", ")", ";", "if", "(", "ulTemp", "&", "ETH_INT_RX", ")", "{", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_RXPKT", ")", "=", "1", ";", "ROM_EthernetIntDisable", "(", "ETH_BASE", ",", "ETH_INT_RX", ")", ";", "}", "if", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_RXPKTPEND", ")", "==", "1", ")", "{", "if", "(", "uDMAChannelModeGet", "(", "UDMA_CHANNEL_ETH0RX", ")", "==", "UDMA_MODE_STOP", ")", "{", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_RXPKTPEND", ")", "=", "0", ";", "}", "}", "if", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_TXPKT", ")", "==", "1", ")", "{", "if", "(", "uDMAChannelModeGet", "(", "UDMA_CHANNEL_ETH0TX", ")", "==", "UDMA_MODE_STOP", ")", "{", "HWREG", "(", "ETH_BASE", "+", "MAC_O_TR", ")", "=", "MAC_TR_NEWTX", ";", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_TXPKT", ")", "=", "0", ";", "}", "}", "}" ]
The interrupt handler for the Ethernet interrupt.
[ "The", "interrupt", "handler", "for", "the", "Ethernet", "interrupt", "." ]
[ "//\r", "// Read and Clear the interrupt.\r", "//\r", "//\r", "// Check to see if an RX Interrupt has occurred.\r", "//\r", "//\r", "// Indicate that a packet has been received.\r", "//\r", "//\r", "// Disable Ethernet RX Interrupt.\r", "//\r", "//\r", "// Check to see if waiting on a DMA to complete.\r", "//\r", "//\r", "// Verify the channel transfer is done\r", "//\r", "//\r", "// Indicate that a data has been read in.\r", "//\r", "//\r", "// Check to see if the Ethernet TX uDMA channel was pending.\r", "//\r", "//\r", "// Verify the channel transfer is done\r", "//\r", "//\r", "// Trigger the transmission of the data.\r", "//\r", "//\r", "// Indicate that a packet has been sent.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7af7a4c032adeb546fa2416f9c9d5f933f4602a1
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/enet_uip/enet_uip.c
[ "BSD-3-Clause" ]
C
dhcpc_configured
void
void dhcpc_configured(const struct dhcpc_state *s) { uip_sethostaddr(&s->ipaddr); uip_setnetmask(&s->netmask); uip_setdraddr(&s->default_router); ShowIPAddress(s->ipaddr); UpdateStatus("Web server ready"); }
//***************************************************************************** // // Callback for when DHCP client has been configured. // //*****************************************************************************
Callback for when DHCP client has been configured.
[ "Callback", "for", "when", "DHCP", "client", "has", "been", "configured", "." ]
void dhcpc_configured(const struct dhcpc_state *s) { uip_sethostaddr(&s->ipaddr); uip_setnetmask(&s->netmask); uip_setdraddr(&s->default_router); ShowIPAddress(s->ipaddr); UpdateStatus("Web server ready"); }
[ "void", "dhcpc_configured", "(", "const", "struct", "dhcpc_state", "*", "s", ")", "{", "uip_sethostaddr", "(", "&", "s", "->", "ipaddr", ")", ";", "uip_setnetmask", "(", "&", "s", "->", "netmask", ")", ";", "uip_setdraddr", "(", "&", "s", "->", "default_router", ")", ";", "ShowIPAddress", "(", "s", "->", "ipaddr", ")", ";", "UpdateStatus", "(", "\"", "\"", ")", ";", "}" ]
Callback for when DHCP client has been configured.
[ "Callback", "for", "when", "DHCP", "client", "has", "been", "configured", "." ]
[]
[ { "param": "s", "type": "struct dhcpc_state" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "s", "type": "struct dhcpc_state", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7af7a4c032adeb546fa2416f9c9d5f933f4602a1
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/enet_uip/enet_uip.c
[ "BSD-3-Clause" ]
C
EthernetPacketGetDMA
null
long EthernetPacketGetDMA(unsigned long ulBase, unsigned char *pucBuf, long lBufLen) { unsigned long ulTemp; unsigned char pucData[4]; unsigned char *pucBuffer; long lTempLen, lFrameLen; long lRemainder; int iIdx; // // Check the arguments. // ASSERT(ulBase == ETH_BASE); ASSERT(pucBuf != 0); ASSERT(lBufLen > 0); // // If the buffer is not aligned on an odd half-word then it cannot use DMA. // This is because the two packet length bytes are written in front of the // packet, and the packet data must have two bytes that can be pulled off // to become a word and leave the remainder of the buffer word aligned. // if(((unsigned long)pucBuf & 3) != 2) { // // If there is not proper alignment the packet must be sent without // using DMA. // return(ROM_EthernetPacketGetNonBlocking(ulBase, pucBuf, lBufLen)); } // // Read WORD 0 from the FIFO, set the receive Frame Length and store the // first two bytes of the destination address in the receive buffer. // ulTemp = HWREG(ulBase + MAC_O_DATA); lFrameLen = (long)(ulTemp & 0xffff); pucBuf[0] = (unsigned char)((ulTemp >> 16) & 0xff); pucBuf[1] = (unsigned char)((ulTemp >> 24) & 0xff); // // The maximum DMA size is the frame size - the two bytes already read and // truncated to the nearest word size. // lTempLen = (lFrameLen - 2) & 0xfffffffc; lRemainder = (lFrameLen - 2) & 3; // // Don't allow writing beyond the end of the buffer. // if(lBufLen < lTempLen) { lRemainder = lTempLen - lBufLen; lTempLen = lBufLen; } else if(lBufLen >= (lFrameLen - 2 + 3)) { // // If there is room, just DMA the last word as well so that the // special copy after DMA is not required. // lRemainder = 0; lTempLen = lFrameLen - 2 + 3; } // // Mark the receive as pending. // HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) = 1; // // Set up the DMA to transfer the Ethernet header when a // packet is received // uDMAChannelTransferSet(UDMA_CHANNEL_ETH0RX, UDMA_MODE_AUTO, (void *)(ETH_BASE + MAC_O_DATA), &pucBuf[2], lTempLen>>2); uDMAChannelEnable(UDMA_CHANNEL_ETH0RX); // // Issue a software request to start the channel running. // uDMAChannelRequest(UDMA_CHANNEL_ETH0RX); // // Wait for the previous transmission to be complete. // while(HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) == 1) { } // // See if there are extra bytes to read into the buffer. // if(lRemainder) { // // If the remainder is more than 3 bytes then the buffer was never big // enough and data must be tossed. // if(lRemainder > 3) { // // Read any remaining WORDS (that did not fit into the buffer). // while(lRemainder > 0) { ulTemp = HWREG(ulBase + MAC_O_DATA); lRemainder -= 4; } } // // Read the last word from the FIFO. // *((unsigned long *)&pucData[0]) = HWREG(ulBase + MAC_O_DATA); // // The current buffer position is lTempLen plus the two bytes read // from the first word. // pucBuffer = &pucBuf[lTempLen + 2]; // // Read off each individual byte and save it. // for(iIdx = 0; iIdx < lRemainder; iIdx++) { pucBuffer[iIdx] = pucData[iIdx]; } } // // If frame was larger than the buffer, return the "negative" frame length. // lFrameLen -= 6; if(lFrameLen > lBufLen) { return(-lFrameLen); } // // Return the Frame Length // return(lFrameLen); }
//***************************************************************************** // // Read a packet using DMA instead of directly reading the FIFO if the // alignment will allow it. // //*****************************************************************************
Read a packet using DMA instead of directly reading the FIFO if the alignment will allow it.
[ "Read", "a", "packet", "using", "DMA", "instead", "of", "directly", "reading", "the", "FIFO", "if", "the", "alignment", "will", "allow", "it", "." ]
long EthernetPacketGetDMA(unsigned long ulBase, unsigned char *pucBuf, long lBufLen) { unsigned long ulTemp; unsigned char pucData[4]; unsigned char *pucBuffer; long lTempLen, lFrameLen; long lRemainder; int iIdx; ASSERT(ulBase == ETH_BASE); ASSERT(pucBuf != 0); ASSERT(lBufLen > 0); if(((unsigned long)pucBuf & 3) != 2) { return(ROM_EthernetPacketGetNonBlocking(ulBase, pucBuf, lBufLen)); } ulTemp = HWREG(ulBase + MAC_O_DATA); lFrameLen = (long)(ulTemp & 0xffff); pucBuf[0] = (unsigned char)((ulTemp >> 16) & 0xff); pucBuf[1] = (unsigned char)((ulTemp >> 24) & 0xff); lTempLen = (lFrameLen - 2) & 0xfffffffc; lRemainder = (lFrameLen - 2) & 3; if(lBufLen < lTempLen) { lRemainder = lTempLen - lBufLen; lTempLen = lBufLen; } else if(lBufLen >= (lFrameLen - 2 + 3)) { lRemainder = 0; lTempLen = lFrameLen - 2 + 3; } HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) = 1; uDMAChannelTransferSet(UDMA_CHANNEL_ETH0RX, UDMA_MODE_AUTO, (void *)(ETH_BASE + MAC_O_DATA), &pucBuf[2], lTempLen>>2); uDMAChannelEnable(UDMA_CHANNEL_ETH0RX); uDMAChannelRequest(UDMA_CHANNEL_ETH0RX); while(HWREGBITW(&g_ulFlags, FLAG_RXPKTPEND) == 1) { } if(lRemainder) { if(lRemainder > 3) { while(lRemainder > 0) { ulTemp = HWREG(ulBase + MAC_O_DATA); lRemainder -= 4; } } *((unsigned long *)&pucData[0]) = HWREG(ulBase + MAC_O_DATA); pucBuffer = &pucBuf[lTempLen + 2]; for(iIdx = 0; iIdx < lRemainder; iIdx++) { pucBuffer[iIdx] = pucData[iIdx]; } } lFrameLen -= 6; if(lFrameLen > lBufLen) { return(-lFrameLen); } return(lFrameLen); }
[ "long", "EthernetPacketGetDMA", "(", "unsigned", "long", "ulBase", ",", "unsigned", "char", "*", "pucBuf", ",", "long", "lBufLen", ")", "{", "unsigned", "long", "ulTemp", ";", "unsigned", "char", "pucData", "[", "4", "]", ";", "unsigned", "char", "*", "pucBuffer", ";", "long", "lTempLen", ",", "lFrameLen", ";", "long", "lRemainder", ";", "int", "iIdx", ";", "ASSERT", "(", "ulBase", "==", "ETH_BASE", ")", ";", "ASSERT", "(", "pucBuf", "!=", "0", ")", ";", "ASSERT", "(", "lBufLen", ">", "0", ")", ";", "if", "(", "(", "(", "unsigned", "long", ")", "pucBuf", "&", "3", ")", "!=", "2", ")", "{", "return", "(", "ROM_EthernetPacketGetNonBlocking", "(", "ulBase", ",", "pucBuf", ",", "lBufLen", ")", ")", ";", "}", "ulTemp", "=", "HWREG", "(", "ulBase", "+", "MAC_O_DATA", ")", ";", "lFrameLen", "=", "(", "long", ")", "(", "ulTemp", "&", "0xffff", ")", ";", "pucBuf", "[", "0", "]", "=", "(", "unsigned", "char", ")", "(", "(", "ulTemp", ">>", "16", ")", "&", "0xff", ")", ";", "pucBuf", "[", "1", "]", "=", "(", "unsigned", "char", ")", "(", "(", "ulTemp", ">>", "24", ")", "&", "0xff", ")", ";", "lTempLen", "=", "(", "lFrameLen", "-", "2", ")", "&", "0xfffffffc", ";", "lRemainder", "=", "(", "lFrameLen", "-", "2", ")", "&", "3", ";", "if", "(", "lBufLen", "<", "lTempLen", ")", "{", "lRemainder", "=", "lTempLen", "-", "lBufLen", ";", "lTempLen", "=", "lBufLen", ";", "}", "else", "if", "(", "lBufLen", ">=", "(", "lFrameLen", "-", "2", "+", "3", ")", ")", "{", "lRemainder", "=", "0", ";", "lTempLen", "=", "lFrameLen", "-", "2", "+", "3", ";", "}", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_RXPKTPEND", ")", "=", "1", ";", "uDMAChannelTransferSet", "(", "UDMA_CHANNEL_ETH0RX", ",", "UDMA_MODE_AUTO", ",", "(", "void", "*", ")", "(", "ETH_BASE", "+", "MAC_O_DATA", ")", ",", "&", "pucBuf", "[", "2", "]", ",", "lTempLen", ">>", "2", ")", ";", "uDMAChannelEnable", "(", "UDMA_CHANNEL_ETH0RX", ")", ";", "uDMAChannelRequest", "(", "UDMA_CHANNEL_ETH0RX", ")", ";", "while", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_RXPKTPEND", ")", "==", "1", ")", "{", "}", "if", "(", "lRemainder", ")", "{", "if", "(", "lRemainder", ">", "3", ")", "{", "while", "(", "lRemainder", ">", "0", ")", "{", "ulTemp", "=", "HWREG", "(", "ulBase", "+", "MAC_O_DATA", ")", ";", "lRemainder", "-=", "4", ";", "}", "}", "*", "(", "(", "unsigned", "long", "*", ")", "&", "pucData", "[", "0", "]", ")", "=", "HWREG", "(", "ulBase", "+", "MAC_O_DATA", ")", ";", "pucBuffer", "=", "&", "pucBuf", "[", "lTempLen", "+", "2", "]", ";", "for", "(", "iIdx", "=", "0", ";", "iIdx", "<", "lRemainder", ";", "iIdx", "++", ")", "{", "pucBuffer", "[", "iIdx", "]", "=", "pucData", "[", "iIdx", "]", ";", "}", "}", "lFrameLen", "-=", "6", ";", "if", "(", "lFrameLen", ">", "lBufLen", ")", "{", "return", "(", "-", "lFrameLen", ")", ";", "}", "return", "(", "lFrameLen", ")", ";", "}" ]
Read a packet using DMA instead of directly reading the FIFO if the alignment will allow it.
[ "Read", "a", "packet", "using", "DMA", "instead", "of", "directly", "reading", "the", "FIFO", "if", "the", "alignment", "will", "allow", "it", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// If the buffer is not aligned on an odd half-word then it cannot use DMA.\r", "// This is because the two packet length bytes are written in front of the\r", "// packet, and the packet data must have two bytes that can be pulled off\r", "// to become a word and leave the remainder of the buffer word aligned.\r", "//\r", "//\r", "// If there is not proper alignment the packet must be sent without\r", "// using DMA.\r", "//\r", "//\r", "// Read WORD 0 from the FIFO, set the receive Frame Length and store the\r", "// first two bytes of the destination address in the receive buffer.\r", "//\r", "//\r", "// The maximum DMA size is the frame size - the two bytes already read and\r", "// truncated to the nearest word size.\r", "//\r", "//\r", "// Don't allow writing beyond the end of the buffer.\r", "//\r", "//\r", "// If there is room, just DMA the last word as well so that the\r", "// special copy after DMA is not required.\r", "//\r", "//\r", "// Mark the receive as pending.\r", "//\r", "//\r", "// Set up the DMA to transfer the Ethernet header when a\r", "// packet is received\r", "//\r", "//\r", "// Issue a software request to start the channel running.\r", "//\r", "//\r", "// Wait for the previous transmission to be complete.\r", "//\r", "//\r", "// See if there are extra bytes to read into the buffer.\r", "//\r", "//\r", "// If the remainder is more than 3 bytes then the buffer was never big\r", "// enough and data must be tossed.\r", "//\r", "//\r", "// Read any remaining WORDS (that did not fit into the buffer).\r", "//\r", "//\r", "// Read the last word from the FIFO.\r", "//\r", "//\r", "// The current buffer position is lTempLen plus the two bytes read\r", "// from the first word.\r", "//\r", "//\r", "// Read off each individual byte and save it.\r", "//\r", "//\r", "// If frame was larger than the buffer, return the \"negative\" frame length.\r", "//\r", "//\r", "// Return the Frame Length\r", "//\r" ]
[ { "param": "ulBase", "type": "unsigned long" }, { "param": "pucBuf", "type": "unsigned char" }, { "param": "lBufLen", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulBase", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pucBuf", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lBufLen", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7af7a4c032adeb546fa2416f9c9d5f933f4602a1
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/enet_uip/enet_uip.c
[ "BSD-3-Clause" ]
C
EthernetPacketPutDMA
null
static long EthernetPacketPutDMA(unsigned long ulBase, unsigned char *pucBuf, long lBufLen) { unsigned long ulTemp; // // If the buffer is not aligned on an odd half-word then it cannot use DMA. // This is because the two packet length bytes are written in front of the // packet, and the packet data must have two bytes that can be pulled off // to become a word and leave the remainder of the buffer word aligned. // if(((unsigned long)pucBuf & 3) != 2) { // // If there is not proper aligment the packet must be sent without // using DMA. // return(ROM_EthernetPacketPut(ulBase, pucBuf, lBufLen)); } // // Indicate that a packet is being sent. // HWREGBITW(&g_ulFlags, FLAG_TXPKT) = 1; // // Build and write WORD 0 (see format above) to the transmit FIFO. // ulTemp = (unsigned long)(lBufLen - 14); ulTemp |= (*pucBuf++) << 16; ulTemp |= (*pucBuf++) << 24; HWREG(ulBase + MAC_O_DATA) = ulTemp; // // Force an extra word to be transferred if the end of the buffer is not // aligned on a word boundary. The math is actually lBufLen - 2 + 3 to // insure that the proper number of bytes are written. // lBufLen += 1; // // Configure the TX DMA channel to transfer the packet buffer. // uDMAChannelTransferSet(UDMA_CHANNEL_ETH0TX, UDMA_MODE_AUTO, pucBuf, (void *)(ETH_BASE + MAC_O_DATA), lBufLen>>2); // // Enable the Ethernet Transmit DMA channel. // uDMAChannelEnable(UDMA_CHANNEL_ETH0TX); // // Issue a software request to start the channel running. // uDMAChannelRequest(UDMA_CHANNEL_ETH0TX); // // Wait for the previous transmission to be complete. // while((HWREGBITW(&g_ulFlags, FLAG_TXPKT) == 1) && EthernetSpaceAvail(ETH_BASE)) { } // // Take back off the byte that we addeded above. // return(lBufLen - 1); }
//***************************************************************************** // // Transmit a packet using DMA instead of directly writing the FIFO if the // alignment will allow it. // //*****************************************************************************
Transmit a packet using DMA instead of directly writing the FIFO if the alignment will allow it.
[ "Transmit", "a", "packet", "using", "DMA", "instead", "of", "directly", "writing", "the", "FIFO", "if", "the", "alignment", "will", "allow", "it", "." ]
static long EthernetPacketPutDMA(unsigned long ulBase, unsigned char *pucBuf, long lBufLen) { unsigned long ulTemp; if(((unsigned long)pucBuf & 3) != 2) { return(ROM_EthernetPacketPut(ulBase, pucBuf, lBufLen)); } HWREGBITW(&g_ulFlags, FLAG_TXPKT) = 1; ulTemp = (unsigned long)(lBufLen - 14); ulTemp |= (*pucBuf++) << 16; ulTemp |= (*pucBuf++) << 24; HWREG(ulBase + MAC_O_DATA) = ulTemp; lBufLen += 1; uDMAChannelTransferSet(UDMA_CHANNEL_ETH0TX, UDMA_MODE_AUTO, pucBuf, (void *)(ETH_BASE + MAC_O_DATA), lBufLen>>2); uDMAChannelEnable(UDMA_CHANNEL_ETH0TX); uDMAChannelRequest(UDMA_CHANNEL_ETH0TX); while((HWREGBITW(&g_ulFlags, FLAG_TXPKT) == 1) && EthernetSpaceAvail(ETH_BASE)) { } return(lBufLen - 1); }
[ "static", "long", "EthernetPacketPutDMA", "(", "unsigned", "long", "ulBase", ",", "unsigned", "char", "*", "pucBuf", ",", "long", "lBufLen", ")", "{", "unsigned", "long", "ulTemp", ";", "if", "(", "(", "(", "unsigned", "long", ")", "pucBuf", "&", "3", ")", "!=", "2", ")", "{", "return", "(", "ROM_EthernetPacketPut", "(", "ulBase", ",", "pucBuf", ",", "lBufLen", ")", ")", ";", "}", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_TXPKT", ")", "=", "1", ";", "ulTemp", "=", "(", "unsigned", "long", ")", "(", "lBufLen", "-", "14", ")", ";", "ulTemp", "|=", "(", "*", "pucBuf", "++", ")", "<<", "16", ";", "ulTemp", "|=", "(", "*", "pucBuf", "++", ")", "<<", "24", ";", "HWREG", "(", "ulBase", "+", "MAC_O_DATA", ")", "=", "ulTemp", ";", "lBufLen", "+=", "1", ";", "uDMAChannelTransferSet", "(", "UDMA_CHANNEL_ETH0TX", ",", "UDMA_MODE_AUTO", ",", "pucBuf", ",", "(", "void", "*", ")", "(", "ETH_BASE", "+", "MAC_O_DATA", ")", ",", "lBufLen", ">>", "2", ")", ";", "uDMAChannelEnable", "(", "UDMA_CHANNEL_ETH0TX", ")", ";", "uDMAChannelRequest", "(", "UDMA_CHANNEL_ETH0TX", ")", ";", "while", "(", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_TXPKT", ")", "==", "1", ")", "&&", "EthernetSpaceAvail", "(", "ETH_BASE", ")", ")", "{", "}", "return", "(", "lBufLen", "-", "1", ")", ";", "}" ]
Transmit a packet using DMA instead of directly writing the FIFO if the alignment will allow it.
[ "Transmit", "a", "packet", "using", "DMA", "instead", "of", "directly", "writing", "the", "FIFO", "if", "the", "alignment", "will", "allow", "it", "." ]
[ "//\r", "// If the buffer is not aligned on an odd half-word then it cannot use DMA.\r", "// This is because the two packet length bytes are written in front of the\r", "// packet, and the packet data must have two bytes that can be pulled off\r", "// to become a word and leave the remainder of the buffer word aligned.\r", "//\r", "//\r", "// If there is not proper aligment the packet must be sent without\r", "// using DMA.\r", "//\r", "//\r", "// Indicate that a packet is being sent.\r", "//\r", "//\r", "// Build and write WORD 0 (see format above) to the transmit FIFO.\r", "//\r", "//\r", "// Force an extra word to be transferred if the end of the buffer is not\r", "// aligned on a word boundary. The math is actually lBufLen - 2 + 3 to\r", "// insure that the proper number of bytes are written.\r", "//\r", "//\r", "// Configure the TX DMA channel to transfer the packet buffer.\r", "//\r", "//\r", "// Enable the Ethernet Transmit DMA channel.\r", "//\r", "//\r", "// Issue a software request to start the channel running.\r", "//\r", "//\r", "// Wait for the previous transmission to be complete.\r", "//\r", "//\r", "// Take back off the byte that we addeded above.\r", "//\r" ]
[ { "param": "ulBase", "type": "unsigned long" }, { "param": "pucBuf", "type": "unsigned char" }, { "param": "lBufLen", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulBase", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pucBuf", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lBufLen", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
restart_screen
VOID
VOID restart_screen() { UBYTE ExtraFlags; /* I can do colour. Set anything else here that the * interpreter can do, eg. underlining, windows, etc. */ switch(h_type) { case V4: ExtraFlags = CONFIG_EMPHASIS; break; case V5: if(Screen) { if(Screen -> RastPort . BitMap -> Depth >= 3) ExtraFlags = CONFIG_COLOUR | CONFIG_EMPHASIS; else ExtraFlags = CONFIG_EMPHASIS; } else ExtraFlags = CONFIG_EMPHASIS; break; case V3: default: ExtraFlags = NULL; break; } set_byte(H_CONFIG,(get_byte(H_CONFIG) | ExtraFlags | CONFIG_WINDOWS)); SavedCursor = FALSE; }
/* restart_screen(): * * Reset the screen status to defaults. */
Reset the screen status to defaults.
[ "Reset", "the", "screen", "status", "to", "defaults", "." ]
VOID restart_screen() { UBYTE ExtraFlags; switch(h_type) { case V4: ExtraFlags = CONFIG_EMPHASIS; break; case V5: if(Screen) { if(Screen -> RastPort . BitMap -> Depth >= 3) ExtraFlags = CONFIG_COLOUR | CONFIG_EMPHASIS; else ExtraFlags = CONFIG_EMPHASIS; } else ExtraFlags = CONFIG_EMPHASIS; break; case V3: default: ExtraFlags = NULL; break; } set_byte(H_CONFIG,(get_byte(H_CONFIG) | ExtraFlags | CONFIG_WINDOWS)); SavedCursor = FALSE; }
[ "VOID", "restart_screen", "(", ")", "{", "UBYTE", "ExtraFlags", ";", "switch", "(", "h_type", ")", "{", "case", "V4", ":", "ExtraFlags", "=", "CONFIG_EMPHASIS", ";", "break", ";", "case", "V5", ":", "if", "(", "Screen", ")", "{", "if", "(", "Screen", "->", "RastPort", ".", "BitMap", "->", "Depth", ">=", "3", ")", "ExtraFlags", "=", "CONFIG_COLOUR", "|", "CONFIG_EMPHASIS", ";", "else", "ExtraFlags", "=", "CONFIG_EMPHASIS", ";", "}", "else", "ExtraFlags", "=", "CONFIG_EMPHASIS", ";", "break", ";", "case", "V3", ":", "default", ":", "ExtraFlags", "=", "NULL", ";", "break", ";", "}", "set_byte", "(", "H_CONFIG", ",", "(", "get_byte", "(", "H_CONFIG", ")", "|", "ExtraFlags", "|", "CONFIG_WINDOWS", ")", ")", ";", "SavedCursor", "=", "FALSE", ";", "}" ]
restart_screen():
[ "restart_screen", "()", ":" ]
[ "/* I can do colour. Set anything else here that the\r\n\t\t * interpreter can do, eg. underlining, windows, etc.\r\n\t\t */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
reset_screen
VOID
VOID reset_screen() { /* Free sound resources. */ SoundExit(); /* Free the graphics font. */ if(GfxSegment) UnLoadSeg(GfxSegment); /* Free the console request. */ if(ConRequest) { /* Did we open the device? If so, close it. */ if(ConRequest -> io_Device) CloseDevice(ConRequest); /* Free the memory. */ FreeMem(ConRequest,sizeof(struct IOStdReq)); } /* Free the input conversion buffer. */ if(InputEventBuffer) FreeMem(InputEventBuffer,INPUT_LENGTH); /* Free the fake inputevent. */ if(InputEvent) FreeMem(InputEvent,sizeof(struct InputEvent)); /* Free timer data. */ if(TimeRequest) { if(TimeRequest -> tr_node . io_Device) { if(!CheckIO(TimeRequest)) AbortIO(TimeRequest); WaitIO(TimeRequest); CloseDevice(TimeRequest); } DeleteExtIO(TimeRequest); } if(TimePort) DeletePort(TimePort); /* Free line cache. */ if(ConLine) FreeMem(ConLine,ConLineMaxLength); /* Close the window. */ if(Window) { ScreenToBack(Screen); CloseWindow(Window); } /* Close the screen. */ if(Screen) { ScreenToBack(Screen); CloseScreen(Screen); } /* Close libraries. */ if(IconBase) CloseLibrary(IconBase); if(GfxBase) CloseLibrary(GfxBase); if(IntuitionBase) CloseLibrary(IntuitionBase); /* Restore window pointer. */ if(ThisProcess) ThisProcess -> pr_WindowPtr = WindowPtr; #ifdef __GNUC__ { sigset_t trapped = TRAPPED_SIGNALS; sigprocmask(SIG_UNBLOCK,&trapped,NULL); } #endif /* __GNUC__ */ }
/* reset_screen(): * * Restore original screen contents, in our case we will have to * free all the resources allocated by initialize_screen. */
Restore original screen contents, in our case we will have to free all the resources allocated by initialize_screen.
[ "Restore", "original", "screen", "contents", "in", "our", "case", "we", "will", "have", "to", "free", "all", "the", "resources", "allocated", "by", "initialize_screen", "." ]
VOID reset_screen() { SoundExit(); if(GfxSegment) UnLoadSeg(GfxSegment); if(ConRequest) { if(ConRequest -> io_Device) CloseDevice(ConRequest); FreeMem(ConRequest,sizeof(struct IOStdReq)); } if(InputEventBuffer) FreeMem(InputEventBuffer,INPUT_LENGTH); if(InputEvent) FreeMem(InputEvent,sizeof(struct InputEvent)); if(TimeRequest) { if(TimeRequest -> tr_node . io_Device) { if(!CheckIO(TimeRequest)) AbortIO(TimeRequest); WaitIO(TimeRequest); CloseDevice(TimeRequest); } DeleteExtIO(TimeRequest); } if(TimePort) DeletePort(TimePort); if(ConLine) FreeMem(ConLine,ConLineMaxLength); if(Window) { ScreenToBack(Screen); CloseWindow(Window); } if(Screen) { ScreenToBack(Screen); CloseScreen(Screen); } if(IconBase) CloseLibrary(IconBase); if(GfxBase) CloseLibrary(GfxBase); if(IntuitionBase) CloseLibrary(IntuitionBase); if(ThisProcess) ThisProcess -> pr_WindowPtr = WindowPtr; #ifdef __GNUC__ { sigset_t trapped = TRAPPED_SIGNALS; sigprocmask(SIG_UNBLOCK,&trapped,NULL); } #endif }
[ "VOID", "reset_screen", "(", ")", "{", "SoundExit", "(", ")", ";", "if", "(", "GfxSegment", ")", "UnLoadSeg", "(", "GfxSegment", ")", ";", "if", "(", "ConRequest", ")", "{", "if", "(", "ConRequest", "->", "io_Device", ")", "CloseDevice", "(", "ConRequest", ")", ";", "FreeMem", "(", "ConRequest", ",", "sizeof", "(", "struct", "IOStdReq", ")", ")", ";", "}", "if", "(", "InputEventBuffer", ")", "FreeMem", "(", "InputEventBuffer", ",", "INPUT_LENGTH", ")", ";", "if", "(", "InputEvent", ")", "FreeMem", "(", "InputEvent", ",", "sizeof", "(", "struct", "InputEvent", ")", ")", ";", "if", "(", "TimeRequest", ")", "{", "if", "(", "TimeRequest", "->", "tr_node", ".", "io_Device", ")", "{", "if", "(", "!", "CheckIO", "(", "TimeRequest", ")", ")", "AbortIO", "(", "TimeRequest", ")", ";", "WaitIO", "(", "TimeRequest", ")", ";", "CloseDevice", "(", "TimeRequest", ")", ";", "}", "DeleteExtIO", "(", "TimeRequest", ")", ";", "}", "if", "(", "TimePort", ")", "DeletePort", "(", "TimePort", ")", ";", "if", "(", "ConLine", ")", "FreeMem", "(", "ConLine", ",", "ConLineMaxLength", ")", ";", "if", "(", "Window", ")", "{", "ScreenToBack", "(", "Screen", ")", ";", "CloseWindow", "(", "Window", ")", ";", "}", "if", "(", "Screen", ")", "{", "ScreenToBack", "(", "Screen", ")", ";", "CloseScreen", "(", "Screen", ")", ";", "}", "if", "(", "IconBase", ")", "CloseLibrary", "(", "IconBase", ")", ";", "if", "(", "GfxBase", ")", "CloseLibrary", "(", "GfxBase", ")", ";", "if", "(", "IntuitionBase", ")", "CloseLibrary", "(", "IntuitionBase", ")", ";", "if", "(", "ThisProcess", ")", "ThisProcess", "->", "pr_WindowPtr", "=", "WindowPtr", ";", "#ifdef", "__GNUC__", "{", "sigset_t", "trapped", "=", "TRAPPED_SIGNALS", ";", "sigprocmask", "(", "SIG_UNBLOCK", ",", "&", "trapped", ",", "NULL", ")", ";", "}", "#endif", "}" ]
reset_screen():
[ "reset_screen", "()", ":" ]
[ "/* Free sound resources. */", "/* Free the graphics font. */", "/* Free the console request. */", "/* Did we open the device? If so, close it. */", "/* Free the memory. */", "/* Free the input conversion buffer. */", "/* Free the fake inputevent. */", "/* Free timer data. */", "/* Free line cache. */", "/* Close the window. */", "/* Close the screen. */", "/* Close libraries. */", "/* Restore window pointer. */", "/* __GNUC__ */" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
select_status_window
VOID
VOID select_status_window() { ConFlush(); save_cursor_position(); CurrentWindow = WINDOW_STATUS; }
/* select_status_window(): * * Move the cursor into the status bar area. */
Move the cursor into the status bar area.
[ "Move", "the", "cursor", "into", "the", "status", "bar", "area", "." ]
VOID select_status_window() { ConFlush(); save_cursor_position(); CurrentWindow = WINDOW_STATUS; }
[ "VOID", "select_status_window", "(", ")", "{", "ConFlush", "(", ")", ";", "save_cursor_position", "(", ")", ";", "CurrentWindow", "=", "WINDOW_STATUS", ";", "}" ]
select_status_window():
[ "select_status_window", "()", ":" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
select_text_window
VOID
VOID select_text_window() { ConFlush(); restore_cursor_position(); CurrentWindow = WINDOW_TEXT; }
/* select_text_window(): * * Move the cursor into the text window area. */
Move the cursor into the text window area.
[ "Move", "the", "cursor", "into", "the", "text", "window", "area", "." ]
VOID select_text_window() { ConFlush(); restore_cursor_position(); CurrentWindow = WINDOW_TEXT; }
[ "VOID", "select_text_window", "(", ")", "{", "ConFlush", "(", ")", ";", "restore_cursor_position", "(", ")", ";", "CurrentWindow", "=", "WINDOW_TEXT", ";", "}" ]
select_text_window():
[ "select_text_window", "()", ":" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
clear_line
VOID
VOID clear_line() { LONG OldX,OldY; ConFlush(); OldX = CursorX; OldY = CursorY; ConSet(0,CursorY,CURSOR_NOCHANGE); ConClearEOL(); ConSet(OldX,OldY,CURSOR_NOCHANGE); }
/* clear_line(): * * Clear the contents of the current cursor line. */
Clear the contents of the current cursor line.
[ "Clear", "the", "contents", "of", "the", "current", "cursor", "line", "." ]
VOID clear_line() { LONG OldX,OldY; ConFlush(); OldX = CursorX; OldY = CursorY; ConSet(0,CursorY,CURSOR_NOCHANGE); ConClearEOL(); ConSet(OldX,OldY,CURSOR_NOCHANGE); }
[ "VOID", "clear_line", "(", ")", "{", "LONG", "OldX", ",", "OldY", ";", "ConFlush", "(", ")", ";", "OldX", "=", "CursorX", ";", "OldY", "=", "CursorY", ";", "ConSet", "(", "0", ",", "CursorY", ",", "CURSOR_NOCHANGE", ")", ";", "ConClearEOL", "(", ")", ";", "ConSet", "(", "OldX", ",", "OldY", ",", "CURSOR_NOCHANGE", ")", ";", "}" ]
clear_line():
[ "clear_line", "()", ":" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
save_cursor_position
VOID
VOID save_cursor_position() { if(!SavedCursor) { SavedX = CursorX; SavedY = CursorY; SavedCursor = TRUE; } }
/* save_cursor_position(): * * Save the current cursor position. */
Save the current cursor position.
[ "Save", "the", "current", "cursor", "position", "." ]
VOID save_cursor_position() { if(!SavedCursor) { SavedX = CursorX; SavedY = CursorY; SavedCursor = TRUE; } }
[ "VOID", "save_cursor_position", "(", ")", "{", "if", "(", "!", "SavedCursor", ")", "{", "SavedX", "=", "CursorX", ";", "SavedY", "=", "CursorY", ";", "SavedCursor", "=", "TRUE", ";", "}", "}" ]
save_cursor_position():
[ "save_cursor_position", "()", ":" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
restore_cursor_position
VOID
VOID restore_cursor_position() { if(SavedCursor) { ConSet(SavedX,SavedY,CURSOR_NOCHANGE); SavedCursor = FALSE; } }
/* restore_cursor_position(): * * Restore the previously saved cursor position. */
Restore the previously saved cursor position.
[ "Restore", "the", "previously", "saved", "cursor", "position", "." ]
VOID restore_cursor_position() { if(SavedCursor) { ConSet(SavedX,SavedY,CURSOR_NOCHANGE); SavedCursor = FALSE; } }
[ "VOID", "restore_cursor_position", "(", ")", "{", "if", "(", "SavedCursor", ")", "{", "ConSet", "(", "SavedX", ",", "SavedY", ",", "CURSOR_NOCHANGE", ")", ";", "SavedCursor", "=", "FALSE", ";", "}", "}" ]
restore_cursor_position():
[ "restore_cursor_position", "()", ":" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
move_cursor
VOID
VOID move_cursor(int row,int col) { ConFlush(); ConSet((col - 1) * FixedFont -> tf_XSize,(row - 1) * TextFontHeight,CURSOR_NOCHANGE); }
/* move_cursor(int row,int col): * * Move the cursor to a given position. */
Move the cursor to a given position.
[ "Move", "the", "cursor", "to", "a", "given", "position", "." ]
VOID move_cursor(int row,int col) { ConFlush(); ConSet((col - 1) * FixedFont -> tf_XSize,(row - 1) * TextFontHeight,CURSOR_NOCHANGE); }
[ "VOID", "move_cursor", "(", "int", "row", ",", "int", "col", ")", "{", "ConFlush", "(", ")", ";", "ConSet", "(", "(", "col", "-", "1", ")", "*", "FixedFont", "->", "tf_XSize", ",", "(", "row", "-", "1", ")", "*", "TextFontHeight", ",", "CURSOR_NOCHANGE", ")", ";", "}" ]
move_cursor(int row,int col):
[ "move_cursor", "(", "int", "row", "int", "col", ")", ":" ]
[]
[ { "param": "row", "type": "int" }, { "param": "col", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "row", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "col", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
display_char
VOID
VOID display_char(int c) { if(PrivateColour) { if(get_word(H_FLAGS) & FIXED_FONT_FLAG) { if(ThisFont != FixedFont) { ConFlush(); SetFont(RPort,ThisFont = FixedFont); } } else { if(ThisFont != PropFont) { ConFlush(); SetFont(RPort,ThisFont = PropFont); } } } if(c >= ' ') { /* Cache the character. */ ConLine[ConLineLength] = c; /* If the line cache is full, flush it. */ if(ConLineLength++ == ConLineMaxLength) ConFlush(); } else { ConFlush(); switch(c) { case '\n': ConSet(0,CursorY + TextFontHeight,CURSOR_NOCHANGE); break; case '\r': ConSet(0,CursorY,CURSOR_NOCHANGE); break; case '\a': DisplayBeep(Window -> WScreen); break; default: break; } } }
/* display_char(int c): * * Display a single character (characters are cached in * order to speed up text display). */
Display a single character (characters are cached in order to speed up text display).
[ "Display", "a", "single", "character", "(", "characters", "are", "cached", "in", "order", "to", "speed", "up", "text", "display", ")", "." ]
VOID display_char(int c) { if(PrivateColour) { if(get_word(H_FLAGS) & FIXED_FONT_FLAG) { if(ThisFont != FixedFont) { ConFlush(); SetFont(RPort,ThisFont = FixedFont); } } else { if(ThisFont != PropFont) { ConFlush(); SetFont(RPort,ThisFont = PropFont); } } } if(c >= ' ') { ConLine[ConLineLength] = c; if(ConLineLength++ == ConLineMaxLength) ConFlush(); } else { ConFlush(); switch(c) { case '\n': ConSet(0,CursorY + TextFontHeight,CURSOR_NOCHANGE); break; case '\r': ConSet(0,CursorY,CURSOR_NOCHANGE); break; case '\a': DisplayBeep(Window -> WScreen); break; default: break; } } }
[ "VOID", "display_char", "(", "int", "c", ")", "{", "if", "(", "PrivateColour", ")", "{", "if", "(", "get_word", "(", "H_FLAGS", ")", "&", "FIXED_FONT_FLAG", ")", "{", "if", "(", "ThisFont", "!=", "FixedFont", ")", "{", "ConFlush", "(", ")", ";", "SetFont", "(", "RPort", ",", "ThisFont", "=", "FixedFont", ")", ";", "}", "}", "else", "{", "if", "(", "ThisFont", "!=", "PropFont", ")", "{", "ConFlush", "(", ")", ";", "SetFont", "(", "RPort", ",", "ThisFont", "=", "PropFont", ")", ";", "}", "}", "}", "if", "(", "c", ">=", "'", "'", ")", "{", "ConLine", "[", "ConLineLength", "]", "=", "c", ";", "if", "(", "ConLineLength", "++", "==", "ConLineMaxLength", ")", "ConFlush", "(", ")", ";", "}", "else", "{", "ConFlush", "(", ")", ";", "switch", "(", "c", ")", "{", "case", "'", "\\n", "'", ":", "ConSet", "(", "0", ",", "CursorY", "+", "TextFontHeight", ",", "CURSOR_NOCHANGE", ")", ";", "break", ";", "case", "'", "\\r", "'", ":", "ConSet", "(", "0", ",", "CursorY", ",", "CURSOR_NOCHANGE", ")", ";", "break", ";", "case", "'", "\\a", "'", ":", "DisplayBeep", "(", "Window", "->", "WScreen", ")", ";", "break", ";", "default", ":", "break", ";", "}", "}", "}" ]
display_char(int c):
[ "display_char", "(", "int", "c", ")", ":" ]
[ "/* Cache the character. */", "/* If the line cache is full, flush it. */" ]
[ { "param": "c", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
228fd5268aa7f72461e5c9340a62edb49899f85a
junyanl-code/Luminary-Micro-Library
third_party/zip/amigaio.c
[ "BSD-3-Clause" ]
C
process_arguments
void
void process_arguments(int argc, char *argv[]) { int Len; char *restore_name = NULL; if(argc > 1) { if(!strcmp(argv[1],"?")) { printf("Usage: %s [Story file name]\n",argv[0]); exit(RETURN_WARN); } else StoryName = argv[1]; #if 0 if(argc > 2) restore_name = argv[2]; #endif } else StoryName = "Story.Data"; if(argc) InterpreterName = argv[0]; else { WBenchMsg = (struct WBStartup *)argv; InterpreterName = WBenchMsg -> sm_ArgList[0] . wa_Name; if(IconBase = OpenLibrary("icon.library",LIB_VERSION)) { struct DiskObject *Icon; if(Icon = GetDiskObject(InterpreterName)) { char Buffer[5], *Type; int i; /* Does it have a filetype info attached? */ if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,"STORY")) { if(StoryName = (STRPTR)malloc(strlen(Type) + 1)) strcpy(StoryName,Type); else StoryName = "Story.Data"; } /* Check for function key * defintions and set them * if approriate. */ for(i = 0 ; i < NUM_FKEYS ; i++) { /* Build fkey string. */ sprintf(Buffer,"F0%2d",i + 1); /* See if we can find it. */ if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,Buffer)) ConSetKey(i,Type,strlen(Type)); else ConSetKey(i,"",0); } /* Free the icon. */ FreeDiskObject(Icon); } if(WBenchMsg -> sm_NumArgs > 1) { char *Type; int i; for(i = 0 ; i < WBenchMsg -> sm_NumArgs ; i++) { CurrentDir(WBenchMsg -> sm_ArgList[i] . wa_Lock); if(Icon = GetDiskObject(WBenchMsg -> sm_ArgList[i] . wa_Name)) { /* Does it have a filetype info attached? */ if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,"FILETYPE")) { /* Is it a bookmark file? */ if(MatchToolValue(Type,"BOOKMARK") && MatchToolValue(Type,"ZIP")) { restore_name = WBenchMsg -> sm_ArgList[i] . wa_Name; if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,"STORY")) { BPTR File; /* Try to open the file, this is * easier than locking it, allocating * a fileinfo, reading it and then * to clean up again. */ if(File = Open(Type,MODE_OLDFILE)) { char *NewName; Close(File); if(NewName = (STRPTR)malloc(strlen(Type) + 1)) { strcpy(NewName,Type); StoryName = NewName; } } } FreeDiskObject(Icon); break; } if(MatchToolValue(Type,"STORY")) { BPTR File; /* Try to open the file, this is * easier than locking it, allocating * a fileinfo, reading it and then * to clean up again. */ if(File = Open(WBenchMsg -> sm_ArgList[i] . wa_Name,MODE_OLDFILE)) { char *NewName; Close(File); if(NewName = (STRPTR)malloc(strlen(WBenchMsg -> sm_ArgList[i] . wa_Name) + 1)) { strcpy(NewName,WBenchMsg -> sm_ArgList[i] . wa_Name); StoryName = NewName; } } FreeDiskObject(Icon); break; } } /* Free the icon. */ FreeDiskObject(Icon); } } } CloseLibrary(IconBase); IconBase = NULL; } } open_story(StoryName); Len = strlen(StoryName); /* Set up the path leading to the * graphics character font. */ strcpy(GfxFontPath,"Graphic.Data"); if(Len) { int i; /* Starting from the end of the * file name look for the first * path character. */ for(i = Len - 1 ; i >= 0 ; i--) { /* Is it a path name seperation * character? */ if(StoryName[i] == '/' || StoryName[i] == ':') { memcpy(GfxFontPath,StoryName,i + 1); GfxFontPath[i + 1] = 0; strcat(GfxFontPath,"Graphic.Data"); break; } } } /* Make a copy of the game name. */ if(SoundName = malloc(Len + 40)) { strcpy(SoundName,StoryName); /* Does the sound file name have any * length, i.e. is it a real name? */ if(Len) { int i; /* Starting from the end of the * file name look for the first * path character. */ for(i = Len - 1 ; i >= 0 ; i--) { /* Is it a path name seperation * character? */ if(SoundName[i] == '/' || SoundName[i] == ':') { /* Append the sound directory * name to the string. */ SoundPath = &SoundName[i + 1]; /* We're finished. */ break; } } } /* If no proper subdirectory name was * to be found, override the entire * string. */ if(!SoundPath) SoundPath = SoundName; } }
/* process_arguments(int argc, char *argv[]): * * Do any argument preprocessing necessary before the game is * started. This may include selecting a specific game file or * setting interface-specific options. */
Do any argument preprocessing necessary before the game is started. This may include selecting a specific game file or setting interface-specific options.
[ "Do", "any", "argument", "preprocessing", "necessary", "before", "the", "game", "is", "started", ".", "This", "may", "include", "selecting", "a", "specific", "game", "file", "or", "setting", "interface", "-", "specific", "options", "." ]
void process_arguments(int argc, char *argv[]) { int Len; char *restore_name = NULL; if(argc > 1) { if(!strcmp(argv[1],"?")) { printf("Usage: %s [Story file name]\n",argv[0]); exit(RETURN_WARN); } else StoryName = argv[1]; #if 0 if(argc > 2) restore_name = argv[2]; #endif } else StoryName = "Story.Data"; if(argc) InterpreterName = argv[0]; else { WBenchMsg = (struct WBStartup *)argv; InterpreterName = WBenchMsg -> sm_ArgList[0] . wa_Name; if(IconBase = OpenLibrary("icon.library",LIB_VERSION)) { struct DiskObject *Icon; if(Icon = GetDiskObject(InterpreterName)) { char Buffer[5], *Type; int i; if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,"STORY")) { if(StoryName = (STRPTR)malloc(strlen(Type) + 1)) strcpy(StoryName,Type); else StoryName = "Story.Data"; } for(i = 0 ; i < NUM_FKEYS ; i++) { sprintf(Buffer,"F0%2d",i + 1); if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,Buffer)) ConSetKey(i,Type,strlen(Type)); else ConSetKey(i,"",0); } FreeDiskObject(Icon); } if(WBenchMsg -> sm_NumArgs > 1) { char *Type; int i; for(i = 0 ; i < WBenchMsg -> sm_NumArgs ; i++) { CurrentDir(WBenchMsg -> sm_ArgList[i] . wa_Lock); if(Icon = GetDiskObject(WBenchMsg -> sm_ArgList[i] . wa_Name)) { if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,"FILETYPE")) { if(MatchToolValue(Type,"BOOKMARK") && MatchToolValue(Type,"ZIP")) { restore_name = WBenchMsg -> sm_ArgList[i] . wa_Name; if(Type = FindToolType((STRPTR *)Icon -> do_ToolTypes,"STORY")) { BPTR File; if(File = Open(Type,MODE_OLDFILE)) { char *NewName; Close(File); if(NewName = (STRPTR)malloc(strlen(Type) + 1)) { strcpy(NewName,Type); StoryName = NewName; } } } FreeDiskObject(Icon); break; } if(MatchToolValue(Type,"STORY")) { BPTR File; if(File = Open(WBenchMsg -> sm_ArgList[i] . wa_Name,MODE_OLDFILE)) { char *NewName; Close(File); if(NewName = (STRPTR)malloc(strlen(WBenchMsg -> sm_ArgList[i] . wa_Name) + 1)) { strcpy(NewName,WBenchMsg -> sm_ArgList[i] . wa_Name); StoryName = NewName; } } FreeDiskObject(Icon); break; } } FreeDiskObject(Icon); } } } CloseLibrary(IconBase); IconBase = NULL; } } open_story(StoryName); Len = strlen(StoryName); strcpy(GfxFontPath,"Graphic.Data"); if(Len) { int i; for(i = Len - 1 ; i >= 0 ; i--) { if(StoryName[i] == '/' || StoryName[i] == ':') { memcpy(GfxFontPath,StoryName,i + 1); GfxFontPath[i + 1] = 0; strcat(GfxFontPath,"Graphic.Data"); break; } } } if(SoundName = malloc(Len + 40)) { strcpy(SoundName,StoryName); if(Len) { int i; for(i = Len - 1 ; i >= 0 ; i--) { if(SoundName[i] == '/' || SoundName[i] == ':') { SoundPath = &SoundName[i + 1]; break; } } } if(!SoundPath) SoundPath = SoundName; } }
[ "void", "process_arguments", "(", "int", "argc", ",", "char", "*", "argv", "[", "]", ")", "{", "int", "Len", ";", "char", "*", "restore_name", "=", "NULL", ";", "if", "(", "argc", ">", "1", ")", "{", "if", "(", "!", "strcmp", "(", "argv", "[", "1", "]", ",", "\"", "\"", ")", ")", "{", "printf", "(", "\"", "\\n", "\"", ",", "argv", "[", "0", "]", ")", ";", "exit", "(", "RETURN_WARN", ")", ";", "}", "else", "StoryName", "=", "argv", "[", "1", "]", ";", "#if", "0", "\n", "if", "(", "argc", ">", "2", ")", "restore_name", "=", "argv", "[", "2", "]", ";", "#endif", "}", "else", "StoryName", "=", "\"", "\"", ";", "if", "(", "argc", ")", "InterpreterName", "=", "argv", "[", "0", "]", ";", "else", "{", "WBenchMsg", "=", "(", "struct", "WBStartup", "*", ")", "argv", ";", "InterpreterName", "=", "WBenchMsg", "->", "sm_ArgList", "[", "0", "]", ".", "wa_Name", ";", "if", "(", "IconBase", "=", "OpenLibrary", "(", "\"", "\"", ",", "LIB_VERSION", ")", ")", "{", "struct", "DiskObject", "*", "Icon", ";", "if", "(", "Icon", "=", "GetDiskObject", "(", "InterpreterName", ")", ")", "{", "char", "Buffer", "[", "5", "]", ",", "*", "Type", ";", "int", "i", ";", "if", "(", "Type", "=", "FindToolType", "(", "(", "STRPTR", "*", ")", "Icon", "->", "do_ToolTypes", ",", "\"", "\"", ")", ")", "{", "if", "(", "StoryName", "=", "(", "STRPTR", ")", "malloc", "(", "strlen", "(", "Type", ")", "+", "1", ")", ")", "strcpy", "(", "StoryName", ",", "Type", ")", ";", "else", "StoryName", "=", "\"", "\"", ";", "}", "for", "(", "i", "=", "0", ";", "i", "<", "NUM_FKEYS", ";", "i", "++", ")", "{", "sprintf", "(", "Buffer", ",", "\"", "\"", ",", "i", "+", "1", ")", ";", "if", "(", "Type", "=", "FindToolType", "(", "(", "STRPTR", "*", ")", "Icon", "->", "do_ToolTypes", ",", "Buffer", ")", ")", "ConSetKey", "(", "i", ",", "Type", ",", "strlen", "(", "Type", ")", ")", ";", "else", "ConSetKey", "(", "i", ",", "\"", "\"", ",", "0", ")", ";", "}", "FreeDiskObject", "(", "Icon", ")", ";", "}", "if", "(", "WBenchMsg", "->", "sm_NumArgs", ">", "1", ")", "{", "char", "*", "Type", ";", "int", "i", ";", "for", "(", "i", "=", "0", ";", "i", "<", "WBenchMsg", "->", "sm_NumArgs", ";", "i", "++", ")", "{", "CurrentDir", "(", "WBenchMsg", "->", "sm_ArgList", "[", "i", "]", ".", "wa_Lock", ")", ";", "if", "(", "Icon", "=", "GetDiskObject", "(", "WBenchMsg", "->", "sm_ArgList", "[", "i", "]", ".", "wa_Name", ")", ")", "{", "if", "(", "Type", "=", "FindToolType", "(", "(", "STRPTR", "*", ")", "Icon", "->", "do_ToolTypes", ",", "\"", "\"", ")", ")", "{", "if", "(", "MatchToolValue", "(", "Type", ",", "\"", "\"", ")", "&&", "MatchToolValue", "(", "Type", ",", "\"", "\"", ")", ")", "{", "restore_name", "=", "WBenchMsg", "->", "sm_ArgList", "[", "i", "]", ".", "wa_Name", ";", "if", "(", "Type", "=", "FindToolType", "(", "(", "STRPTR", "*", ")", "Icon", "->", "do_ToolTypes", ",", "\"", "\"", ")", ")", "{", "BPTR", "File", ";", "if", "(", "File", "=", "Open", "(", "Type", ",", "MODE_OLDFILE", ")", ")", "{", "char", "*", "NewName", ";", "Close", "(", "File", ")", ";", "if", "(", "NewName", "=", "(", "STRPTR", ")", "malloc", "(", "strlen", "(", "Type", ")", "+", "1", ")", ")", "{", "strcpy", "(", "NewName", ",", "Type", ")", ";", "StoryName", "=", "NewName", ";", "}", "}", "}", "FreeDiskObject", "(", "Icon", ")", ";", "break", ";", "}", "if", "(", "MatchToolValue", "(", "Type", ",", "\"", "\"", ")", ")", "{", "BPTR", "File", ";", "if", "(", "File", "=", "Open", "(", "WBenchMsg", "->", "sm_ArgList", "[", "i", "]", ".", "wa_Name", ",", "MODE_OLDFILE", ")", ")", "{", "char", "*", "NewName", ";", "Close", "(", "File", ")", ";", "if", "(", "NewName", "=", "(", "STRPTR", ")", "malloc", "(", "strlen", "(", "WBenchMsg", "->", "sm_ArgList", "[", "i", "]", ".", "wa_Name", ")", "+", "1", ")", ")", "{", "strcpy", "(", "NewName", ",", "WBenchMsg", "->", "sm_ArgList", "[", "i", "]", ".", "wa_Name", ")", ";", "StoryName", "=", "NewName", ";", "}", "}", "FreeDiskObject", "(", "Icon", ")", ";", "break", ";", "}", "}", "FreeDiskObject", "(", "Icon", ")", ";", "}", "}", "}", "CloseLibrary", "(", "IconBase", ")", ";", "IconBase", "=", "NULL", ";", "}", "}", "open_story", "(", "StoryName", ")", ";", "Len", "=", "strlen", "(", "StoryName", ")", ";", "strcpy", "(", "GfxFontPath", ",", "\"", "\"", ")", ";", "if", "(", "Len", ")", "{", "int", "i", ";", "for", "(", "i", "=", "Len", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "StoryName", "[", "i", "]", "==", "'", "'", "||", "StoryName", "[", "i", "]", "==", "'", "'", ")", "{", "memcpy", "(", "GfxFontPath", ",", "StoryName", ",", "i", "+", "1", ")", ";", "GfxFontPath", "[", "i", "+", "1", "]", "=", "0", ";", "strcat", "(", "GfxFontPath", ",", "\"", "\"", ")", ";", "break", ";", "}", "}", "}", "if", "(", "SoundName", "=", "malloc", "(", "Len", "+", "40", ")", ")", "{", "strcpy", "(", "SoundName", ",", "StoryName", ")", ";", "if", "(", "Len", ")", "{", "int", "i", ";", "for", "(", "i", "=", "Len", "-", "1", ";", "i", ">=", "0", ";", "i", "--", ")", "{", "if", "(", "SoundName", "[", "i", "]", "==", "'", "'", "||", "SoundName", "[", "i", "]", "==", "'", "'", ")", "{", "SoundPath", "=", "&", "SoundName", "[", "i", "+", "1", "]", ";", "break", ";", "}", "}", "}", "if", "(", "!", "SoundPath", ")", "SoundPath", "=", "SoundName", ";", "}", "}" ]
process_arguments(int argc, char *argv[]):
[ "process_arguments", "(", "int", "argc", "char", "*", "argv", "[]", ")", ":" ]
[ "/* Does it have a filetype info attached? */", "/* Check for function key\r\n\t\t\t\t\t * defintions and set them\r\n\t\t\t\t\t * if approriate.\r\n\t\t\t\t\t */", "/* Build fkey string. */", "/* See if we can find it. */", "/* Free the icon. */", "/* Does it have a filetype info attached? */", "/* Is it a bookmark file? */", "/* Try to open the file, this is\r\n\t\t\t\t\t\t\t\t\t\t * easier than locking it, allocating\r\n\t\t\t\t\t\t\t\t\t\t * a fileinfo, reading it and then\r\n\t\t\t\t\t\t\t\t\t\t * to clean up again.\r\n\t\t\t\t\t\t\t\t\t\t */", "/* Try to open the file, this is\r\n\t\t\t\t\t\t\t\t\t * easier than locking it, allocating\r\n\t\t\t\t\t\t\t\t\t * a fileinfo, reading it and then\r\n\t\t\t\t\t\t\t\t\t * to clean up again.\r\n\t\t\t\t\t\t\t\t\t */", "/* Free the icon. */", "/* Set up the path leading to the\r\n\t\t * graphics character font.\r\n\t\t */", "/* Starting from the end of the\r\n\t\t\t * file name look for the first\r\n\t\t\t * path character.\r\n\t\t\t */", "/* Is it a path name seperation\r\n\t\t\t\t * character?\r\n\t\t\t\t */", "/* Make a copy of the game name. */", "/* Does the sound file name have any\r\n\t\t\t * length, i.e. is it a real name?\r\n\t\t\t */", "/* Starting from the end of the\r\n\t\t\t\t * file name look for the first\r\n\t\t\t\t * path character.\r\n\t\t\t\t */", "/* Is it a path name seperation\r\n\t\t\t\t\t * character?\r\n\t\t\t\t\t */", "/* Append the sound directory\r\n\t\t\t\t\t\t * name to the string.\r\n\t\t\t\t\t\t */", "/* We're finished. */", "/* If no proper subdirectory name was\r\n\t\t\t * to be found, override the entire\r\n\t\t\t * string.\r\n\t\t\t */" ]
[ { "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": [] }
482619eae54b969be6de66b5ffdfa047cbd5d605
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
UpdateStatus
void
void UpdateStatus(char *pcString, tBoolean bClrBackground) { tRectangle sRect; // // // GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG); if(bClrBackground) { // // 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; // // Draw the background of the banner. // GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); // // Put a white box around the banner. // GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); GrRectDraw(&g_sContext, &sRect); } else { // // Fill the bottom rows of the screen with blue to create the status area. // sRect.sXMin = 1; sRect.sYMin = GrContextDpyHeightGet(&g_sContext) - DISPLAY_BANNER_HEIGHT; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 2; sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT - 2; // // Draw the background of the banner. // GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); // // White text in the banner. // GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); } // // Write the current state to the left of the status area. // GrContextFontSet(&g_sContext, g_pFontFixed6x8); // // Update the status on the screen. // if(pcString != 0) { GrStringDraw(&g_sContext, pcString, -1, 8, sRect.sYMin + 8, 1); } }
//***************************************************************************** // // 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(char *pcString, tBoolean bClrBackground) { tRectangle sRect; GrContextBackgroundSet(&g_sContext, DISPLAY_BANNER_BG); if(bClrBackground) { 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_BANNER_FG); GrRectDraw(&g_sContext, &sRect); } else { sRect.sXMin = 1; sRect.sYMin = GrContextDpyHeightGet(&g_sContext) - DISPLAY_BANNER_HEIGHT; sRect.sXMax = GrContextDpyWidthGet(&g_sContext) - 2; sRect.sYMax = sRect.sYMin + DISPLAY_BANNER_HEIGHT - 2; GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_BG); GrRectFill(&g_sContext, &sRect); GrContextForegroundSet(&g_sContext, DISPLAY_BANNER_FG); } GrContextFontSet(&g_sContext, g_pFontFixed6x8); if(pcString != 0) { GrStringDraw(&g_sContext, pcString, -1, 8, sRect.sYMin + 8, 1); } }
[ "void", "UpdateStatus", "(", "char", "*", "pcString", ",", "tBoolean", "bClrBackground", ")", "{", "tRectangle", "sRect", ";", "GrContextBackgroundSet", "(", "&", "g_sContext", ",", "DISPLAY_BANNER_BG", ")", ";", "if", "(", "bClrBackground", ")", "{", "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_BANNER_FG", ")", ";", "GrRectDraw", "(", "&", "g_sContext", ",", "&", "sRect", ")", ";", "}", "else", "{", "sRect", ".", "sXMin", "=", "1", ";", "sRect", ".", "sYMin", "=", "GrContextDpyHeightGet", "(", "&", "g_sContext", ")", "-", "DISPLAY_BANNER_HEIGHT", ";", "sRect", ".", "sXMax", "=", "GrContextDpyWidthGet", "(", "&", "g_sContext", ")", "-", "2", ";", "sRect", ".", "sYMax", "=", "sRect", ".", "sYMin", "+", "DISPLAY_BANNER_HEIGHT", "-", "2", ";", "GrContextForegroundSet", "(", "&", "g_sContext", ",", "DISPLAY_BANNER_BG", ")", ";", "GrRectFill", "(", "&", "g_sContext", ",", "&", "sRect", ")", ";", "GrContextForegroundSet", "(", "&", "g_sContext", ",", "DISPLAY_BANNER_FG", ")", ";", "}", "GrContextFontSet", "(", "&", "g_sContext", ",", "g_pFontFixed6x8", ")", ";", "if", "(", "pcString", "!=", "0", ")", "{", "GrStringDraw", "(", "&", "g_sContext", ",", "pcString", ",", "-1", ",", "8", ",", "sRect", ".", "sYMin", "+", "8", ",", "1", ")", ";", "}", "}" ]
This function updates the status area of the screen.
[ "This", "function", "updates", "the", "status", "area", "of", "the", "screen", "." ]
[ "//\r", "//\r", "//\r", "//\r", "// Fill the bottom rows of the screen with blue to create the status area.\r", "//\r", "//\r", "// Draw the background of the banner.\r", "//\r", "//\r", "// Put a white box around the banner.\r", "//\r", "//\r", "// Fill the bottom rows of the screen with blue to create the status area.\r", "//\r", "//\r", "// Draw the background of the banner.\r", "//\r", "//\r", "// White text in the banner.\r", "//\r", "//\r", "// Write the current state to the left of the status area.\r", "//\r", "//\r", "// Update the status on the screen.\r", "//\r" ]
[ { "param": "pcString", "type": "char" }, { "param": "bClrBackground", "type": "tBoolean" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pcString", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bClrBackground", "type": "tBoolean", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
482619eae54b969be6de66b5ffdfa047cbd5d605
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/usb_dev_msc/usb_dev_msc.c
[ "BSD-3-Clause" ]
C
USBDMSCEventCallback
null
unsigned long USBDMSCEventCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam, void *pvMsgData) { // // Reset the time out every time an event occurs. // g_ulIdleTimeout = USBMSC_ACTIVITY_TIMEOUT; switch(ulEvent) { // // Writing to the device. // case USBD_MSC_EVENT_WRITING: { // // Only update if this is a change. // if(g_eMSCState != MSC_DEV_WRITE) { // // Go to the write state. // g_eMSCState = MSC_DEV_WRITE; // // Cause the main loop to update the screen. // g_ulFlags |= FLAG_UPDATE_STATUS; } break; } // // Reading from the device. // case USBD_MSC_EVENT_READING: { // // Only update if this is a change. // if(g_eMSCState != MSC_DEV_READ) { // // Go to the read state. // g_eMSCState = MSC_DEV_READ; // // Cause the main loop to update the screen. // g_ulFlags |= FLAG_UPDATE_STATUS; } break; } // // The USB host has disconnected from the device. // case USB_EVENT_DISCONNECTED: { // // Go to the disconnected state. // g_eMSCState = MSC_DEV_DISCONNECTED; // // Cause the main loop to update the screen. // g_ulFlags |= FLAG_UPDATE_STATUS; break; } // // The USB host has connected to the device. // case USB_EVENT_CONNECTED: { // // Go to the idle state to wait for read/writes. // g_eMSCState = MSC_DEV_IDLE; break; } case USBD_MSC_EVENT_IDLE: default: { break; } } return(0); }
//***************************************************************************** // // This function is the call back notification function provided to the USB // library's mass storage class. // //*****************************************************************************
This function is the call back notification function provided to the USB library's mass storage class.
[ "This", "function", "is", "the", "call", "back", "notification", "function", "provided", "to", "the", "USB", "library", "'", "s", "mass", "storage", "class", "." ]
unsigned long USBDMSCEventCallback(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgParam, void *pvMsgData) { g_ulIdleTimeout = USBMSC_ACTIVITY_TIMEOUT; switch(ulEvent) { case USBD_MSC_EVENT_WRITING: { if(g_eMSCState != MSC_DEV_WRITE) { g_eMSCState = MSC_DEV_WRITE; g_ulFlags |= FLAG_UPDATE_STATUS; } break; } case USBD_MSC_EVENT_READING: { if(g_eMSCState != MSC_DEV_READ) { g_eMSCState = MSC_DEV_READ; g_ulFlags |= FLAG_UPDATE_STATUS; } break; } case USB_EVENT_DISCONNECTED: { g_eMSCState = MSC_DEV_DISCONNECTED; g_ulFlags |= FLAG_UPDATE_STATUS; break; } case USB_EVENT_CONNECTED: { g_eMSCState = MSC_DEV_IDLE; break; } case USBD_MSC_EVENT_IDLE: default: { break; } } return(0); }
[ "unsigned", "long", "USBDMSCEventCallback", "(", "void", "*", "pvCBData", ",", "unsigned", "long", "ulEvent", ",", "unsigned", "long", "ulMsgParam", ",", "void", "*", "pvMsgData", ")", "{", "g_ulIdleTimeout", "=", "USBMSC_ACTIVITY_TIMEOUT", ";", "switch", "(", "ulEvent", ")", "{", "case", "USBD_MSC_EVENT_WRITING", ":", "{", "if", "(", "g_eMSCState", "!=", "MSC_DEV_WRITE", ")", "{", "g_eMSCState", "=", "MSC_DEV_WRITE", ";", "g_ulFlags", "|=", "FLAG_UPDATE_STATUS", ";", "}", "break", ";", "}", "case", "USBD_MSC_EVENT_READING", ":", "{", "if", "(", "g_eMSCState", "!=", "MSC_DEV_READ", ")", "{", "g_eMSCState", "=", "MSC_DEV_READ", ";", "g_ulFlags", "|=", "FLAG_UPDATE_STATUS", ";", "}", "break", ";", "}", "case", "USB_EVENT_DISCONNECTED", ":", "{", "g_eMSCState", "=", "MSC_DEV_DISCONNECTED", ";", "g_ulFlags", "|=", "FLAG_UPDATE_STATUS", ";", "break", ";", "}", "case", "USB_EVENT_CONNECTED", ":", "{", "g_eMSCState", "=", "MSC_DEV_IDLE", ";", "break", ";", "}", "case", "USBD_MSC_EVENT_IDLE", ":", "default", ":", "{", "break", ";", "}", "}", "return", "(", "0", ")", ";", "}" ]
This function is the call back notification function provided to the USB library's mass storage class.
[ "This", "function", "is", "the", "call", "back", "notification", "function", "provided", "to", "the", "USB", "library", "'", "s", "mass", "storage", "class", "." ]
[ "//\r", "// Reset the time out every time an event occurs.\r", "//\r", "//\r", "// Writing to the device.\r", "//\r", "//\r", "// Only update if this is a change.\r", "//\r", "//\r", "// Go to the write state.\r", "//\r", "//\r", "// Cause the main loop to update the screen.\r", "//\r", "//\r", "// Reading from the device.\r", "//\r", "//\r", "// Only update if this is a change.\r", "//\r", "//\r", "// Go to the read state.\r", "//\r", "//\r", "// Cause the main loop to update the screen.\r", "//\r", "//\r", "// The USB host has disconnected from the device.\r", "//\r", "//\r", "// Go to the disconnected state.\r", "//\r", "//\r", "// Cause the main loop to update the screen.\r", "//\r", "//\r", "// The USB host has connected to the device.\r", "//\r", "//\r", "// Go to the idle state to wait for read/writes.\r", "//\r" ]
[ { "param": "pvCBData", "type": "void" }, { "param": "ulEvent", "type": "unsigned long" }, { "param": "ulMsgParam", "type": "unsigned long" }, { "param": "pvMsgData", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvCBData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulEvent", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsgParam", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pvMsgData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
4855fe4999ff55bdb425c7f2376c80760e2984ef
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/inrush.c
[ "BSD-3-Clause" ]
C
InRushDelay
void
void InRushDelay(void) { unsigned long ulCount; // // Blink the fault LED slowly to indicate that in-rush limiting circuit is // active. // UIFaultLEDBlink(100, 50); // // Configure the first timer to produce a 80% duty cycle PWM at 20 KHz, // resulting in 12 V at the in-rush control relay. // TimerConfigure(TIMER0_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM | TIMER_CFG_B_PERIODIC)); ulCount = SYSTEM_CLOCK / 20000; TimerLoadSet(TIMER0_BASE, TIMER_A, ulCount); TimerMatchSet(TIMER0_BASE, TIMER_A, (ulCount * (15 - 12)) / 15); TimerEnable(TIMER0_BASE, TIMER_A); // // Turn the in-rush control relay off so that it will limit the in-rush // current. // GPIODirModeSet(PIN_CCP0_PORT, PIN_CCP0_PIN, GPIO_DIR_MODE_OUT); GPIOPinWrite(PIN_CCP0_PORT, PIN_CCP0_PIN, 0); // // Wait for ten interrupts before checking the DC bus voltage. This allows // the ADC time to gather valid values from its inputs. // for(ulCount = 0; ulCount < 10; ulCount++) { SysCtlSleep(); } // // Wait until the DC bus voltage rises above 200 V. // while(g_usBusVoltage < 200) { } // // Turn the in-rush control relay on so that it will no longer limit the // in-rush current. // GPIODirModeSet(PIN_CCP0_PORT, PIN_CCP0_PIN, GPIO_DIR_MODE_HW); // // Wait for the DC bus voltage to rise 20 V above the minimum bus voltage. // while(g_usBusVoltage < (g_sParameters.usMinVBus + 20)) { } // // Turn off the fault LED to indicate that in-rush current limiting is // complete. // UIFaultLEDBlink(0, 0); }
//***************************************************************************** // //! Handles the in-rush current control. //! //! This function delays while the in-rush current control resistor slows the //! buildup of voltage in the DC bus capacitors. Once the voltage is at an //! adequate level, the in-rush current control resistor is taken out of the //! circuit to allow current to freely flow from the AC line into the DC bus //! capacitors. This is called on startup to avoid excessive current into the //! DC bus. //! //! \return None. // //*****************************************************************************
Handles the in-rush current control. This function delays while the in-rush current control resistor slows the buildup of voltage in the DC bus capacitors. Once the voltage is at an adequate level, the in-rush current control resistor is taken out of the circuit to allow current to freely flow from the AC line into the DC bus capacitors. This is called on startup to avoid excessive current into the DC bus. \return None.
[ "Handles", "the", "in", "-", "rush", "current", "control", ".", "This", "function", "delays", "while", "the", "in", "-", "rush", "current", "control", "resistor", "slows", "the", "buildup", "of", "voltage", "in", "the", "DC", "bus", "capacitors", ".", "Once", "the", "voltage", "is", "at", "an", "adequate", "level", "the", "in", "-", "rush", "current", "control", "resistor", "is", "taken", "out", "of", "the", "circuit", "to", "allow", "current", "to", "freely", "flow", "from", "the", "AC", "line", "into", "the", "DC", "bus", "capacitors", ".", "This", "is", "called", "on", "startup", "to", "avoid", "excessive", "current", "into", "the", "DC", "bus", ".", "\\", "return", "None", "." ]
void InRushDelay(void) { unsigned long ulCount; UIFaultLEDBlink(100, 50); TimerConfigure(TIMER0_BASE, (TIMER_CFG_SPLIT_PAIR | TIMER_CFG_A_PWM | TIMER_CFG_B_PERIODIC)); ulCount = SYSTEM_CLOCK / 20000; TimerLoadSet(TIMER0_BASE, TIMER_A, ulCount); TimerMatchSet(TIMER0_BASE, TIMER_A, (ulCount * (15 - 12)) / 15); TimerEnable(TIMER0_BASE, TIMER_A); GPIODirModeSet(PIN_CCP0_PORT, PIN_CCP0_PIN, GPIO_DIR_MODE_OUT); GPIOPinWrite(PIN_CCP0_PORT, PIN_CCP0_PIN, 0); for(ulCount = 0; ulCount < 10; ulCount++) { SysCtlSleep(); } while(g_usBusVoltage < 200) { } GPIODirModeSet(PIN_CCP0_PORT, PIN_CCP0_PIN, GPIO_DIR_MODE_HW); while(g_usBusVoltage < (g_sParameters.usMinVBus + 20)) { } UIFaultLEDBlink(0, 0); }
[ "void", "InRushDelay", "(", "void", ")", "{", "unsigned", "long", "ulCount", ";", "UIFaultLEDBlink", "(", "100", ",", "50", ")", ";", "TimerConfigure", "(", "TIMER0_BASE", ",", "(", "TIMER_CFG_SPLIT_PAIR", "|", "TIMER_CFG_A_PWM", "|", "TIMER_CFG_B_PERIODIC", ")", ")", ";", "ulCount", "=", "SYSTEM_CLOCK", "/", "20000", ";", "TimerLoadSet", "(", "TIMER0_BASE", ",", "TIMER_A", ",", "ulCount", ")", ";", "TimerMatchSet", "(", "TIMER0_BASE", ",", "TIMER_A", ",", "(", "ulCount", "*", "(", "15", "-", "12", ")", ")", "/", "15", ")", ";", "TimerEnable", "(", "TIMER0_BASE", ",", "TIMER_A", ")", ";", "GPIODirModeSet", "(", "PIN_CCP0_PORT", ",", "PIN_CCP0_PIN", ",", "GPIO_DIR_MODE_OUT", ")", ";", "GPIOPinWrite", "(", "PIN_CCP0_PORT", ",", "PIN_CCP0_PIN", ",", "0", ")", ";", "for", "(", "ulCount", "=", "0", ";", "ulCount", "<", "10", ";", "ulCount", "++", ")", "{", "SysCtlSleep", "(", ")", ";", "}", "while", "(", "g_usBusVoltage", "<", "200", ")", "{", "}", "GPIODirModeSet", "(", "PIN_CCP0_PORT", ",", "PIN_CCP0_PIN", ",", "GPIO_DIR_MODE_HW", ")", ";", "while", "(", "g_usBusVoltage", "<", "(", "g_sParameters", ".", "usMinVBus", "+", "20", ")", ")", "{", "}", "UIFaultLEDBlink", "(", "0", ",", "0", ")", ";", "}" ]
Handles the in-rush current control.
[ "Handles", "the", "in", "-", "rush", "current", "control", "." ]
[ "//\r", "// Blink the fault LED slowly to indicate that in-rush limiting circuit is\r", "// active.\r", "//\r", "//\r", "// Configure the first timer to produce a 80% duty cycle PWM at 20 KHz,\r", "// resulting in 12 V at the in-rush control relay.\r", "//\r", "//\r", "// Turn the in-rush control relay off so that it will limit the in-rush\r", "// current.\r", "//\r", "//\r", "// Wait for ten interrupts before checking the DC bus voltage. This allows\r", "// the ADC time to gather valid values from its inputs.\r", "//\r", "//\r", "// Wait until the DC bus voltage rises above 200 V.\r", "//\r", "//\r", "// Turn the in-rush control relay on so that it will no longer limit the\r", "// in-rush current.\r", "//\r", "//\r", "// Wait for the DC bus voltage to rise 20 V above the minimum bus voltage.\r", "//\r", "//\r", "// Turn off the fault LED to indicate that in-rush current limiting is\r", "// complete.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
4855fe4999ff55bdb425c7f2376c80760e2984ef
junyanl-code/Luminary-Micro-Library
boards/rdk-acim/qs-acim/inrush.c
[ "BSD-3-Clause" ]
C
InRushRelayAdjust
void
void InRushRelayAdjust(void) { unsigned long ulCount; // // Reconfigure the timer to produce the same 80% duty cycle PWM at 20 KHz; // now it is based on the crystal clocking the system instead of the PLL. // ulCount = CRYSTAL_CLOCK / 20000; TimerDisable(TIMER0_BASE, TIMER_A); TimerLoadSet(TIMER0_BASE, TIMER_A, ulCount); TimerMatchSet(TIMER0_BASE, TIMER_A, (ulCount * (15 - 12)) / 15); TimerEnable(TIMER0_BASE, TIMER_A); }
//***************************************************************************** // //! Adjusts the in-rush control relay drive signal for operating from the //! crystal. //! //! This function adjusts the drive signal to the in-rush control relay to //! achieve the desired drive frequency when operating the microcontroller from //! the crystal instead of from the PLL. //! //! \return None. // //*****************************************************************************
Adjusts the in-rush control relay drive signal for operating from the crystal. This function adjusts the drive signal to the in-rush control relay to achieve the desired drive frequency when operating the microcontroller from the crystal instead of from the PLL. \return None.
[ "Adjusts", "the", "in", "-", "rush", "control", "relay", "drive", "signal", "for", "operating", "from", "the", "crystal", ".", "This", "function", "adjusts", "the", "drive", "signal", "to", "the", "in", "-", "rush", "control", "relay", "to", "achieve", "the", "desired", "drive", "frequency", "when", "operating", "the", "microcontroller", "from", "the", "crystal", "instead", "of", "from", "the", "PLL", ".", "\\", "return", "None", "." ]
void InRushRelayAdjust(void) { unsigned long ulCount; ulCount = CRYSTAL_CLOCK / 20000; TimerDisable(TIMER0_BASE, TIMER_A); TimerLoadSet(TIMER0_BASE, TIMER_A, ulCount); TimerMatchSet(TIMER0_BASE, TIMER_A, (ulCount * (15 - 12)) / 15); TimerEnable(TIMER0_BASE, TIMER_A); }
[ "void", "InRushRelayAdjust", "(", "void", ")", "{", "unsigned", "long", "ulCount", ";", "ulCount", "=", "CRYSTAL_CLOCK", "/", "20000", ";", "TimerDisable", "(", "TIMER0_BASE", ",", "TIMER_A", ")", ";", "TimerLoadSet", "(", "TIMER0_BASE", ",", "TIMER_A", ",", "ulCount", ")", ";", "TimerMatchSet", "(", "TIMER0_BASE", ",", "TIMER_A", ",", "(", "ulCount", "*", "(", "15", "-", "12", ")", ")", "/", "15", ")", ";", "TimerEnable", "(", "TIMER0_BASE", ",", "TIMER_A", ")", ";", "}" ]
Adjusts the in-rush control relay drive signal for operating from the crystal.
[ "Adjusts", "the", "in", "-", "rush", "control", "relay", "drive", "signal", "for", "operating", "from", "the", "crystal", "." ]
[ "//\r", "// Reconfigure the timer to produce the same 80% duty cycle PWM at 20 KHz;\r", "// now it is based on the crystal clocking the system instead of the PLL.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
487f91b124374c88d5da762769365f93e2cee3d2
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/drivers/extram.c
[ "BSD-3-Clause" ]
C
SDRAMInit
tBoolean
tBoolean SDRAMInit(unsigned long ulEPIDivider, unsigned long ulConfig, unsigned long ulRefresh) { // // If any daughter board is installed, return here indicating that SDRAM // is not present. // if(g_eDaughterType != DAUGHTER_NONE) { return(false); } // // Set the EPI divider. // EPIDividerSet(EPI0_BASE, ulEPIDivider); // // Select SDRAM mode. // EPIModeSet(EPI0_BASE, EPI_MODE_SDRAM); // // Configure SDRAM mode. // EPIConfigSDRAMSet(EPI0_BASE, ulConfig, ulRefresh); // // Set the address map. // EPIAddressMapSet(EPI0_BASE, EPI_ADDR_RAM_SIZE_256MB | EPI_ADDR_RAM_BASE_6); // // Wait for the EPI initialization to complete. // while(HWREG(EPI0_BASE + EPI_O_STAT) & EPI_STAT_INITSEQ) { // // Wait for SDRAM initialization to complete. // } // // Set the EPI mem pointer to the base of EPI mem // g_pusEPIMem = (unsigned short *)0x60000000; // // At this point, the SDRAM should be accessible. We attempt a couple // of writes then read back the memory to see if it seems to be there. // g_pusEPIMem[0] = 0xABCD; g_pusEPIMem[1] = 0x5AA5; // // Read back the patterns we just wrote to make sure they are valid. Note // that we declared g_pusEPIMem as volatile so the compiler should not // optimize these reads out of the image. // if((g_pusEPIMem[0] == 0xABCD) && (g_pusEPIMem[1] == 0x5AA5)) { // // The memory appears to be there so remember that we found it. // g_bExtRAMPresent = true; // // Now set up the heap that SDRAMAlloc() and SDRAMFree() will use. // bpool((void *)g_pusEPIMem, SDRAM_SIZE_BYTES); } // // If we get this far, the SDRAM heap has been successfully initialized. // return(g_bExtRAMPresent); }
//***************************************************************************** // //! Initializes the SDRAM. //! //! \param ulEPIDivider is the EPI clock divider to use. //! \param ulConfig is the SDRAM interface configuration. //! \param ulRefresh is the refresh count in core clocks (0-2047). //! //! This function must be called prior to SDRAMAlloc() or SDRAMFree() and //! after PinoutSet(). It configures the Stellaris microcontroller EPI //! block for SDRAM access and initializes the SDRAM heap (if SDRAM is found). //! The parameter \e ulConfig is the logical OR of several sets of choices: //! //! The processor core frequency must be specified with one of the following: //! //! - \b EPI_SDRAM_CORE_FREQ_0_15 - core clock is 0 MHz < clk <= 15 MHz //! - \b EPI_SDRAM_CORE_FREQ_15_30 - core clock is 15 MHz < clk <= 30 MHz //! - \b EPI_SDRAM_CORE_FREQ_30_50 - core clock is 30 MHz < clk <= 50 MHz //! - \b EPI_SDRAM_CORE_FREQ_50_100 - core clock is 50 MHz < clk <= 100 MHz //! //! The low power mode is specified with one of the following: //! //! - \b EPI_SDRAM_LOW_POWER - enter low power, self-refresh state //! - \b EPI_SDRAM_FULL_POWER - normal operating state //! //! The SDRAM device size is specified with one of the following: //! //! - \b EPI_SDRAM_SIZE_64MBIT - 64 Mbit device (8 MB) //! - \b EPI_SDRAM_SIZE_128MBIT - 128 Mbit device (16 MB) //! - \b EPI_SDRAM_SIZE_256MBIT - 256 Mbit device (32 MB) //! - \b EPI_SDRAM_SIZE_512MBIT - 512 Mbit device (64 MB) //! //! The parameter \e ulRefresh sets the refresh counter in units of core //! clock ticks. It is an 11-bit value with a range of 0 - 2047 counts. //! //! \return Returns \b true on success of \b false if no SDRAM is found or //! any other error occurs. // //*****************************************************************************
Initializes the SDRAM. \param ulEPIDivider is the EPI clock divider to use. \param ulConfig is the SDRAM interface configuration. \param ulRefresh is the refresh count in core clocks (0-2047). This function must be called prior to SDRAMAlloc() or SDRAMFree() and after PinoutSet(). It configures the Stellaris microcontroller EPI block for SDRAM access and initializes the SDRAM heap (if SDRAM is found). The parameter \e ulConfig is the logical OR of several sets of choices. The processor core frequency must be specified with one of the following. The low power mode is specified with one of the following. \b EPI_SDRAM_LOW_POWER - enter low power, self-refresh state \b EPI_SDRAM_FULL_POWER - normal operating state The SDRAM device size is specified with one of the following. \b EPI_SDRAM_SIZE_64MBIT - 64 Mbit device (8 MB) \b EPI_SDRAM_SIZE_128MBIT - 128 Mbit device (16 MB) \b EPI_SDRAM_SIZE_256MBIT - 256 Mbit device (32 MB) \b EPI_SDRAM_SIZE_512MBIT - 512 Mbit device (64 MB) The parameter \e ulRefresh sets the refresh counter in units of core clock ticks. It is an 11-bit value with a range of 0 - 2047 counts. \return Returns \b true on success of \b false if no SDRAM is found or any other error occurs.
[ "Initializes", "the", "SDRAM", ".", "\\", "param", "ulEPIDivider", "is", "the", "EPI", "clock", "divider", "to", "use", ".", "\\", "param", "ulConfig", "is", "the", "SDRAM", "interface", "configuration", ".", "\\", "param", "ulRefresh", "is", "the", "refresh", "count", "in", "core", "clocks", "(", "0", "-", "2047", ")", ".", "This", "function", "must", "be", "called", "prior", "to", "SDRAMAlloc", "()", "or", "SDRAMFree", "()", "and", "after", "PinoutSet", "()", ".", "It", "configures", "the", "Stellaris", "microcontroller", "EPI", "block", "for", "SDRAM", "access", "and", "initializes", "the", "SDRAM", "heap", "(", "if", "SDRAM", "is", "found", ")", ".", "The", "parameter", "\\", "e", "ulConfig", "is", "the", "logical", "OR", "of", "several", "sets", "of", "choices", ".", "The", "processor", "core", "frequency", "must", "be", "specified", "with", "one", "of", "the", "following", ".", "The", "low", "power", "mode", "is", "specified", "with", "one", "of", "the", "following", ".", "\\", "b", "EPI_SDRAM_LOW_POWER", "-", "enter", "low", "power", "self", "-", "refresh", "state", "\\", "b", "EPI_SDRAM_FULL_POWER", "-", "normal", "operating", "state", "The", "SDRAM", "device", "size", "is", "specified", "with", "one", "of", "the", "following", ".", "\\", "b", "EPI_SDRAM_SIZE_64MBIT", "-", "64", "Mbit", "device", "(", "8", "MB", ")", "\\", "b", "EPI_SDRAM_SIZE_128MBIT", "-", "128", "Mbit", "device", "(", "16", "MB", ")", "\\", "b", "EPI_SDRAM_SIZE_256MBIT", "-", "256", "Mbit", "device", "(", "32", "MB", ")", "\\", "b", "EPI_SDRAM_SIZE_512MBIT", "-", "512", "Mbit", "device", "(", "64", "MB", ")", "The", "parameter", "\\", "e", "ulRefresh", "sets", "the", "refresh", "counter", "in", "units", "of", "core", "clock", "ticks", ".", "It", "is", "an", "11", "-", "bit", "value", "with", "a", "range", "of", "0", "-", "2047", "counts", ".", "\\", "return", "Returns", "\\", "b", "true", "on", "success", "of", "\\", "b", "false", "if", "no", "SDRAM", "is", "found", "or", "any", "other", "error", "occurs", "." ]
tBoolean SDRAMInit(unsigned long ulEPIDivider, unsigned long ulConfig, unsigned long ulRefresh) { if(g_eDaughterType != DAUGHTER_NONE) { return(false); } EPIDividerSet(EPI0_BASE, ulEPIDivider); EPIModeSet(EPI0_BASE, EPI_MODE_SDRAM); EPIConfigSDRAMSet(EPI0_BASE, ulConfig, ulRefresh); EPIAddressMapSet(EPI0_BASE, EPI_ADDR_RAM_SIZE_256MB | EPI_ADDR_RAM_BASE_6); while(HWREG(EPI0_BASE + EPI_O_STAT) & EPI_STAT_INITSEQ) { } g_pusEPIMem = (unsigned short *)0x60000000; g_pusEPIMem[0] = 0xABCD; g_pusEPIMem[1] = 0x5AA5; if((g_pusEPIMem[0] == 0xABCD) && (g_pusEPIMem[1] == 0x5AA5)) { g_bExtRAMPresent = true; bpool((void *)g_pusEPIMem, SDRAM_SIZE_BYTES); } return(g_bExtRAMPresent); }
[ "tBoolean", "SDRAMInit", "(", "unsigned", "long", "ulEPIDivider", ",", "unsigned", "long", "ulConfig", ",", "unsigned", "long", "ulRefresh", ")", "{", "if", "(", "g_eDaughterType", "!=", "DAUGHTER_NONE", ")", "{", "return", "(", "false", ")", ";", "}", "EPIDividerSet", "(", "EPI0_BASE", ",", "ulEPIDivider", ")", ";", "EPIModeSet", "(", "EPI0_BASE", ",", "EPI_MODE_SDRAM", ")", ";", "EPIConfigSDRAMSet", "(", "EPI0_BASE", ",", "ulConfig", ",", "ulRefresh", ")", ";", "EPIAddressMapSet", "(", "EPI0_BASE", ",", "EPI_ADDR_RAM_SIZE_256MB", "|", "EPI_ADDR_RAM_BASE_6", ")", ";", "while", "(", "HWREG", "(", "EPI0_BASE", "+", "EPI_O_STAT", ")", "&", "EPI_STAT_INITSEQ", ")", "{", "}", "g_pusEPIMem", "=", "(", "unsigned", "short", "*", ")", "0x60000000", ";", "g_pusEPIMem", "[", "0", "]", "=", "0xABCD", ";", "g_pusEPIMem", "[", "1", "]", "=", "0x5AA5", ";", "if", "(", "(", "g_pusEPIMem", "[", "0", "]", "==", "0xABCD", ")", "&&", "(", "g_pusEPIMem", "[", "1", "]", "==", "0x5AA5", ")", ")", "{", "g_bExtRAMPresent", "=", "true", ";", "bpool", "(", "(", "void", "*", ")", "g_pusEPIMem", ",", "SDRAM_SIZE_BYTES", ")", ";", "}", "return", "(", "g_bExtRAMPresent", ")", ";", "}" ]
Initializes the SDRAM.
[ "Initializes", "the", "SDRAM", "." ]
[ "//\r", "// If any daughter board is installed, return here indicating that SDRAM\r", "// is not present.\r", "//\r", "//\r", "// Set the EPI divider.\r", "//\r", "//\r", "// Select SDRAM mode.\r", "//\r", "//\r", "// Configure SDRAM mode.\r", "//\r", "//\r", "// Set the address map.\r", "//\r", "//\r", "// Wait for the EPI initialization to complete.\r", "//\r", "//\r", "// Wait for SDRAM initialization to complete.\r", "//\r", "//\r", "// Set the EPI mem pointer to the base of EPI mem\r", "//\r", "//\r", "// At this point, the SDRAM should be accessible. We attempt a couple\r", "// of writes then read back the memory to see if it seems to be there.\r", "//\r", "//\r", "// Read back the patterns we just wrote to make sure they are valid. Note\r", "// that we declared g_pusEPIMem as volatile so the compiler should not\r", "// optimize these reads out of the image.\r", "//\r", "//\r", "// The memory appears to be there so remember that we found it.\r", "//\r", "//\r", "// Now set up the heap that SDRAMAlloc() and SDRAMFree() will use.\r", "//\r", "//\r", "// If we get this far, the SDRAM heap has been successfully initialized.\r", "//\r" ]
[ { "param": "ulEPIDivider", "type": "unsigned long" }, { "param": "ulConfig", "type": "unsigned long" }, { "param": "ulRefresh", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulEPIDivider", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulConfig", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulRefresh", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
487f91b124374c88d5da762769365f93e2cee3d2
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/drivers/extram.c
[ "BSD-3-Clause" ]
C
ExtRAMHeapInit
tBoolean
tBoolean ExtRAMHeapInit(void) { volatile unsigned char *pucTest; // // Is the correct daughter board installed? // if(g_eDaughterType == DAUGHTER_SRAM_FLASH) { // // Test that we can access the SRAM on the daughter board. // pucTest = (volatile unsigned char *)EXT_SRAM_BASE; pucTest[0] = 0xAA; pucTest[1] = 0x55; if((pucTest[0] == 0xAA) && (pucTest[1] == 0x55)) { // // The memory appears to be there so remember that we found it. // g_bExtRAMPresent = true; // // Now set up the heap that ExtRAMAlloc() and ExtRAMFree() will use. // bpool((void *)pucTest, SRAM_MEM_SIZE); } } else { // // The SRAM/Flash daughter board is not currently installed. // return(false); } // // If we get here, all is well so pass this good news back to the caller. // return(true); }
//***************************************************************************** // //! Initializes any daughter-board SRAM as the external RAM heap. //! //! When an SRAM/Flash daughter board is installed, this function may be used //! to configure the memory manager to use the SRAM on this board rather than //! the SDRAM as its heap. This allows software to call the ExtRAMAlloc() and //! ExtRAMFree() functions to manage the SRAM on the daughter board. //! //! Function PinoutSet() must be called before this function. //! //! \return Returns \b true on success of \b false if no SRAM is found or //! any other error occurs. // //*****************************************************************************
Initializes any daughter-board SRAM as the external RAM heap. When an SRAM/Flash daughter board is installed, this function may be used to configure the memory manager to use the SRAM on this board rather than the SDRAM as its heap. This allows software to call the ExtRAMAlloc() and ExtRAMFree() functions to manage the SRAM on the daughter board. Function PinoutSet() must be called before this function. \return Returns \b true on success of \b false if no SRAM is found or any other error occurs.
[ "Initializes", "any", "daughter", "-", "board", "SRAM", "as", "the", "external", "RAM", "heap", ".", "When", "an", "SRAM", "/", "Flash", "daughter", "board", "is", "installed", "this", "function", "may", "be", "used", "to", "configure", "the", "memory", "manager", "to", "use", "the", "SRAM", "on", "this", "board", "rather", "than", "the", "SDRAM", "as", "its", "heap", ".", "This", "allows", "software", "to", "call", "the", "ExtRAMAlloc", "()", "and", "ExtRAMFree", "()", "functions", "to", "manage", "the", "SRAM", "on", "the", "daughter", "board", ".", "Function", "PinoutSet", "()", "must", "be", "called", "before", "this", "function", ".", "\\", "return", "Returns", "\\", "b", "true", "on", "success", "of", "\\", "b", "false", "if", "no", "SRAM", "is", "found", "or", "any", "other", "error", "occurs", "." ]
tBoolean ExtRAMHeapInit(void) { volatile unsigned char *pucTest; if(g_eDaughterType == DAUGHTER_SRAM_FLASH) { pucTest = (volatile unsigned char *)EXT_SRAM_BASE; pucTest[0] = 0xAA; pucTest[1] = 0x55; if((pucTest[0] == 0xAA) && (pucTest[1] == 0x55)) { g_bExtRAMPresent = true; bpool((void *)pucTest, SRAM_MEM_SIZE); } } else { return(false); } return(true); }
[ "tBoolean", "ExtRAMHeapInit", "(", "void", ")", "{", "volatile", "unsigned", "char", "*", "pucTest", ";", "if", "(", "g_eDaughterType", "==", "DAUGHTER_SRAM_FLASH", ")", "{", "pucTest", "=", "(", "volatile", "unsigned", "char", "*", ")", "EXT_SRAM_BASE", ";", "pucTest", "[", "0", "]", "=", "0xAA", ";", "pucTest", "[", "1", "]", "=", "0x55", ";", "if", "(", "(", "pucTest", "[", "0", "]", "==", "0xAA", ")", "&&", "(", "pucTest", "[", "1", "]", "==", "0x55", ")", ")", "{", "g_bExtRAMPresent", "=", "true", ";", "bpool", "(", "(", "void", "*", ")", "pucTest", ",", "SRAM_MEM_SIZE", ")", ";", "}", "}", "else", "{", "return", "(", "false", ")", ";", "}", "return", "(", "true", ")", ";", "}" ]
Initializes any daughter-board SRAM as the external RAM heap.
[ "Initializes", "any", "daughter", "-", "board", "SRAM", "as", "the", "external", "RAM", "heap", "." ]
[ "//\r", "// Is the correct daughter board installed?\r", "//\r", "//\r", "// Test that we can access the SRAM on the daughter board.\r", "//\r", "//\r", "// The memory appears to be there so remember that we found it.\r", "//\r", "//\r", "// Now set up the heap that ExtRAMAlloc() and ExtRAMFree() will use.\r", "//\r", "//\r", "// The SRAM/Flash daughter board is not currently installed.\r", "//\r", "//\r", "// If we get here, all is well so pass this good news back to the caller.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
487f91b124374c88d5da762769365f93e2cee3d2
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/drivers/extram.c
[ "BSD-3-Clause" ]
C
ExtRAMAlloc
void
void * ExtRAMAlloc(unsigned long ulSize) { if(g_bExtRAMPresent) { return(bget(ulSize)); } else { return((void *)0); } }
//***************************************************************************** // //! Allocates a block of memory from the SDRAM heap. //! //! \param ulSize is the size in bytes of the block of external RAM to allocate. //! //! This function allocates a block of external RAM and returns its pointer. If //! insufficient space exists to fulfill the request, a NULL pointer is returned. //! //! \return Returns a non-zero pointer on success or NULL if it is not possible //! to allocate the required memory. // //*****************************************************************************
Allocates a block of memory from the SDRAM heap. \param ulSize is the size in bytes of the block of external RAM to allocate. This function allocates a block of external RAM and returns its pointer. If insufficient space exists to fulfill the request, a NULL pointer is returned. \return Returns a non-zero pointer on success or NULL if it is not possible to allocate the required memory.
[ "Allocates", "a", "block", "of", "memory", "from", "the", "SDRAM", "heap", ".", "\\", "param", "ulSize", "is", "the", "size", "in", "bytes", "of", "the", "block", "of", "external", "RAM", "to", "allocate", ".", "This", "function", "allocates", "a", "block", "of", "external", "RAM", "and", "returns", "its", "pointer", ".", "If", "insufficient", "space", "exists", "to", "fulfill", "the", "request", "a", "NULL", "pointer", "is", "returned", ".", "\\", "return", "Returns", "a", "non", "-", "zero", "pointer", "on", "success", "or", "NULL", "if", "it", "is", "not", "possible", "to", "allocate", "the", "required", "memory", "." ]
void * ExtRAMAlloc(unsigned long ulSize) { if(g_bExtRAMPresent) { return(bget(ulSize)); } else { return((void *)0); } }
[ "void", "*", "ExtRAMAlloc", "(", "unsigned", "long", "ulSize", ")", "{", "if", "(", "g_bExtRAMPresent", ")", "{", "return", "(", "bget", "(", "ulSize", ")", ")", ";", "}", "else", "{", "return", "(", "(", "void", "*", ")", "0", ")", ";", "}", "}" ]
Allocates a block of memory from the SDRAM heap.
[ "Allocates", "a", "block", "of", "memory", "from", "the", "SDRAM", "heap", "." ]
[]
[ { "param": "ulSize", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulSize", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
487f91b124374c88d5da762769365f93e2cee3d2
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/drivers/extram.c
[ "BSD-3-Clause" ]
C
ExtRAMFree
void
void ExtRAMFree(void *pvBlock) { if(g_bExtRAMPresent) { brel(pvBlock); } }
//***************************************************************************** // //! Frees a block of memory in the SDRAM heap. //! //! \param pvBlock is the pointer to the block of SDRAM to free. //! //! This function frees a block of memory that had previously been allocated //! using a call to ExtRAMAlloc(); //! //! \return None. // //*****************************************************************************
Frees a block of memory in the SDRAM heap. \param pvBlock is the pointer to the block of SDRAM to free. This function frees a block of memory that had previously been allocated using a call to ExtRAMAlloc(). \return None.
[ "Frees", "a", "block", "of", "memory", "in", "the", "SDRAM", "heap", ".", "\\", "param", "pvBlock", "is", "the", "pointer", "to", "the", "block", "of", "SDRAM", "to", "free", ".", "This", "function", "frees", "a", "block", "of", "memory", "that", "had", "previously", "been", "allocated", "using", "a", "call", "to", "ExtRAMAlloc", "()", ".", "\\", "return", "None", "." ]
void ExtRAMFree(void *pvBlock) { if(g_bExtRAMPresent) { brel(pvBlock); } }
[ "void", "ExtRAMFree", "(", "void", "*", "pvBlock", ")", "{", "if", "(", "g_bExtRAMPresent", ")", "{", "brel", "(", "pvBlock", ")", ";", "}", "}" ]
Frees a block of memory in the SDRAM heap.
[ "Frees", "a", "block", "of", "memory", "in", "the", "SDRAM", "heap", "." ]
[]
[ { "param": "pvBlock", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvBlock", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
487f91b124374c88d5da762769365f93e2cee3d2
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9d96/drivers/extram.c
[ "BSD-3-Clause" ]
C
ExtRAMMaxFree
null
unsigned long ExtRAMMaxFree(unsigned long *pulTotalFree) { bufsize sizeTotalFree, sizeTotalAlloc, sizeMaxFree; long lGet, lRel; if(g_bExtRAMPresent) { bstats(&sizeTotalAlloc, &sizeTotalFree, &sizeMaxFree, &lGet, &lRel); *pulTotalFree = (unsigned long)sizeTotalFree; return(sizeMaxFree); } else { *pulTotalFree = 0; return(0); } }
//***************************************************************************** // //! Reports information on the current heap usage. //! //! \param pulTotalFree points to storage which will be written with the total //! number of bytes unallocated in the heap. //! //! This function reports the total amount of memory free in the SDRAM heap and //! the size of the largest available block. It is included in the build only //! if label INCLUDE_BGET_STATS is defined. //! //! \return Returns the size of the largest available free block in the SDRAM //! heap. // //*****************************************************************************
Reports information on the current heap usage. \param pulTotalFree points to storage which will be written with the total number of bytes unallocated in the heap. This function reports the total amount of memory free in the SDRAM heap and the size of the largest available block. It is included in the build only if label INCLUDE_BGET_STATS is defined. \return Returns the size of the largest available free block in the SDRAM heap.
[ "Reports", "information", "on", "the", "current", "heap", "usage", ".", "\\", "param", "pulTotalFree", "points", "to", "storage", "which", "will", "be", "written", "with", "the", "total", "number", "of", "bytes", "unallocated", "in", "the", "heap", ".", "This", "function", "reports", "the", "total", "amount", "of", "memory", "free", "in", "the", "SDRAM", "heap", "and", "the", "size", "of", "the", "largest", "available", "block", ".", "It", "is", "included", "in", "the", "build", "only", "if", "label", "INCLUDE_BGET_STATS", "is", "defined", ".", "\\", "return", "Returns", "the", "size", "of", "the", "largest", "available", "free", "block", "in", "the", "SDRAM", "heap", "." ]
unsigned long ExtRAMMaxFree(unsigned long *pulTotalFree) { bufsize sizeTotalFree, sizeTotalAlloc, sizeMaxFree; long lGet, lRel; if(g_bExtRAMPresent) { bstats(&sizeTotalAlloc, &sizeTotalFree, &sizeMaxFree, &lGet, &lRel); *pulTotalFree = (unsigned long)sizeTotalFree; return(sizeMaxFree); } else { *pulTotalFree = 0; return(0); } }
[ "unsigned", "long", "ExtRAMMaxFree", "(", "unsigned", "long", "*", "pulTotalFree", ")", "{", "bufsize", "sizeTotalFree", ",", "sizeTotalAlloc", ",", "sizeMaxFree", ";", "long", "lGet", ",", "lRel", ";", "if", "(", "g_bExtRAMPresent", ")", "{", "bstats", "(", "&", "sizeTotalAlloc", ",", "&", "sizeTotalFree", ",", "&", "sizeMaxFree", ",", "&", "lGet", ",", "&", "lRel", ")", ";", "*", "pulTotalFree", "=", "(", "unsigned", "long", ")", "sizeTotalFree", ";", "return", "(", "sizeMaxFree", ")", ";", "}", "else", "{", "*", "pulTotalFree", "=", "0", ";", "return", "(", "0", ")", ";", "}", "}" ]
Reports information on the current heap usage.
[ "Reports", "information", "on", "the", "current", "heap", "usage", "." ]
[]
[ { "param": "pulTotalFree", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pulTotalFree", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2770617e43d2bb8285081dfc5cf7838a45261f75
junyanl-code/Luminary-Micro-Library
boards/ek-evalbot/qs-autonomous/pid.c
[ "BSD-3-Clause" ]
C
PIDInitialize
void
void PIDInitialize(tPIDState *psState, long lIntegMax, long lIntegMin, long lPGain, long lIGain, long lDGain) { // // Set the internal state, and save the integrator limits and gain factors. // psState->lIntegrator = 0; psState->lIntegMax = lIntegMax; psState->lIntegMin = lIntegMin; psState->lPrevError = 0; psState->lPGain = lPGain; psState->lIGain = lIGain; psState->lDGain = lDGain; }
//***************************************************************************** // // This function will initialize the internal state of the PID algorithm. This // must be done before the PID algorithm can be executed or random results will // occur. // // By using a derivative gain of zero, this reduces to a simple PI controller. // By using a integral and derivative gain of zero, it reduces to an even // simpler P controller. The response requirements of the process being // controlled determines the terms required to achieve that level of response. // Controlling motors can typically be done with a simple PI controller. // //*****************************************************************************
This function will initialize the internal state of the PID algorithm. This must be done before the PID algorithm can be executed or random results will occur. By using a derivative gain of zero, this reduces to a simple PI controller. By using a integral and derivative gain of zero, it reduces to an even simpler P controller. The response requirements of the process being controlled determines the terms required to achieve that level of response. Controlling motors can typically be done with a simple PI controller.
[ "This", "function", "will", "initialize", "the", "internal", "state", "of", "the", "PID", "algorithm", ".", "This", "must", "be", "done", "before", "the", "PID", "algorithm", "can", "be", "executed", "or", "random", "results", "will", "occur", ".", "By", "using", "a", "derivative", "gain", "of", "zero", "this", "reduces", "to", "a", "simple", "PI", "controller", ".", "By", "using", "a", "integral", "and", "derivative", "gain", "of", "zero", "it", "reduces", "to", "an", "even", "simpler", "P", "controller", ".", "The", "response", "requirements", "of", "the", "process", "being", "controlled", "determines", "the", "terms", "required", "to", "achieve", "that", "level", "of", "response", ".", "Controlling", "motors", "can", "typically", "be", "done", "with", "a", "simple", "PI", "controller", "." ]
void PIDInitialize(tPIDState *psState, long lIntegMax, long lIntegMin, long lPGain, long lIGain, long lDGain) { psState->lIntegrator = 0; psState->lIntegMax = lIntegMax; psState->lIntegMin = lIntegMin; psState->lPrevError = 0; psState->lPGain = lPGain; psState->lIGain = lIGain; psState->lDGain = lDGain; }
[ "void", "PIDInitialize", "(", "tPIDState", "*", "psState", ",", "long", "lIntegMax", ",", "long", "lIntegMin", ",", "long", "lPGain", ",", "long", "lIGain", ",", "long", "lDGain", ")", "{", "psState", "->", "lIntegrator", "=", "0", ";", "psState", "->", "lIntegMax", "=", "lIntegMax", ";", "psState", "->", "lIntegMin", "=", "lIntegMin", ";", "psState", "->", "lPrevError", "=", "0", ";", "psState", "->", "lPGain", "=", "lPGain", ";", "psState", "->", "lIGain", "=", "lIGain", ";", "psState", "->", "lDGain", "=", "lDGain", ";", "}" ]
This function will initialize the internal state of the PID algorithm.
[ "This", "function", "will", "initialize", "the", "internal", "state", "of", "the", "PID", "algorithm", "." ]
[ "//\r", "// Set the internal state, and save the integrator limits and gain factors.\r", "//\r" ]
[ { "param": "psState", "type": "tPIDState" }, { "param": "lIntegMax", "type": "long" }, { "param": "lIntegMin", "type": "long" }, { "param": "lPGain", "type": "long" }, { "param": "lIGain", "type": "long" }, { "param": "lDGain", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psState", "type": "tPIDState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lIntegMax", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lIntegMin", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lPGain", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lIGain", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lDGain", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2770617e43d2bb8285081dfc5cf7838a45261f75
junyanl-code/Luminary-Micro-Library
boards/ek-evalbot/qs-autonomous/pid.c
[ "BSD-3-Clause" ]
C
PIDGainPSet
void
void PIDGainPSet(tPIDState *psState, long lPGain) { // // Save the P gain factor. // psState->lPGain = lPGain; }
//***************************************************************************** // // This function will change the P gain factor used by the PID algorithm. // //*****************************************************************************
This function will change the P gain factor used by the PID algorithm.
[ "This", "function", "will", "change", "the", "P", "gain", "factor", "used", "by", "the", "PID", "algorithm", "." ]
void PIDGainPSet(tPIDState *psState, long lPGain) { psState->lPGain = lPGain; }
[ "void", "PIDGainPSet", "(", "tPIDState", "*", "psState", ",", "long", "lPGain", ")", "{", "psState", "->", "lPGain", "=", "lPGain", ";", "}" ]
This function will change the P gain factor used by the PID algorithm.
[ "This", "function", "will", "change", "the", "P", "gain", "factor", "used", "by", "the", "PID", "algorithm", "." ]
[ "//\r", "// Save the P gain factor.\r", "//\r" ]
[ { "param": "psState", "type": "tPIDState" }, { "param": "lPGain", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psState", "type": "tPIDState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lPGain", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2770617e43d2bb8285081dfc5cf7838a45261f75
junyanl-code/Luminary-Micro-Library
boards/ek-evalbot/qs-autonomous/pid.c
[ "BSD-3-Clause" ]
C
PIDGainISet
void
void PIDGainISet(tPIDState *psState, long lIGain, long lIntegMax, long lIntegMin) { // // Save the I gain factor. // psState->lIGain = lIGain; // // Save the integrator limits. // psState->lIntegMax = lIntegMax; psState->lIntegMin = lIntegMin; // // Limit the integrator to the new limits if necessary. // if(psState->lIntegrator > lIntegMax) { psState->lIntegrator = lIntegMax; } else if(psState->lIntegrator < lIntegMin) { psState->lIntegrator = lIntegMin; } }
//***************************************************************************** // // This function will change the I gain factor used by the PID algorithm. // //*****************************************************************************
This function will change the I gain factor used by the PID algorithm.
[ "This", "function", "will", "change", "the", "I", "gain", "factor", "used", "by", "the", "PID", "algorithm", "." ]
void PIDGainISet(tPIDState *psState, long lIGain, long lIntegMax, long lIntegMin) { psState->lIGain = lIGain; psState->lIntegMax = lIntegMax; psState->lIntegMin = lIntegMin; if(psState->lIntegrator > lIntegMax) { psState->lIntegrator = lIntegMax; } else if(psState->lIntegrator < lIntegMin) { psState->lIntegrator = lIntegMin; } }
[ "void", "PIDGainISet", "(", "tPIDState", "*", "psState", ",", "long", "lIGain", ",", "long", "lIntegMax", ",", "long", "lIntegMin", ")", "{", "psState", "->", "lIGain", "=", "lIGain", ";", "psState", "->", "lIntegMax", "=", "lIntegMax", ";", "psState", "->", "lIntegMin", "=", "lIntegMin", ";", "if", "(", "psState", "->", "lIntegrator", ">", "lIntegMax", ")", "{", "psState", "->", "lIntegrator", "=", "lIntegMax", ";", "}", "else", "if", "(", "psState", "->", "lIntegrator", "<", "lIntegMin", ")", "{", "psState", "->", "lIntegrator", "=", "lIntegMin", ";", "}", "}" ]
This function will change the I gain factor used by the PID algorithm.
[ "This", "function", "will", "change", "the", "I", "gain", "factor", "used", "by", "the", "PID", "algorithm", "." ]
[ "//\r", "// Save the I gain factor.\r", "//\r", "//\r", "// Save the integrator limits.\r", "//\r", "//\r", "// Limit the integrator to the new limits if necessary.\r", "//\r" ]
[ { "param": "psState", "type": "tPIDState" }, { "param": "lIGain", "type": "long" }, { "param": "lIntegMax", "type": "long" }, { "param": "lIntegMin", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psState", "type": "tPIDState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lIGain", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lIntegMax", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lIntegMin", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2770617e43d2bb8285081dfc5cf7838a45261f75
junyanl-code/Luminary-Micro-Library
boards/ek-evalbot/qs-autonomous/pid.c
[ "BSD-3-Clause" ]
C
PIDGainDSet
void
void PIDGainDSet(tPIDState *psState, long lDGain) { // // Save the D gain factor. // psState->lDGain = lDGain; }
//***************************************************************************** // // This function will change the D gain factor used by the PID algorithm. // //*****************************************************************************
This function will change the D gain factor used by the PID algorithm.
[ "This", "function", "will", "change", "the", "D", "gain", "factor", "used", "by", "the", "PID", "algorithm", "." ]
void PIDGainDSet(tPIDState *psState, long lDGain) { psState->lDGain = lDGain; }
[ "void", "PIDGainDSet", "(", "tPIDState", "*", "psState", ",", "long", "lDGain", ")", "{", "psState", "->", "lDGain", "=", "lDGain", ";", "}" ]
This function will change the D gain factor used by the PID algorithm.
[ "This", "function", "will", "change", "the", "D", "gain", "factor", "used", "by", "the", "PID", "algorithm", "." ]
[ "//\r", "// Save the D gain factor.\r", "//\r" ]
[ { "param": "psState", "type": "tPIDState" }, { "param": "lDGain", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psState", "type": "tPIDState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lDGain", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2770617e43d2bb8285081dfc5cf7838a45261f75
junyanl-code/Luminary-Micro-Library
boards/ek-evalbot/qs-autonomous/pid.c
[ "BSD-3-Clause" ]
C
PIDReset
void
void PIDReset(tPIDState *psState) { // // Reset the integrator and previous error. // psState->lIntegrator = 0; psState->lPrevError = 0; }
//***************************************************************************** // // This function resets the internal state of the PID controller, preparing it // to start operating on a new stream of input values. // //*****************************************************************************
This function resets the internal state of the PID controller, preparing it to start operating on a new stream of input values.
[ "This", "function", "resets", "the", "internal", "state", "of", "the", "PID", "controller", "preparing", "it", "to", "start", "operating", "on", "a", "new", "stream", "of", "input", "values", "." ]
void PIDReset(tPIDState *psState) { psState->lIntegrator = 0; psState->lPrevError = 0; }
[ "void", "PIDReset", "(", "tPIDState", "*", "psState", ")", "{", "psState", "->", "lIntegrator", "=", "0", ";", "psState", "->", "lPrevError", "=", "0", ";", "}" ]
This function resets the internal state of the PID controller, preparing it to start operating on a new stream of input values.
[ "This", "function", "resets", "the", "internal", "state", "of", "the", "PID", "controller", "preparing", "it", "to", "start", "operating", "on", "a", "new", "stream", "of", "input", "values", "." ]
[ "//\r", "// Reset the integrator and previous error.\r", "//\r" ]
[ { "param": "psState", "type": "tPIDState" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psState", "type": "tPIDState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2770617e43d2bb8285081dfc5cf7838a45261f75
junyanl-code/Luminary-Micro-Library
boards/ek-evalbot/qs-autonomous/pid.c
[ "BSD-3-Clause" ]
C
PIDUpdate
null
long PIDUpdate(tPIDState *psState, long lError) { long long llOutput; long lOutput; // // Update the error integrator. // if((psState->lIntegrator & 0x80000000) == (lError & 0x80000000)) { // // Add the error to the integrator. // psState->lIntegrator += lError; // // Since the sign of the integrator and error matched before the above // addition, if the signs no longer match it is because the integrator // rolled over. In this case, saturate appropriately. // if((lError < 0) && (psState->lIntegrator > 0)) { psState->lIntegrator = psState->lIntegMin; } if((lError > 0) && (psState->lIntegrator < 0)) { psState->lIntegrator = psState->lIntegMax; } } else { // // Add the error to the integrator. // psState->lIntegrator += lError; } // // Saturate the integrator if necessary. // if(psState->lIntegrator > psState->lIntegMax) { psState->lIntegrator = psState->lIntegMax; } if(psState->lIntegrator < psState->lIntegMin) { psState->lIntegrator = psState->lIntegMin; } // // Compute the new control value. // llOutput = (((long long)psState->lPGain * (long long)lError) + ((long long)psState->lIGain * (long long)psState->lIntegrator) + ((long long)psState->lDGain * (long long)(lError - psState->lPrevError))); // // Clip the new control value as appropriate. // if(llOutput > (long long)0x7fffffffffff) { lOutput = 0x7fffffff; } else if(llOutput < (long long)0xffff800000000000) { lOutput = 0x80000000; } else { lOutput = (llOutput >> 16) & 0xffffffff; } // // Save the current error for computing the derivative on the next // iteration. // psState->lPrevError = lError; // // Return the control value. // return(lOutput); }
//***************************************************************************** // // This function will execute another iteration of the PID algorithm. In // order to get reliable results from this, the sampled values passed in must // be captured at fixed intervals (as close as possible). Deviations from a // fixed capture interval will result in errors in the control output. // //*****************************************************************************
This function will execute another iteration of the PID algorithm. In order to get reliable results from this, the sampled values passed in must be captured at fixed intervals (as close as possible). Deviations from a fixed capture interval will result in errors in the control output.
[ "This", "function", "will", "execute", "another", "iteration", "of", "the", "PID", "algorithm", ".", "In", "order", "to", "get", "reliable", "results", "from", "this", "the", "sampled", "values", "passed", "in", "must", "be", "captured", "at", "fixed", "intervals", "(", "as", "close", "as", "possible", ")", ".", "Deviations", "from", "a", "fixed", "capture", "interval", "will", "result", "in", "errors", "in", "the", "control", "output", "." ]
long PIDUpdate(tPIDState *psState, long lError) { long long llOutput; long lOutput; if((psState->lIntegrator & 0x80000000) == (lError & 0x80000000)) { psState->lIntegrator += lError; if((lError < 0) && (psState->lIntegrator > 0)) { psState->lIntegrator = psState->lIntegMin; } if((lError > 0) && (psState->lIntegrator < 0)) { psState->lIntegrator = psState->lIntegMax; } } else { psState->lIntegrator += lError; } if(psState->lIntegrator > psState->lIntegMax) { psState->lIntegrator = psState->lIntegMax; } if(psState->lIntegrator < psState->lIntegMin) { psState->lIntegrator = psState->lIntegMin; } llOutput = (((long long)psState->lPGain * (long long)lError) + ((long long)psState->lIGain * (long long)psState->lIntegrator) + ((long long)psState->lDGain * (long long)(lError - psState->lPrevError))); if(llOutput > (long long)0x7fffffffffff) { lOutput = 0x7fffffff; } else if(llOutput < (long long)0xffff800000000000) { lOutput = 0x80000000; } else { lOutput = (llOutput >> 16) & 0xffffffff; } psState->lPrevError = lError; return(lOutput); }
[ "long", "PIDUpdate", "(", "tPIDState", "*", "psState", ",", "long", "lError", ")", "{", "long", "long", "llOutput", ";", "long", "lOutput", ";", "if", "(", "(", "psState", "->", "lIntegrator", "&", "0x80000000", ")", "==", "(", "lError", "&", "0x80000000", ")", ")", "{", "psState", "->", "lIntegrator", "+=", "lError", ";", "if", "(", "(", "lError", "<", "0", ")", "&&", "(", "psState", "->", "lIntegrator", ">", "0", ")", ")", "{", "psState", "->", "lIntegrator", "=", "psState", "->", "lIntegMin", ";", "}", "if", "(", "(", "lError", ">", "0", ")", "&&", "(", "psState", "->", "lIntegrator", "<", "0", ")", ")", "{", "psState", "->", "lIntegrator", "=", "psState", "->", "lIntegMax", ";", "}", "}", "else", "{", "psState", "->", "lIntegrator", "+=", "lError", ";", "}", "if", "(", "psState", "->", "lIntegrator", ">", "psState", "->", "lIntegMax", ")", "{", "psState", "->", "lIntegrator", "=", "psState", "->", "lIntegMax", ";", "}", "if", "(", "psState", "->", "lIntegrator", "<", "psState", "->", "lIntegMin", ")", "{", "psState", "->", "lIntegrator", "=", "psState", "->", "lIntegMin", ";", "}", "llOutput", "=", "(", "(", "(", "long", "long", ")", "psState", "->", "lPGain", "*", "(", "long", "long", ")", "lError", ")", "+", "(", "(", "long", "long", ")", "psState", "->", "lIGain", "*", "(", "long", "long", ")", "psState", "->", "lIntegrator", ")", "+", "(", "(", "long", "long", ")", "psState", "->", "lDGain", "*", "(", "long", "long", ")", "(", "lError", "-", "psState", "->", "lPrevError", ")", ")", ")", ";", "if", "(", "llOutput", ">", "(", "long", "long", ")", "0x7fffffffffff", ")", "{", "lOutput", "=", "0x7fffffff", ";", "}", "else", "if", "(", "llOutput", "<", "(", "long", "long", ")", "0xffff800000000000", ")", "{", "lOutput", "=", "0x80000000", ";", "}", "else", "{", "lOutput", "=", "(", "llOutput", ">>", "16", ")", "&", "0xffffffff", ";", "}", "psState", "->", "lPrevError", "=", "lError", ";", "return", "(", "lOutput", ")", ";", "}" ]
This function will execute another iteration of the PID algorithm.
[ "This", "function", "will", "execute", "another", "iteration", "of", "the", "PID", "algorithm", "." ]
[ "//\r", "// Update the error integrator.\r", "//\r", "//\r", "// Add the error to the integrator.\r", "//\r", "//\r", "// Since the sign of the integrator and error matched before the above\r", "// addition, if the signs no longer match it is because the integrator\r", "// rolled over. In this case, saturate appropriately.\r", "//\r", "//\r", "// Add the error to the integrator.\r", "//\r", "//\r", "// Saturate the integrator if necessary.\r", "//\r", "//\r", "// Compute the new control value.\r", "//\r", "//\r", "// Clip the new control value as appropriate.\r", "//\r", "//\r", "// Save the current error for computing the derivative on the next\r", "// iteration.\r", "//\r", "//\r", "// Return the control value.\r", "//\r" ]
[ { "param": "psState", "type": "tPIDState" }, { "param": "lError", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "psState", "type": "tPIDState", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lError", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7fc553c033d89dfc814f3bbb6d2dffe823743e2a
junyanl-code/Luminary-Micro-Library
boards/rdk-bdc/bdc-ui/about.c
[ "BSD-3-Clause" ]
C
DisplayAbout
nan
unsigned long DisplayAbout(void) { unsigned long ulIdx, ulPanel; // // Add the "About" panel widgets to the widget list. // for(ulIdx = 0; ulIdx < NUM_WIDGETS; ulIdx++) { WidgetAdd(WIDGET_ROOT, (tWidget *)(g_psAboutWidgets + ulIdx)); } // // Loop forever. This loop will be explicitly exited when the proper // condition is detected. // while(1) { // // Update the display. // DisplayFlush(); // // Wait until the select button is pressed or a serial download begins. // while((HWREGBITW(&g_ulFlags, FLAG_SELECT_PRESSED) == 0) && (HWREGBITW(&g_ulFlags, FLAG_SERIAL_BOOTLOADER) == 0)) { } // // Clear the press flags for the up, down, left, and right buttons. // HWREGBITW(&g_ulFlags, FLAG_UP_PRESSED) = 0; HWREGBITW(&g_ulFlags, FLAG_DOWN_PRESSED) = 0; HWREGBITW(&g_ulFlags, FLAG_LEFT_PRESSED) = 0; HWREGBITW(&g_ulFlags, FLAG_RIGHT_PRESSED) = 0; // // See if a serial download has begun. // if(HWREGBITW(&g_ulFlags, FLAG_SERIAL_BOOTLOADER) == 1) { // // Remove the "About" panel widgets. // for(ulIdx = 0; ulIdx < NUM_WIDGETS; ulIdx++) { WidgetRemove((tWidget *)(g_psAboutWidgets + ulIdx)); } // // Return the ID of the update panel. // return(PANEL_UPDATE); } // // See if the select button was pressed. // if(HWREGBITW(&g_ulFlags, FLAG_SELECT_PRESSED) == 1) { // // Clear the press flag for the select button. // HWREGBITW(&g_ulFlags, FLAG_SELECT_PRESSED) = 0; // // Display the menu. // ulPanel = DisplayMenu(PANEL_ABOUT); // // See if another panel was selected. // if(ulPanel != PANEL_ABOUT) { // // Remove the "About" panel widgets. // for(ulIdx = 0; ulIdx < NUM_WIDGETS; ulIdx++) { WidgetRemove((tWidget *)(g_psAboutWidgets + ulIdx)); } // // Return the ID of the newly selected panel. // return(ulPanel); } } } }
//***************************************************************************** // // Displays the "About" panel. The returned value is the ID of the panel to be // displayed instead of the "About" panel. // //*****************************************************************************
Displays the "About" panel. The returned value is the ID of the panel to be displayed instead of the "About" panel.
[ "Displays", "the", "\"", "About", "\"", "panel", ".", "The", "returned", "value", "is", "the", "ID", "of", "the", "panel", "to", "be", "displayed", "instead", "of", "the", "\"", "About", "\"", "panel", "." ]
unsigned long DisplayAbout(void) { unsigned long ulIdx, ulPanel; for(ulIdx = 0; ulIdx < NUM_WIDGETS; ulIdx++) { WidgetAdd(WIDGET_ROOT, (tWidget *)(g_psAboutWidgets + ulIdx)); } while(1) { DisplayFlush(); while((HWREGBITW(&g_ulFlags, FLAG_SELECT_PRESSED) == 0) && (HWREGBITW(&g_ulFlags, FLAG_SERIAL_BOOTLOADER) == 0)) { } HWREGBITW(&g_ulFlags, FLAG_UP_PRESSED) = 0; HWREGBITW(&g_ulFlags, FLAG_DOWN_PRESSED) = 0; HWREGBITW(&g_ulFlags, FLAG_LEFT_PRESSED) = 0; HWREGBITW(&g_ulFlags, FLAG_RIGHT_PRESSED) = 0; if(HWREGBITW(&g_ulFlags, FLAG_SERIAL_BOOTLOADER) == 1) { for(ulIdx = 0; ulIdx < NUM_WIDGETS; ulIdx++) { WidgetRemove((tWidget *)(g_psAboutWidgets + ulIdx)); } return(PANEL_UPDATE); } if(HWREGBITW(&g_ulFlags, FLAG_SELECT_PRESSED) == 1) { HWREGBITW(&g_ulFlags, FLAG_SELECT_PRESSED) = 0; ulPanel = DisplayMenu(PANEL_ABOUT); if(ulPanel != PANEL_ABOUT) { for(ulIdx = 0; ulIdx < NUM_WIDGETS; ulIdx++) { WidgetRemove((tWidget *)(g_psAboutWidgets + ulIdx)); } return(ulPanel); } } } }
[ "unsigned", "long", "DisplayAbout", "(", "void", ")", "{", "unsigned", "long", "ulIdx", ",", "ulPanel", ";", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "NUM_WIDGETS", ";", "ulIdx", "++", ")", "{", "WidgetAdd", "(", "WIDGET_ROOT", ",", "(", "tWidget", "*", ")", "(", "g_psAboutWidgets", "+", "ulIdx", ")", ")", ";", "}", "while", "(", "1", ")", "{", "DisplayFlush", "(", ")", ";", "while", "(", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_SELECT_PRESSED", ")", "==", "0", ")", "&&", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_SERIAL_BOOTLOADER", ")", "==", "0", ")", ")", "{", "}", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_UP_PRESSED", ")", "=", "0", ";", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_DOWN_PRESSED", ")", "=", "0", ";", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_LEFT_PRESSED", ")", "=", "0", ";", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_RIGHT_PRESSED", ")", "=", "0", ";", "if", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_SERIAL_BOOTLOADER", ")", "==", "1", ")", "{", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "NUM_WIDGETS", ";", "ulIdx", "++", ")", "{", "WidgetRemove", "(", "(", "tWidget", "*", ")", "(", "g_psAboutWidgets", "+", "ulIdx", ")", ")", ";", "}", "return", "(", "PANEL_UPDATE", ")", ";", "}", "if", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_SELECT_PRESSED", ")", "==", "1", ")", "{", "HWREGBITW", "(", "&", "g_ulFlags", ",", "FLAG_SELECT_PRESSED", ")", "=", "0", ";", "ulPanel", "=", "DisplayMenu", "(", "PANEL_ABOUT", ")", ";", "if", "(", "ulPanel", "!=", "PANEL_ABOUT", ")", "{", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "NUM_WIDGETS", ";", "ulIdx", "++", ")", "{", "WidgetRemove", "(", "(", "tWidget", "*", ")", "(", "g_psAboutWidgets", "+", "ulIdx", ")", ")", ";", "}", "return", "(", "ulPanel", ")", ";", "}", "}", "}", "}" ]
Displays the "About" panel.
[ "Displays", "the", "\"", "About", "\"", "panel", "." ]
[ "//\r", "// Add the \"About\" panel widgets to the widget list.\r", "//\r", "//\r", "// Loop forever. This loop will be explicitly exited when the proper\r", "// condition is detected.\r", "//\r", "//\r", "// Update the display.\r", "//\r", "//\r", "// Wait until the select button is pressed or a serial download begins.\r", "//\r", "//\r", "// Clear the press flags for the up, down, left, and right buttons.\r", "//\r", "//\r", "// See if a serial download has begun.\r", "//\r", "//\r", "// Remove the \"About\" panel widgets.\r", "//\r", "//\r", "// Return the ID of the update panel.\r", "//\r", "//\r", "// See if the select button was pressed.\r", "//\r", "//\r", "// Clear the press flag for the select button.\r", "//\r", "//\r", "// Display the menu.\r", "//\r", "//\r", "// See if another panel was selected.\r", "//\r", "//\r", "// Remove the \"About\" panel widgets.\r", "//\r", "//\r", "// Return the ID of the newly selected panel.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
initialize_screen
void
void initialize_screen(void) { // // Set the dimensions of the screen. // screen_cols = 79; screen_rows = 25; // // Set the current column to the beginning of the line. // g_lCurColumn = 1; // // Discard any saved cursor column. // g_lCursorSaved = 0; // // Characters should be displayed. // g_lDisplay = 1; // // Set the type of ZIP interpreter. // h_interpreter = INTERP_GENERIC; }
//***************************************************************************** // // This function initializes the screen. // //*****************************************************************************
This function initializes the screen.
[ "This", "function", "initializes", "the", "screen", "." ]
void initialize_screen(void) { screen_cols = 79; screen_rows = 25; g_lCurColumn = 1; g_lCursorSaved = 0; g_lDisplay = 1; h_interpreter = INTERP_GENERIC; }
[ "void", "initialize_screen", "(", "void", ")", "{", "screen_cols", "=", "79", ";", "screen_rows", "=", "25", ";", "g_lCurColumn", "=", "1", ";", "g_lCursorSaved", "=", "0", ";", "g_lDisplay", "=", "1", ";", "h_interpreter", "=", "INTERP_GENERIC", ";", "}" ]
This function initializes the screen.
[ "This", "function", "initializes", "the", "screen", "." ]
[ "//\r", "// Set the dimensions of the screen.\r", "//\r", "//\r", "// Set the current column to the beginning of the line.\r", "//\r", "//\r", "// Discard any saved cursor column.\r", "//\r", "//\r", "// Characters should be displayed.\r", "//\r", "//\r", "// Set the type of ZIP interpreter.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
restart_screen
void
void restart_screen(void) { // // Set the current column to the beginning of the line. // g_lCurColumn = 1; // // Discard any saved cursor column. // g_lCursorSaved = 0; // // Characters should be displayed. // g_lDisplay = 1; // // The the ZIP configuration flags based on the type of the game. // if(h_type < V4) { set_byte(H_CONFIG, get_byte(H_CONFIG) | CONFIG_WINDOWS); } else { set_byte(H_CONFIG, get_byte(H_CONFIG) | CONFIG_EMPHASIS | CONFIG_WINDOWS); } // // Set the ZIP flags. // set_word(H_FLAGS, (get_word(H_FLAGS) & ~GRAPHICS_FLAG)); }
//***************************************************************************** // // This function restarts the screen. // //*****************************************************************************
This function restarts the screen.
[ "This", "function", "restarts", "the", "screen", "." ]
void restart_screen(void) { g_lCurColumn = 1; g_lCursorSaved = 0; g_lDisplay = 1; if(h_type < V4) { set_byte(H_CONFIG, get_byte(H_CONFIG) | CONFIG_WINDOWS); } else { set_byte(H_CONFIG, get_byte(H_CONFIG) | CONFIG_EMPHASIS | CONFIG_WINDOWS); } set_word(H_FLAGS, (get_word(H_FLAGS) & ~GRAPHICS_FLAG)); }
[ "void", "restart_screen", "(", "void", ")", "{", "g_lCurColumn", "=", "1", ";", "g_lCursorSaved", "=", "0", ";", "g_lDisplay", "=", "1", ";", "if", "(", "h_type", "<", "V4", ")", "{", "set_byte", "(", "H_CONFIG", ",", "get_byte", "(", "H_CONFIG", ")", "|", "CONFIG_WINDOWS", ")", ";", "}", "else", "{", "set_byte", "(", "H_CONFIG", ",", "get_byte", "(", "H_CONFIG", ")", "|", "CONFIG_EMPHASIS", "|", "CONFIG_WINDOWS", ")", ";", "}", "set_word", "(", "H_FLAGS", ",", "(", "get_word", "(", "H_FLAGS", ")", "&", "~", "GRAPHICS_FLAG", ")", ")", ";", "}" ]
This function restarts the screen.
[ "This", "function", "restarts", "the", "screen", "." ]
[ "//\r", "// Set the current column to the beginning of the line.\r", "//\r", "//\r", "// Discard any saved cursor column.\r", "//\r", "//\r", "// Characters should be displayed.\r", "//\r", "//\r", "// The the ZIP configuration flags based on the type of the game.\r", "//\r", "//\r", "// Set the ZIP flags.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
reset_screen
void
void reset_screen(void) { // // Select the text window. // select_text_window(); // // Return the character rendering to normal. // set_attribute(NORMAL); }
//***************************************************************************** // // This function resets the screen. // //*****************************************************************************
This function resets the screen.
[ "This", "function", "resets", "the", "screen", "." ]
void reset_screen(void) { select_text_window(); set_attribute(NORMAL); }
[ "void", "reset_screen", "(", "void", ")", "{", "select_text_window", "(", ")", ";", "set_attribute", "(", "NORMAL", ")", ";", "}" ]
This function resets the screen.
[ "This", "function", "resets", "the", "screen", "." ]
[ "//\r", "// Select the text window.\r", "//\r", "//\r", "// Return the character rendering to normal.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
clear_screen
void
void clear_screen(void) { // // Send the ANSI sequence to clear the screen. // display_char('\033'); display_char('['); display_char('2'); display_char('J'); // // Set the current column to the beginning of the line. // g_lCurColumn = 1; }
//***************************************************************************** // // This function clears the screen. // //*****************************************************************************
This function clears the screen.
[ "This", "function", "clears", "the", "screen", "." ]
void clear_screen(void) { display_char('\033'); display_char('['); display_char('2'); display_char('J'); g_lCurColumn = 1; }
[ "void", "clear_screen", "(", "void", ")", "{", "display_char", "(", "'", "\\033", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "g_lCurColumn", "=", "1", ";", "}" ]
This function clears the screen.
[ "This", "function", "clears", "the", "screen", "." ]
[ "//\r", "// Send the ANSI sequence to clear the screen.\r", "//\r", "//\r", "// Set the current column to the beginning of the line.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
select_status_window
void
void select_status_window(void) { // // Stop displaying characters since the status window is not supported. // g_lDisplay = 0; // // Save the cursor position. // save_cursor_position(); }
//***************************************************************************** // // This function selects the status window. // //*****************************************************************************
This function selects the status window.
[ "This", "function", "selects", "the", "status", "window", "." ]
void select_status_window(void) { g_lDisplay = 0; save_cursor_position(); }
[ "void", "select_status_window", "(", "void", ")", "{", "g_lDisplay", "=", "0", ";", "save_cursor_position", "(", ")", ";", "}" ]
This function selects the status window.
[ "This", "function", "selects", "the", "status", "window", "." ]
[ "//\r", "// Stop displaying characters since the status window is not supported.\r", "//\r", "//\r", "// Save the cursor position.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
select_text_window
void
void select_text_window(void) { // // Start displaying characters. // g_lDisplay = 1; // // Restore the cursor position. // restore_cursor_position(); }
//***************************************************************************** // // This function selects the text window. // //*****************************************************************************
This function selects the text window.
[ "This", "function", "selects", "the", "text", "window", "." ]
void select_text_window(void) { g_lDisplay = 1; restore_cursor_position(); }
[ "void", "select_text_window", "(", "void", ")", "{", "g_lDisplay", "=", "1", ";", "restore_cursor_position", "(", ")", ";", "}" ]
This function selects the text window.
[ "This", "function", "selects", "the", "text", "window", "." ]
[ "//\r", "// Start displaying characters.\r", "//\r", "//\r", "// Restore the cursor position.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
clear_line
void
void clear_line(void) { long lColumn; // // Save the current column. // lColumn = g_lCurColumn; // // Send the ANSI sequence to clear the current line. // display_char('\033'); display_char('['); display_char('2'); display_char('K'); // // Restore the current column. // g_lCurColumn = lColumn; }
//***************************************************************************** // // This function clears the current line. // //*****************************************************************************
This function clears the current line.
[ "This", "function", "clears", "the", "current", "line", "." ]
void clear_line(void) { long lColumn; lColumn = g_lCurColumn; display_char('\033'); display_char('['); display_char('2'); display_char('K'); g_lCurColumn = lColumn; }
[ "void", "clear_line", "(", "void", ")", "{", "long", "lColumn", ";", "lColumn", "=", "g_lCurColumn", ";", "display_char", "(", "'", "\\033", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "g_lCurColumn", "=", "lColumn", ";", "}" ]
This function clears the current line.
[ "This", "function", "clears", "the", "current", "line", "." ]
[ "//\r", "// Save the current column.\r", "//\r", "//\r", "// Send the ANSI sequence to clear the current line.\r", "//\r", "//\r", "// Restore the current column.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
clear_text_window
void
void clear_text_window(void) { // // Clear the entire screen. // clear_screen(); }
//***************************************************************************** // // This function clears the text window. // //*****************************************************************************
This function clears the text window.
[ "This", "function", "clears", "the", "text", "window", "." ]
void clear_text_window(void) { clear_screen(); }
[ "void", "clear_text_window", "(", "void", ")", "{", "clear_screen", "(", ")", ";", "}" ]
This function clears the text window.
[ "This", "function", "clears", "the", "text", "window", "." ]
[ "//\r", "// Clear the entire screen.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
move_cursor
void
void move_cursor(int row, int col) { long lDiff; // // See if the text should be displayed, which means that the text window is // selected. // if(g_lDisplay) { // // See if the cursor should be moved to the left. // if(col < g_lCurColumn) { // // Determine how many columns to move the cursor to the left. // lDiff = g_lCurColumn - col; // // Send the ANSI sequence to move the cursor to the left. // display_char('\033'); display_char('['); if(lDiff > 9) { display_char('0' + (lDiff / 10)); } display_char('0' + (lDiff % 10)); display_char('D'); } // // See if the cursor should be moved to the right. // else if(col > g_lCurColumn) { // // Determine how many columns to move the cursor to the right. // lDiff = col - g_lCurColumn; // // Send the ANSI sequence to move the cursor to the right. // display_char('\033'); display_char('['); if(lDiff > 9) { display_char('0' + (lDiff / 10)); } display_char('0' + (lDiff % 10)); display_char('C'); } // // Save the new cursor column. // g_lCurColumn = col; } }
//***************************************************************************** // // This function moves the cursor to the specified position. // //*****************************************************************************
This function moves the cursor to the specified position.
[ "This", "function", "moves", "the", "cursor", "to", "the", "specified", "position", "." ]
void move_cursor(int row, int col) { long lDiff; if(g_lDisplay) { if(col < g_lCurColumn) { lDiff = g_lCurColumn - col; display_char('\033'); display_char('['); if(lDiff > 9) { display_char('0' + (lDiff / 10)); } display_char('0' + (lDiff % 10)); display_char('D'); } else if(col > g_lCurColumn) { lDiff = col - g_lCurColumn; display_char('\033'); display_char('['); if(lDiff > 9) { display_char('0' + (lDiff / 10)); } display_char('0' + (lDiff % 10)); display_char('C'); } g_lCurColumn = col; } }
[ "void", "move_cursor", "(", "int", "row", ",", "int", "col", ")", "{", "long", "lDiff", ";", "if", "(", "g_lDisplay", ")", "{", "if", "(", "col", "<", "g_lCurColumn", ")", "{", "lDiff", "=", "g_lCurColumn", "-", "col", ";", "display_char", "(", "'", "\\033", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "if", "(", "lDiff", ">", "9", ")", "{", "display_char", "(", "'", "'", "+", "(", "lDiff", "/", "10", ")", ")", ";", "}", "display_char", "(", "'", "'", "+", "(", "lDiff", "%", "10", ")", ")", ";", "display_char", "(", "'", "'", ")", ";", "}", "else", "if", "(", "col", ">", "g_lCurColumn", ")", "{", "lDiff", "=", "col", "-", "g_lCurColumn", ";", "display_char", "(", "'", "\\033", "'", ")", ";", "display_char", "(", "'", "'", ")", ";", "if", "(", "lDiff", ">", "9", ")", "{", "display_char", "(", "'", "'", "+", "(", "lDiff", "/", "10", ")", ")", ";", "}", "display_char", "(", "'", "'", "+", "(", "lDiff", "%", "10", ")", ")", ";", "display_char", "(", "'", "'", ")", ";", "}", "g_lCurColumn", "=", "col", ";", "}", "}" ]
This function moves the cursor to the specified position.
[ "This", "function", "moves", "the", "cursor", "to", "the", "specified", "position", "." ]
[ "//\r", "// See if the text should be displayed, which means that the text window is\r", "// selected.\r", "//\r", "//\r", "// See if the cursor should be moved to the left.\r", "//\r", "//\r", "// Determine how many columns to move the cursor to the left.\r", "//\r", "//\r", "// Send the ANSI sequence to move the cursor to the left.\r", "//\r", "//\r", "// See if the cursor should be moved to the right.\r", "//\r", "//\r", "// Determine how many columns to move the cursor to the right.\r", "//\r", "//\r", "// Send the ANSI sequence to move the cursor to the right.\r", "//\r", "//\r", "// Save the new cursor column.\r", "//\r" ]
[ { "param": "row", "type": "int" }, { "param": "col", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "row", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "col", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
save_cursor_position
void
void save_cursor_position(void) { // // Only save the cursor position if it has not already been saved. // if(!g_lCursorSaved) { // // Save the current cursor position. // g_lSavedColumn = g_lCurColumn; // // Indicate that the cursor position is saved. // g_lCursorSaved = 1; } }
//***************************************************************************** // // This function saves the cursor position. // //*****************************************************************************
This function saves the cursor position.
[ "This", "function", "saves", "the", "cursor", "position", "." ]
void save_cursor_position(void) { if(!g_lCursorSaved) { g_lSavedColumn = g_lCurColumn; g_lCursorSaved = 1; } }
[ "void", "save_cursor_position", "(", "void", ")", "{", "if", "(", "!", "g_lCursorSaved", ")", "{", "g_lSavedColumn", "=", "g_lCurColumn", ";", "g_lCursorSaved", "=", "1", ";", "}", "}" ]
This function saves the cursor position.
[ "This", "function", "saves", "the", "cursor", "position", "." ]
[ "//\r", "// Only save the cursor position if it has not already been saved.\r", "//\r", "//\r", "// Save the current cursor position.\r", "//\r", "//\r", "// Indicate that the cursor position is saved.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
restore_cursor_position
void
void restore_cursor_position(void) { // // See if there is a saved cursor position. // if(g_lCursorSaved) { // // Move the cursor to the saved cursor position. // move_cursor(1, g_lSavedColumn); // // Indicate that the cursor postiion is no longer saved. // g_lCursorSaved = 0; } }
//***************************************************************************** // // This function restores the saved cursor position. // //*****************************************************************************
This function restores the saved cursor position.
[ "This", "function", "restores", "the", "saved", "cursor", "position", "." ]
void restore_cursor_position(void) { if(g_lCursorSaved) { move_cursor(1, g_lSavedColumn); g_lCursorSaved = 0; } }
[ "void", "restore_cursor_position", "(", "void", ")", "{", "if", "(", "g_lCursorSaved", ")", "{", "move_cursor", "(", "1", ",", "g_lSavedColumn", ")", ";", "g_lCursorSaved", "=", "0", ";", "}", "}" ]
This function restores the saved cursor position.
[ "This", "function", "restores", "the", "saved", "cursor", "position", "." ]
[ "//\r", "// See if there is a saved cursor position.\r", "//\r", "//\r", "// Move the cursor to the saved cursor position.\r", "//\r", "//\r", "// Indicate that the cursor postiion is no longer saved.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
display_char
void
void display_char(int c) { // // See if the text should be displayed, which means that the text window is // selected. // if(g_lDisplay) { // // See if USB is being used to play the game. // if(g_ulGameIF == GAME_IF_USB) { // // If this is a newline, send a carriage return first. // if(c == '\n') { USBIFWrite('\r'); } // // Send this character. // USBIFWrite(c); } // // See if Ethernet is being used to play the game. // else if(g_ulGameIF == GAME_IF_ENET) { // // If this is a newline, send a carriage return first. // if(c == '\n') { EnetIFWrite('\r'); } // // Send this character. // EnetIFWrite(c); } // // Increment the current cursor column, not allowing it to exceed the // right edge of the screen. // if(++g_lCurColumn > screen_cols) { g_lCurColumn = screen_cols; } } }
//***************************************************************************** // // This function prints a character on the screen. // //*****************************************************************************
This function prints a character on the screen.
[ "This", "function", "prints", "a", "character", "on", "the", "screen", "." ]
void display_char(int c) { if(g_lDisplay) { if(g_ulGameIF == GAME_IF_USB) { if(c == '\n') { USBIFWrite('\r'); } USBIFWrite(c); } else if(g_ulGameIF == GAME_IF_ENET) { if(c == '\n') { EnetIFWrite('\r'); } EnetIFWrite(c); } if(++g_lCurColumn > screen_cols) { g_lCurColumn = screen_cols; } } }
[ "void", "display_char", "(", "int", "c", ")", "{", "if", "(", "g_lDisplay", ")", "{", "if", "(", "g_ulGameIF", "==", "GAME_IF_USB", ")", "{", "if", "(", "c", "==", "'", "\\n", "'", ")", "{", "USBIFWrite", "(", "'", "\\r", "'", ")", ";", "}", "USBIFWrite", "(", "c", ")", ";", "}", "else", "if", "(", "g_ulGameIF", "==", "GAME_IF_ENET", ")", "{", "if", "(", "c", "==", "'", "\\n", "'", ")", "{", "EnetIFWrite", "(", "'", "\\r", "'", ")", ";", "}", "EnetIFWrite", "(", "c", ")", ";", "}", "if", "(", "++", "g_lCurColumn", ">", "screen_cols", ")", "{", "g_lCurColumn", "=", "screen_cols", ";", "}", "}", "}" ]
This function prints a character on the screen.
[ "This", "function", "prints", "a", "character", "on", "the", "screen", "." ]
[ "//\r", "// See if the text should be displayed, which means that the text window is\r", "// selected.\r", "//\r", "//\r", "// See if USB is being used to play the game.\r", "//\r", "//\r", "// If this is a newline, send a carriage return first.\r", "//\r", "//\r", "// Send this character.\r", "//\r", "//\r", "// See if Ethernet is being used to play the game.\r", "//\r", "//\r", "// If this is a newline, send a carriage return first.\r", "//\r", "//\r", "// Send this character.\r", "//\r", "//\r", "// Increment the current cursor column, not allowing it to exceed the\r", "// right edge of the screen.\r", "//\r" ]
[ { "param": "c", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "c", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
scroll_line
void
void scroll_line(void) { // // See if the text should be displayed, which means that the text window is // selected. // if(g_lDisplay) { // // Send a newline character. // display_char('\n'); // // Set the current column to the beginning of the line. // g_lCurColumn = 1; } }
//***************************************************************************** // // This function scrolls the screen by one line. // //*****************************************************************************
This function scrolls the screen by one line.
[ "This", "function", "scrolls", "the", "screen", "by", "one", "line", "." ]
void scroll_line(void) { if(g_lDisplay) { display_char('\n'); g_lCurColumn = 1; } }
[ "void", "scroll_line", "(", "void", ")", "{", "if", "(", "g_lDisplay", ")", "{", "display_char", "(", "'", "\\n", "'", ")", ";", "g_lCurColumn", "=", "1", ";", "}", "}" ]
This function scrolls the screen by one line.
[ "This", "function", "scrolls", "the", "screen", "by", "one", "line", "." ]
[ "//\r", "// See if the text should be displayed, which means that the text window is\r", "// selected.\r", "//\r", "//\r", "// Send a newline character.\r", "//\r", "//\r", "// Set the current column to the beginning of the line.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
input_character
int
int input_character(int timeout) { int iChar = 0; // // Loop while the ZIP interpreter has not been halted or is not being // restarted. // while(!halt && !g_ulRestart) { // // See if USB is being used to play the game. // if(g_ulGameIF == GAME_IF_USB) { // // Read a character from USB. // iChar = USBIFRead(); } // // See if Ethernet is being used to play the game. // else if(g_ulGameIF == GAME_IF_ENET) { // // Read a character from Ethernet. // iChar = EnetIFRead(); } // // Otherwise, set the read character to a newline. // else { iChar = '\n'; } // // Stop looping if a character was available. // if(iChar != 0) { break; } } // // Return the character that was read. // return(iChar); }
//***************************************************************************** // // This function reads a character from the player. // //*****************************************************************************
This function reads a character from the player.
[ "This", "function", "reads", "a", "character", "from", "the", "player", "." ]
int input_character(int timeout) { int iChar = 0; while(!halt && !g_ulRestart) { if(g_ulGameIF == GAME_IF_USB) { iChar = USBIFRead(); } else if(g_ulGameIF == GAME_IF_ENET) { iChar = EnetIFRead(); } else { iChar = '\n'; } if(iChar != 0) { break; } } return(iChar); }
[ "int", "input_character", "(", "int", "timeout", ")", "{", "int", "iChar", "=", "0", ";", "while", "(", "!", "halt", "&&", "!", "g_ulRestart", ")", "{", "if", "(", "g_ulGameIF", "==", "GAME_IF_USB", ")", "{", "iChar", "=", "USBIFRead", "(", ")", ";", "}", "else", "if", "(", "g_ulGameIF", "==", "GAME_IF_ENET", ")", "{", "iChar", "=", "EnetIFRead", "(", ")", ";", "}", "else", "{", "iChar", "=", "'", "\\n", "'", ";", "}", "if", "(", "iChar", "!=", "0", ")", "{", "break", ";", "}", "}", "return", "(", "iChar", ")", ";", "}" ]
This function reads a character from the player.
[ "This", "function", "reads", "a", "character", "from", "the", "player", "." ]
[ "//\r", "// Loop while the ZIP interpreter has not been halted or is not being\r", "// restarted.\r", "//\r", "//\r", "// See if USB is being used to play the game.\r", "//\r", "//\r", "// Read a character from USB.\r", "//\r", "//\r", "// See if Ethernet is being used to play the game.\r", "//\r", "//\r", "// Read a character from Ethernet.\r", "//\r", "//\r", "// Otherwise, set the read character to a newline.\r", "//\r", "//\r", "// Stop looping if a character was available.\r", "//\r", "//\r", "// Return the character that was read.\r", "//\r" ]
[ { "param": "timeout", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "timeout", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7f7a77c1c666c8d8b695b93c7a62a16642e14864
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/qs-adventure/io.c
[ "BSD-3-Clause" ]
C
input_line
int
int input_line(int buflen, char *buffer, int timeout, int *read_size) { int iRow, iColumn; long lChar; // // Loop forever. This loop will be explicitly when appropriate. // while(1) { // // Read a character. // lChar = input_character(timeout); // // If the ZIP interpreter has been halted, then return immediately. // if(halt) { return('\n'); } // // See if a backsapce or delete character was read. // if((lChar == '\b') || (lChar == 0x7f)) { // // See if there are any characters in the buffer. // if(*read_size != 0) { // // Decrement the number of characters in the buffer. // (*read_size)--; // // Get the cursor position. // get_cursor_position(&iRow, &iColumn); // // Move the cursor one character to the left. // move_cursor(iRow, --iColumn); // // Display a space to erase the previous character. // display_char(' '); // // Move the cursor back to the left. // move_cursor(iRow, iColumn); } } // // See if this a carriage return or newline character. // else if((lChar == '\n') || (lChar == '\r')) { // // Ignore this character if the previous character was the opposite // of the CR/LF pair. // if(((lChar == '\n') && (g_lPrevChar != '\r')) || ((lChar == '\r') && (g_lPrevChar != '\n'))) { // // Save this character as the previous character. // g_lPrevChar = lChar; // // Scroll the screen. // scroll_line(); // // Return the most recently read character. // return(lChar); } } // // See if there is space in the buffer for another character. // else if(*read_size != (buflen - 1)) { // // Save this character in the buffer. // buffer[(*read_size)++] = lChar; // // Display this character. // display_char(lChar); } // // Save this character as the previous character. // g_lPrevChar = lChar; } }
//***************************************************************************** // // This function reads a line of text from the player. // //*****************************************************************************
This function reads a line of text from the player.
[ "This", "function", "reads", "a", "line", "of", "text", "from", "the", "player", "." ]
int input_line(int buflen, char *buffer, int timeout, int *read_size) { int iRow, iColumn; long lChar; while(1) { lChar = input_character(timeout); if(halt) { return('\n'); } if((lChar == '\b') || (lChar == 0x7f)) { if(*read_size != 0) { (*read_size)--; get_cursor_position(&iRow, &iColumn); move_cursor(iRow, --iColumn); display_char(' '); move_cursor(iRow, iColumn); } } else if((lChar == '\n') || (lChar == '\r')) { if(((lChar == '\n') && (g_lPrevChar != '\r')) || ((lChar == '\r') && (g_lPrevChar != '\n'))) { g_lPrevChar = lChar; scroll_line(); return(lChar); } } else if(*read_size != (buflen - 1)) { buffer[(*read_size)++] = lChar; display_char(lChar); } g_lPrevChar = lChar; } }
[ "int", "input_line", "(", "int", "buflen", ",", "char", "*", "buffer", ",", "int", "timeout", ",", "int", "*", "read_size", ")", "{", "int", "iRow", ",", "iColumn", ";", "long", "lChar", ";", "while", "(", "1", ")", "{", "lChar", "=", "input_character", "(", "timeout", ")", ";", "if", "(", "halt", ")", "{", "return", "(", "'", "\\n", "'", ")", ";", "}", "if", "(", "(", "lChar", "==", "'", "\\b", "'", ")", "||", "(", "lChar", "==", "0x7f", ")", ")", "{", "if", "(", "*", "read_size", "!=", "0", ")", "{", "(", "*", "read_size", ")", "--", ";", "get_cursor_position", "(", "&", "iRow", ",", "&", "iColumn", ")", ";", "move_cursor", "(", "iRow", ",", "--", "iColumn", ")", ";", "display_char", "(", "'", "'", ")", ";", "move_cursor", "(", "iRow", ",", "iColumn", ")", ";", "}", "}", "else", "if", "(", "(", "lChar", "==", "'", "\\n", "'", ")", "||", "(", "lChar", "==", "'", "\\r", "'", ")", ")", "{", "if", "(", "(", "(", "lChar", "==", "'", "\\n", "'", ")", "&&", "(", "g_lPrevChar", "!=", "'", "\\r", "'", ")", ")", "||", "(", "(", "lChar", "==", "'", "\\r", "'", ")", "&&", "(", "g_lPrevChar", "!=", "'", "\\n", "'", ")", ")", ")", "{", "g_lPrevChar", "=", "lChar", ";", "scroll_line", "(", ")", ";", "return", "(", "lChar", ")", ";", "}", "}", "else", "if", "(", "*", "read_size", "!=", "(", "buflen", "-", "1", ")", ")", "{", "buffer", "[", "(", "*", "read_size", ")", "++", "]", "=", "lChar", ";", "display_char", "(", "lChar", ")", ";", "}", "g_lPrevChar", "=", "lChar", ";", "}", "}" ]
This function reads a line of text from the player.
[ "This", "function", "reads", "a", "line", "of", "text", "from", "the", "player", "." ]
[ "//\r", "// Loop forever. This loop will be explicitly when appropriate.\r", "//\r", "//\r", "// Read a character.\r", "//\r", "//\r", "// If the ZIP interpreter has been halted, then return immediately.\r", "//\r", "//\r", "// See if a backsapce or delete character was read.\r", "//\r", "//\r", "// See if there are any characters in the buffer.\r", "//\r", "//\r", "// Decrement the number of characters in the buffer.\r", "//\r", "//\r", "// Get the cursor position.\r", "//\r", "//\r", "// Move the cursor one character to the left.\r", "//\r", "//\r", "// Display a space to erase the previous character.\r", "//\r", "//\r", "// Move the cursor back to the left.\r", "//\r", "//\r", "// See if this a carriage return or newline character.\r", "//\r", "//\r", "// Ignore this character if the previous character was the opposite\r", "// of the CR/LF pair.\r", "//\r", "//\r", "// Save this character as the previous character.\r", "//\r", "//\r", "// Scroll the screen.\r", "//\r", "//\r", "// Return the most recently read character.\r", "//\r", "//\r", "// See if there is space in the buffer for another character.\r", "//\r", "//\r", "// Save this character in the buffer.\r", "//\r", "//\r", "// Display this character.\r", "//\r", "//\r", "// Save this character as the previous character.\r", "//\r" ]
[ { "param": "buflen", "type": "int" }, { "param": "buffer", "type": "char" }, { "param": "timeout", "type": "int" }, { "param": "read_size", "type": "int" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "buflen", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "buffer", "type": "char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "timeout", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "read_size", "type": "int", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e4902aa1393787b9268130074f190cbe2a989ba7
junyanl-code/Luminary-Micro-Library
grlib/context.c
[ "BSD-3-Clause" ]
C
GrLibInit
void
void GrLibInit(const tGrLibDefaults *pDefaults) { ASSERT(pDefaults); // // Remember the pointer to the defaults structure. // g_psGrLibDefaults = pDefaults; }
//***************************************************************************** // //! Initializes graphics library default text rendering values. //! //! \param pDefaults points to a structure containing default values to use. //! //! This function allows an application to set global default values that the //! graphics library will use when initializing any graphics context. These //! values set the source text codepage, the rendering function to use for //! strings and mapping functions used to allow extraction of the correct //! glyphs from fonts. //! //! If this function is not called by an application, the graphics library //! assumes that text strings are ISO8859-1 encoded and that the default string //! renderer is used. //! //! \return None. // //*****************************************************************************
Initializes graphics library default text rendering values. \param pDefaults points to a structure containing default values to use. This function allows an application to set global default values that the graphics library will use when initializing any graphics context. These values set the source text codepage, the rendering function to use for strings and mapping functions used to allow extraction of the correct glyphs from fonts. If this function is not called by an application, the graphics library assumes that text strings are ISO8859-1 encoded and that the default string renderer is used. \return None.
[ "Initializes", "graphics", "library", "default", "text", "rendering", "values", ".", "\\", "param", "pDefaults", "points", "to", "a", "structure", "containing", "default", "values", "to", "use", ".", "This", "function", "allows", "an", "application", "to", "set", "global", "default", "values", "that", "the", "graphics", "library", "will", "use", "when", "initializing", "any", "graphics", "context", ".", "These", "values", "set", "the", "source", "text", "codepage", "the", "rendering", "function", "to", "use", "for", "strings", "and", "mapping", "functions", "used", "to", "allow", "extraction", "of", "the", "correct", "glyphs", "from", "fonts", ".", "If", "this", "function", "is", "not", "called", "by", "an", "application", "the", "graphics", "library", "assumes", "that", "text", "strings", "are", "ISO8859", "-", "1", "encoded", "and", "that", "the", "default", "string", "renderer", "is", "used", ".", "\\", "return", "None", "." ]
void GrLibInit(const tGrLibDefaults *pDefaults) { ASSERT(pDefaults); g_psGrLibDefaults = pDefaults; }
[ "void", "GrLibInit", "(", "const", "tGrLibDefaults", "*", "pDefaults", ")", "{", "ASSERT", "(", "pDefaults", ")", ";", "g_psGrLibDefaults", "=", "pDefaults", ";", "}" ]
Initializes graphics library default text rendering values.
[ "Initializes", "graphics", "library", "default", "text", "rendering", "values", "." ]
[ "//\r", "// Remember the pointer to the defaults structure.\r", "//\r" ]
[ { "param": "pDefaults", "type": "tGrLibDefaults" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pDefaults", "type": "tGrLibDefaults", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e4902aa1393787b9268130074f190cbe2a989ba7
junyanl-code/Luminary-Micro-Library
grlib/context.c
[ "BSD-3-Clause" ]
C
GrContextInit
void
void GrContextInit(tContext *pContext, const tDisplay *pDisplay) { // // Check the arguments. // ASSERT(pContext); ASSERT(pDisplay); // // Set the size of the context. // pContext->lSize = sizeof(tContext); // // Save the pointer to the display. // pContext->pDisplay = pDisplay; // // Initialize the extent of the clipping region to the extents of the // screen. // pContext->sClipRegion.sXMin = 0; pContext->sClipRegion.sYMin = 0; pContext->sClipRegion.sXMax = pDisplay->usWidth - 1; pContext->sClipRegion.sYMax = pDisplay->usHeight - 1; // // Provide a default color and font. // pContext->ulForeground = 0; pContext->ulBackground = 0; pContext->pFont = 0; #ifndef GRLIB_REMOVE_WIDE_FONT_SUPPORT // // Set defaults for all text rendering options. // if(g_psGrLibDefaults) { pContext->pfnStringRenderer = g_psGrLibDefaults->pfnStringRenderer; pContext->pCodePointMapTable = g_psGrLibDefaults->pCodePointMapTable; pContext->usCodepage = g_psGrLibDefaults->usCodepage; pContext->ucNumCodePointMaps = g_psGrLibDefaults->ucNumCodePointMaps; pContext->ucReserved = g_psGrLibDefaults->ucReserved; } else { pContext->pfnStringRenderer = GrDefaultStringRenderer; pContext->pCodePointMapTable = g_psDefaultCodePointMapTable; pContext->usCodepage = CODEPAGE_ISO8859_1; pContext->ucNumCodePointMaps = NUM_DEFAULT_CODEPOINT_MAPS; pContext->ucReserved = 0; } pContext->ucCodePointMap = 0; #endif }
//***************************************************************************** // //! Initializes a drawing context. //! //! \param pContext is a pointer to the drawing context to initialize. //! \param pDisplay is a pointer to the tDisplayInfo structure that describes //! the display driver to use. //! //! This function initializes a drawing context, preparing it for use. The //! provided display driver will be used for all subsequent graphics //! operations, and the default clipping region will be set to the extent of //! the screen. //! //! \return None. // //*****************************************************************************
Initializes a drawing context. \param pContext is a pointer to the drawing context to initialize. \param pDisplay is a pointer to the tDisplayInfo structure that describes the display driver to use. This function initializes a drawing context, preparing it for use. The provided display driver will be used for all subsequent graphics operations, and the default clipping region will be set to the extent of the screen. \return None.
[ "Initializes", "a", "drawing", "context", ".", "\\", "param", "pContext", "is", "a", "pointer", "to", "the", "drawing", "context", "to", "initialize", ".", "\\", "param", "pDisplay", "is", "a", "pointer", "to", "the", "tDisplayInfo", "structure", "that", "describes", "the", "display", "driver", "to", "use", ".", "This", "function", "initializes", "a", "drawing", "context", "preparing", "it", "for", "use", ".", "The", "provided", "display", "driver", "will", "be", "used", "for", "all", "subsequent", "graphics", "operations", "and", "the", "default", "clipping", "region", "will", "be", "set", "to", "the", "extent", "of", "the", "screen", ".", "\\", "return", "None", "." ]
void GrContextInit(tContext *pContext, const tDisplay *pDisplay) { ASSERT(pContext); ASSERT(pDisplay); pContext->lSize = sizeof(tContext); pContext->pDisplay = pDisplay; pContext->sClipRegion.sXMin = 0; pContext->sClipRegion.sYMin = 0; pContext->sClipRegion.sXMax = pDisplay->usWidth - 1; pContext->sClipRegion.sYMax = pDisplay->usHeight - 1; pContext->ulForeground = 0; pContext->ulBackground = 0; pContext->pFont = 0; #ifndef GRLIB_REMOVE_WIDE_FONT_SUPPORT if(g_psGrLibDefaults) { pContext->pfnStringRenderer = g_psGrLibDefaults->pfnStringRenderer; pContext->pCodePointMapTable = g_psGrLibDefaults->pCodePointMapTable; pContext->usCodepage = g_psGrLibDefaults->usCodepage; pContext->ucNumCodePointMaps = g_psGrLibDefaults->ucNumCodePointMaps; pContext->ucReserved = g_psGrLibDefaults->ucReserved; } else { pContext->pfnStringRenderer = GrDefaultStringRenderer; pContext->pCodePointMapTable = g_psDefaultCodePointMapTable; pContext->usCodepage = CODEPAGE_ISO8859_1; pContext->ucNumCodePointMaps = NUM_DEFAULT_CODEPOINT_MAPS; pContext->ucReserved = 0; } pContext->ucCodePointMap = 0; #endif }
[ "void", "GrContextInit", "(", "tContext", "*", "pContext", ",", "const", "tDisplay", "*", "pDisplay", ")", "{", "ASSERT", "(", "pContext", ")", ";", "ASSERT", "(", "pDisplay", ")", ";", "pContext", "->", "lSize", "=", "sizeof", "(", "tContext", ")", ";", "pContext", "->", "pDisplay", "=", "pDisplay", ";", "pContext", "->", "sClipRegion", ".", "sXMin", "=", "0", ";", "pContext", "->", "sClipRegion", ".", "sYMin", "=", "0", ";", "pContext", "->", "sClipRegion", ".", "sXMax", "=", "pDisplay", "->", "usWidth", "-", "1", ";", "pContext", "->", "sClipRegion", ".", "sYMax", "=", "pDisplay", "->", "usHeight", "-", "1", ";", "pContext", "->", "ulForeground", "=", "0", ";", "pContext", "->", "ulBackground", "=", "0", ";", "pContext", "->", "pFont", "=", "0", ";", "#ifndef", "GRLIB_REMOVE_WIDE_FONT_SUPPORT", "if", "(", "g_psGrLibDefaults", ")", "{", "pContext", "->", "pfnStringRenderer", "=", "g_psGrLibDefaults", "->", "pfnStringRenderer", ";", "pContext", "->", "pCodePointMapTable", "=", "g_psGrLibDefaults", "->", "pCodePointMapTable", ";", "pContext", "->", "usCodepage", "=", "g_psGrLibDefaults", "->", "usCodepage", ";", "pContext", "->", "ucNumCodePointMaps", "=", "g_psGrLibDefaults", "->", "ucNumCodePointMaps", ";", "pContext", "->", "ucReserved", "=", "g_psGrLibDefaults", "->", "ucReserved", ";", "}", "else", "{", "pContext", "->", "pfnStringRenderer", "=", "GrDefaultStringRenderer", ";", "pContext", "->", "pCodePointMapTable", "=", "g_psDefaultCodePointMapTable", ";", "pContext", "->", "usCodepage", "=", "CODEPAGE_ISO8859_1", ";", "pContext", "->", "ucNumCodePointMaps", "=", "NUM_DEFAULT_CODEPOINT_MAPS", ";", "pContext", "->", "ucReserved", "=", "0", ";", "}", "pContext", "->", "ucCodePointMap", "=", "0", ";", "#endif", "}" ]
Initializes a drawing context.
[ "Initializes", "a", "drawing", "context", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Set the size of the context.\r", "//\r", "//\r", "// Save the pointer to the display.\r", "//\r", "//\r", "// Initialize the extent of the clipping region to the extents of the\r", "// screen.\r", "//\r", "//\r", "// Provide a default color and font.\r", "//\r", "//\r", "// Set defaults for all text rendering options.\r", "//\r" ]
[ { "param": "pContext", "type": "tContext" }, { "param": "pDisplay", "type": "tDisplay" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pContext", "type": "tContext", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pDisplay", "type": "tDisplay", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
e4902aa1393787b9268130074f190cbe2a989ba7
junyanl-code/Luminary-Micro-Library
grlib/context.c
[ "BSD-3-Clause" ]
C
GrContextClipRegionSet
void
void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect) { unsigned long ulW, ulH; // // Check the arguments. // ASSERT(pContext); ASSERT(pRect); // // Get the width and height of the display. // ulW = DpyWidthGet(pContext->pDisplay); ulH = DpyHeightGet(pContext->pDisplay); // // Set the extents of the clipping region, forcing them to reside within // the extents of the screen. // pContext->sClipRegion.sXMin = ((pRect->sXMin < 0) ? 0 : ((pRect->sXMin >= ulW) ? (ulW - 1) : pRect->sXMin)); pContext->sClipRegion.sYMin = ((pRect->sYMin < 0) ? 0 : ((pRect->sYMin >= ulH) ? (ulH - 1) : pRect->sYMin)); pContext->sClipRegion.sXMax = ((pRect->sXMax < 0) ? 0 : ((pRect->sXMax >= ulW) ? (ulW - 1) : pRect->sXMax)); pContext->sClipRegion.sYMax = ((pRect->sYMax < 0) ? 0 : ((pRect->sYMax >= ulH) ? (ulH - 1) : pRect->sYMax)); }
//***************************************************************************** // //! Sets the extents of the clipping region. //! //! \param pContext is a pointer to the drawing context to use. //! \param pRect is a pointer to the structure containing the extents of the //! clipping region. //! //! This function sets the extents of the clipping region. The clipping region //! is not allowed to exceed the extents of the screen, but may be a portion of //! the screen. //! //! The supplied coordinate are inclusive; \e sXMin of 1 and \e sXMax of 1 will //! define a clipping region that will display only the pixels in the X = 1 //! column. A consequence of this is that the clipping region must contain //! at least one row and one column. //! //! \return None. // //*****************************************************************************
Sets the extents of the clipping region. \param pContext is a pointer to the drawing context to use. \param pRect is a pointer to the structure containing the extents of the clipping region. This function sets the extents of the clipping region. The clipping region is not allowed to exceed the extents of the screen, but may be a portion of the screen. The supplied coordinate are inclusive; \e sXMin of 1 and \e sXMax of 1 will define a clipping region that will display only the pixels in the X = 1 column. A consequence of this is that the clipping region must contain at least one row and one column. \return None.
[ "Sets", "the", "extents", "of", "the", "clipping", "region", ".", "\\", "param", "pContext", "is", "a", "pointer", "to", "the", "drawing", "context", "to", "use", ".", "\\", "param", "pRect", "is", "a", "pointer", "to", "the", "structure", "containing", "the", "extents", "of", "the", "clipping", "region", ".", "This", "function", "sets", "the", "extents", "of", "the", "clipping", "region", ".", "The", "clipping", "region", "is", "not", "allowed", "to", "exceed", "the", "extents", "of", "the", "screen", "but", "may", "be", "a", "portion", "of", "the", "screen", ".", "The", "supplied", "coordinate", "are", "inclusive", ";", "\\", "e", "sXMin", "of", "1", "and", "\\", "e", "sXMax", "of", "1", "will", "define", "a", "clipping", "region", "that", "will", "display", "only", "the", "pixels", "in", "the", "X", "=", "1", "column", ".", "A", "consequence", "of", "this", "is", "that", "the", "clipping", "region", "must", "contain", "at", "least", "one", "row", "and", "one", "column", ".", "\\", "return", "None", "." ]
void GrContextClipRegionSet(tContext *pContext, tRectangle *pRect) { unsigned long ulW, ulH; ASSERT(pContext); ASSERT(pRect); ulW = DpyWidthGet(pContext->pDisplay); ulH = DpyHeightGet(pContext->pDisplay); pContext->sClipRegion.sXMin = ((pRect->sXMin < 0) ? 0 : ((pRect->sXMin >= ulW) ? (ulW - 1) : pRect->sXMin)); pContext->sClipRegion.sYMin = ((pRect->sYMin < 0) ? 0 : ((pRect->sYMin >= ulH) ? (ulH - 1) : pRect->sYMin)); pContext->sClipRegion.sXMax = ((pRect->sXMax < 0) ? 0 : ((pRect->sXMax >= ulW) ? (ulW - 1) : pRect->sXMax)); pContext->sClipRegion.sYMax = ((pRect->sYMax < 0) ? 0 : ((pRect->sYMax >= ulH) ? (ulH - 1) : pRect->sYMax)); }
[ "void", "GrContextClipRegionSet", "(", "tContext", "*", "pContext", ",", "tRectangle", "*", "pRect", ")", "{", "unsigned", "long", "ulW", ",", "ulH", ";", "ASSERT", "(", "pContext", ")", ";", "ASSERT", "(", "pRect", ")", ";", "ulW", "=", "DpyWidthGet", "(", "pContext", "->", "pDisplay", ")", ";", "ulH", "=", "DpyHeightGet", "(", "pContext", "->", "pDisplay", ")", ";", "pContext", "->", "sClipRegion", ".", "sXMin", "=", "(", "(", "pRect", "->", "sXMin", "<", "0", ")", "?", "0", ":", "(", "(", "pRect", "->", "sXMin", ">=", "ulW", ")", "?", "(", "ulW", "-", "1", ")", ":", "pRect", "->", "sXMin", ")", ")", ";", "pContext", "->", "sClipRegion", ".", "sYMin", "=", "(", "(", "pRect", "->", "sYMin", "<", "0", ")", "?", "0", ":", "(", "(", "pRect", "->", "sYMin", ">=", "ulH", ")", "?", "(", "ulH", "-", "1", ")", ":", "pRect", "->", "sYMin", ")", ")", ";", "pContext", "->", "sClipRegion", ".", "sXMax", "=", "(", "(", "pRect", "->", "sXMax", "<", "0", ")", "?", "0", ":", "(", "(", "pRect", "->", "sXMax", ">=", "ulW", ")", "?", "(", "ulW", "-", "1", ")", ":", "pRect", "->", "sXMax", ")", ")", ";", "pContext", "->", "sClipRegion", ".", "sYMax", "=", "(", "(", "pRect", "->", "sYMax", "<", "0", ")", "?", "0", ":", "(", "(", "pRect", "->", "sYMax", ">=", "ulH", ")", "?", "(", "ulH", "-", "1", ")", ":", "pRect", "->", "sYMax", ")", ")", ";", "}" ]
Sets the extents of the clipping region.
[ "Sets", "the", "extents", "of", "the", "clipping", "region", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Get the width and height of the display.\r", "//\r", "//\r", "// Set the extents of the clipping region, forcing them to reside within\r", "// the extents of the screen.\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": [] }
6d3fd210cb9e021fee0895be7b0c9ebc0c1e1e83
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s811/timers/timers.c
[ "BSD-3-Clause" ]
C
Timer0IntHandler
void
void Timer0IntHandler(void) { // // Clear the timer interrupt. // TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); // // Toggle the flag for the first timer. // HWREGBITW(&g_ulFlags, 0) ^= 1; // // Update the interrupt status on the display. // IntMasterDisable(); Display96x16x1StringDraw(HWREGBITW(&g_ulFlags, 0) ? "1" : "0", 36, 1); IntMasterEnable(); }
//***************************************************************************** // // The interrupt handler for the first timer interrupt. // //*****************************************************************************
The interrupt handler for the first timer interrupt.
[ "The", "interrupt", "handler", "for", "the", "first", "timer", "interrupt", "." ]
void Timer0IntHandler(void) { TimerIntClear(TIMER0_BASE, TIMER_TIMA_TIMEOUT); HWREGBITW(&g_ulFlags, 0) ^= 1; IntMasterDisable(); Display96x16x1StringDraw(HWREGBITW(&g_ulFlags, 0) ? "1" : "0", 36, 1); IntMasterEnable(); }
[ "void", "Timer0IntHandler", "(", "void", ")", "{", "TimerIntClear", "(", "TIMER0_BASE", ",", "TIMER_TIMA_TIMEOUT", ")", ";", "HWREGBITW", "(", "&", "g_ulFlags", ",", "0", ")", "^=", "1", ";", "IntMasterDisable", "(", ")", ";", "Display96x16x1StringDraw", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "0", ")", "?", "\"", "\"", ":", "\"", "\"", ",", "36", ",", "1", ")", ";", "IntMasterEnable", "(", ")", ";", "}" ]
The interrupt handler for the first timer interrupt.
[ "The", "interrupt", "handler", "for", "the", "first", "timer", "interrupt", "." ]
[ "//\r", "// Clear the timer interrupt.\r", "//\r", "//\r", "// Toggle the flag for the first timer.\r", "//\r", "//\r", "// Update the interrupt status on the display.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6d3fd210cb9e021fee0895be7b0c9ebc0c1e1e83
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s811/timers/timers.c
[ "BSD-3-Clause" ]
C
Timer1IntHandler
void
void Timer1IntHandler(void) { // // Clear the timer interrupt. // TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); // // Toggle the flag for the second timer. // HWREGBITW(&g_ulFlags, 1) ^= 1; // // Update the interrupt status on the display. // IntMasterDisable(); Display96x16x1StringDraw(HWREGBITW(&g_ulFlags, 1) ? "1" : "0", 78, 1); IntMasterEnable(); }
//***************************************************************************** // // The interrupt handler for the second timer interrupt. // //*****************************************************************************
The interrupt handler for the second timer interrupt.
[ "The", "interrupt", "handler", "for", "the", "second", "timer", "interrupt", "." ]
void Timer1IntHandler(void) { TimerIntClear(TIMER1_BASE, TIMER_TIMA_TIMEOUT); HWREGBITW(&g_ulFlags, 1) ^= 1; IntMasterDisable(); Display96x16x1StringDraw(HWREGBITW(&g_ulFlags, 1) ? "1" : "0", 78, 1); IntMasterEnable(); }
[ "void", "Timer1IntHandler", "(", "void", ")", "{", "TimerIntClear", "(", "TIMER1_BASE", ",", "TIMER_TIMA_TIMEOUT", ")", ";", "HWREGBITW", "(", "&", "g_ulFlags", ",", "1", ")", "^=", "1", ";", "IntMasterDisable", "(", ")", ";", "Display96x16x1StringDraw", "(", "HWREGBITW", "(", "&", "g_ulFlags", ",", "1", ")", "?", "\"", "\"", ":", "\"", "\"", ",", "78", ",", "1", ")", ";", "IntMasterEnable", "(", ")", ";", "}" ]
The interrupt handler for the second timer interrupt.
[ "The", "interrupt", "handler", "for", "the", "second", "timer", "interrupt", "." ]
[ "//\r", "// Clear the timer interrupt.\r", "//\r", "//\r", "// Toggle the flag for the second timer.\r", "//\r", "//\r", "// Update the interrupt status on the display.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGDecompressImage
null
static long JPEGDecompressImage(tJPEGWidget *pJPEG) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; boolean bRetcode; JDIMENSION iNumLines; JSAMPROW pScanRows[4]; unsigned char *pSrcPixel; unsigned short *pusPixel; unsigned long ulImageSize, ulScanBufferHeight, ulColor; int iPixel, iTotalPixels; // // Initialize the deccompression object. // cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); // // Set the data source. // bRetcode = jpeg_ram_src(&cinfo, (JOCTET *)pJPEG->pucImage, pJPEG->ulImageLen); if(!bRetcode) { return(1); } // // Read the image header. // jpeg_read_header(&cinfo, TRUE); // // Tell the JPEG decoder to use the fast integer DCT algorithm. This is // required since the default is the slow integer version but we have // disabled this in the current version of third_party/jpeg/jmorecfg.h to // reduce the image size. // cinfo.dct_method = JDCT_IFAST; // // Calculate the output image dimensions so that we can allocate // appropriate buffers. // jpeg_calc_output_dimensions(&cinfo); // // Allocate a buffer large enough to hold the output image stored at 16 // bits per pixel (the native color format for the display) // ulImageSize = (cinfo.output_width * cinfo.output_height * 2); pJPEG->psJPEGInst->pusImage = (unsigned short *)ExtRAMAlloc(ulImageSize); pusPixel = pJPEG->psJPEGInst->pusImage; if(!pJPEG->psJPEGInst->pusImage) { return(2); } // // Allocate a buffer that can hold cinfo.rec_outbuf_height lines of pixels // output from the decompressor. These pixels are described as multiple // components (typically 3) so we need to take this into account. // ulScanBufferHeight = ((cinfo.rec_outbuf_height < 4) ? cinfo.rec_outbuf_height : 4); pScanRows[0] = (JSAMPROW)ExtRAMAlloc(cinfo.output_width * ulScanBufferHeight * cinfo.output_components); if(!pScanRows[0]) { ExtRAMFree(pJPEG->psJPEGInst->pusImage); pJPEG->psJPEGInst->pusImage = 0; return(3); } // // Remember the size of the image we are decompressing. // pJPEG->psJPEGInst->usHeight = cinfo.output_height; pJPEG->psJPEGInst->usWidth = cinfo.output_width; pJPEG->psJPEGInst->sXOffset = 0; pJPEG->psJPEGInst->sYOffset = 0; // // If we allocated more than 1 line, we need to fill in the row pointers // for each of the other rows in the scanline buffer. // for(iNumLines = 1; iNumLines < (int)ulScanBufferHeight; iNumLines++) { pScanRows[iNumLines] = pScanRows[iNumLines - 1] + (cinfo.output_width * cinfo.output_components); } // // // Start decompression. // jpeg_start_decompress(&cinfo); // // Decompress the image a piece at a time. // while (cinfo.output_scanline < cinfo.output_height) { // // Request some decompressed pixels. // iNumLines = jpeg_read_scanlines(&cinfo, pScanRows, ulScanBufferHeight); // // How many pixels do we need to process? // iTotalPixels = iNumLines * cinfo.output_width; pSrcPixel = (unsigned char *)pScanRows[0]; for(iPixel = iTotalPixels; iPixel; iPixel--) { // // Read the RGB pixel from the scanline. // ulColor = *pSrcPixel++; ulColor <<= 8; ulColor |= *pSrcPixel++; ulColor <<= 8; ulColor |= *pSrcPixel++; // // Convert to 16 bit and store in the output image buffer. // *pusPixel = pJPEG->sBase.pDisplay->pfnColorTranslate( pJPEG->sBase.pDisplay->pvDisplayData, ulColor); pusPixel++; } } // // Destroy the decompression object. // jpeg_finish_decompress(&cinfo); // // Free the scanline buffer. // ExtRAMFree(pScanRows[0]); // // Tell the caller everything went well. // return(0); }
//***************************************************************************** // // Decompress the JPEG image whose compressed data is linked to the supplied // widget. // //*****************************************************************************
Decompress the JPEG image whose compressed data is linked to the supplied widget.
[ "Decompress", "the", "JPEG", "image", "whose", "compressed", "data", "is", "linked", "to", "the", "supplied", "widget", "." ]
static long JPEGDecompressImage(tJPEGWidget *pJPEG) { struct jpeg_decompress_struct cinfo; struct jpeg_error_mgr jerr; boolean bRetcode; JDIMENSION iNumLines; JSAMPROW pScanRows[4]; unsigned char *pSrcPixel; unsigned short *pusPixel; unsigned long ulImageSize, ulScanBufferHeight, ulColor; int iPixel, iTotalPixels; cinfo.err = jpeg_std_error(&jerr); jpeg_create_decompress(&cinfo); bRetcode = jpeg_ram_src(&cinfo, (JOCTET *)pJPEG->pucImage, pJPEG->ulImageLen); if(!bRetcode) { return(1); } jpeg_read_header(&cinfo, TRUE); cinfo.dct_method = JDCT_IFAST; jpeg_calc_output_dimensions(&cinfo); ulImageSize = (cinfo.output_width * cinfo.output_height * 2); pJPEG->psJPEGInst->pusImage = (unsigned short *)ExtRAMAlloc(ulImageSize); pusPixel = pJPEG->psJPEGInst->pusImage; if(!pJPEG->psJPEGInst->pusImage) { return(2); } ulScanBufferHeight = ((cinfo.rec_outbuf_height < 4) ? cinfo.rec_outbuf_height : 4); pScanRows[0] = (JSAMPROW)ExtRAMAlloc(cinfo.output_width * ulScanBufferHeight * cinfo.output_components); if(!pScanRows[0]) { ExtRAMFree(pJPEG->psJPEGInst->pusImage); pJPEG->psJPEGInst->pusImage = 0; return(3); } pJPEG->psJPEGInst->usHeight = cinfo.output_height; pJPEG->psJPEGInst->usWidth = cinfo.output_width; pJPEG->psJPEGInst->sXOffset = 0; pJPEG->psJPEGInst->sYOffset = 0; for(iNumLines = 1; iNumLines < (int)ulScanBufferHeight; iNumLines++) { pScanRows[iNumLines] = pScanRows[iNumLines - 1] + (cinfo.output_width * cinfo.output_components); } jpeg_start_decompress(&cinfo); while (cinfo.output_scanline < cinfo.output_height) { iNumLines = jpeg_read_scanlines(&cinfo, pScanRows, ulScanBufferHeight); iTotalPixels = iNumLines * cinfo.output_width; pSrcPixel = (unsigned char *)pScanRows[0]; for(iPixel = iTotalPixels; iPixel; iPixel--) { ulColor = *pSrcPixel++; ulColor <<= 8; ulColor |= *pSrcPixel++; ulColor <<= 8; ulColor |= *pSrcPixel++; *pusPixel = pJPEG->sBase.pDisplay->pfnColorTranslate( pJPEG->sBase.pDisplay->pvDisplayData, ulColor); pusPixel++; } } jpeg_finish_decompress(&cinfo); ExtRAMFree(pScanRows[0]); return(0); }
[ "static", "long", "JPEGDecompressImage", "(", "tJPEGWidget", "*", "pJPEG", ")", "{", "struct", "jpeg_decompress_struct", "cinfo", ";", "struct", "jpeg_error_mgr", "jerr", ";", "boolean", "bRetcode", ";", "JDIMENSION", "iNumLines", ";", "JSAMPROW", "pScanRows", "[", "4", "]", ";", "unsigned", "char", "*", "pSrcPixel", ";", "unsigned", "short", "*", "pusPixel", ";", "unsigned", "long", "ulImageSize", ",", "ulScanBufferHeight", ",", "ulColor", ";", "int", "iPixel", ",", "iTotalPixels", ";", "cinfo", ".", "err", "=", "jpeg_std_error", "(", "&", "jerr", ")", ";", "jpeg_create_decompress", "(", "&", "cinfo", ")", ";", "bRetcode", "=", "jpeg_ram_src", "(", "&", "cinfo", ",", "(", "JOCTET", "*", ")", "pJPEG", "->", "pucImage", ",", "pJPEG", "->", "ulImageLen", ")", ";", "if", "(", "!", "bRetcode", ")", "{", "return", "(", "1", ")", ";", "}", "jpeg_read_header", "(", "&", "cinfo", ",", "TRUE", ")", ";", "cinfo", ".", "dct_method", "=", "JDCT_IFAST", ";", "jpeg_calc_output_dimensions", "(", "&", "cinfo", ")", ";", "ulImageSize", "=", "(", "cinfo", ".", "output_width", "*", "cinfo", ".", "output_height", "*", "2", ")", ";", "pJPEG", "->", "psJPEGInst", "->", "pusImage", "=", "(", "unsigned", "short", "*", ")", "ExtRAMAlloc", "(", "ulImageSize", ")", ";", "pusPixel", "=", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ";", "if", "(", "!", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ")", "{", "return", "(", "2", ")", ";", "}", "ulScanBufferHeight", "=", "(", "(", "cinfo", ".", "rec_outbuf_height", "<", "4", ")", "?", "cinfo", ".", "rec_outbuf_height", ":", "4", ")", ";", "pScanRows", "[", "0", "]", "=", "(", "JSAMPROW", ")", "ExtRAMAlloc", "(", "cinfo", ".", "output_width", "*", "ulScanBufferHeight", "*", "cinfo", ".", "output_components", ")", ";", "if", "(", "!", "pScanRows", "[", "0", "]", ")", "{", "ExtRAMFree", "(", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ")", ";", "pJPEG", "->", "psJPEGInst", "->", "pusImage", "=", "0", ";", "return", "(", "3", ")", ";", "}", "pJPEG", "->", "psJPEGInst", "->", "usHeight", "=", "cinfo", ".", "output_height", ";", "pJPEG", "->", "psJPEGInst", "->", "usWidth", "=", "cinfo", ".", "output_width", ";", "pJPEG", "->", "psJPEGInst", "->", "sXOffset", "=", "0", ";", "pJPEG", "->", "psJPEGInst", "->", "sYOffset", "=", "0", ";", "for", "(", "iNumLines", "=", "1", ";", "iNumLines", "<", "(", "int", ")", "ulScanBufferHeight", ";", "iNumLines", "++", ")", "{", "pScanRows", "[", "iNumLines", "]", "=", "pScanRows", "[", "iNumLines", "-", "1", "]", "+", "(", "cinfo", ".", "output_width", "*", "cinfo", ".", "output_components", ")", ";", "}", "jpeg_start_decompress", "(", "&", "cinfo", ")", ";", "while", "(", "cinfo", ".", "output_scanline", "<", "cinfo", ".", "output_height", ")", "{", "iNumLines", "=", "jpeg_read_scanlines", "(", "&", "cinfo", ",", "pScanRows", ",", "ulScanBufferHeight", ")", ";", "iTotalPixels", "=", "iNumLines", "*", "cinfo", ".", "output_width", ";", "pSrcPixel", "=", "(", "unsigned", "char", "*", ")", "pScanRows", "[", "0", "]", ";", "for", "(", "iPixel", "=", "iTotalPixels", ";", "iPixel", ";", "iPixel", "--", ")", "{", "ulColor", "=", "*", "pSrcPixel", "++", ";", "ulColor", "<<=", "8", ";", "ulColor", "|=", "*", "pSrcPixel", "++", ";", "ulColor", "<<=", "8", ";", "ulColor", "|=", "*", "pSrcPixel", "++", ";", "*", "pusPixel", "=", "pJPEG", "->", "sBase", ".", "pDisplay", "->", "pfnColorTranslate", "(", "pJPEG", "->", "sBase", ".", "pDisplay", "->", "pvDisplayData", ",", "ulColor", ")", ";", "pusPixel", "++", ";", "}", "}", "jpeg_finish_decompress", "(", "&", "cinfo", ")", ";", "ExtRAMFree", "(", "pScanRows", "[", "0", "]", ")", ";", "return", "(", "0", ")", ";", "}" ]
Decompress the JPEG image whose compressed data is linked to the supplied widget.
[ "Decompress", "the", "JPEG", "image", "whose", "compressed", "data", "is", "linked", "to", "the", "supplied", "widget", "." ]
[ "//\r", "// Initialize the deccompression object.\r", "//\r", "//\r", "// Set the data source.\r", "//\r", "//\r", "// Read the image header.\r", "//\r", "//\r", "// Tell the JPEG decoder to use the fast integer DCT algorithm. This is\r", "// required since the default is the slow integer version but we have\r", "// disabled this in the current version of third_party/jpeg/jmorecfg.h to\r", "// reduce the image size.\r", "//\r", "//\r", "// Calculate the output image dimensions so that we can allocate\r", "// appropriate buffers.\r", "//\r", "//\r", "// Allocate a buffer large enough to hold the output image stored at 16\r", "// bits per pixel (the native color format for the display)\r", "//\r", "//\r", "// Allocate a buffer that can hold cinfo.rec_outbuf_height lines of pixels\r", "// output from the decompressor. These pixels are described as multiple\r", "// components (typically 3) so we need to take this into account.\r", "//\r", "//\r", "// Remember the size of the image we are decompressing.\r", "//\r", "//\r", "// If we allocated more than 1 line, we need to fill in the row pointers\r", "// for each of the other rows in the scanline buffer.\r", "//\r", "//\r", "//\r", "// Start decompression.\r", "//\r", "//\r", "// Decompress the image a piece at a time.\r", "//\r", "//\r", "// Request some decompressed pixels.\r", "//\r", "//\r", "// How many pixels do we need to process?\r", "//\r", "//\r", "// Read the RGB pixel from the scanline.\r", "//\r", "//\r", "// Convert to 16 bit and store in the output image buffer.\r", "//\r", "//\r", "// Destroy the decompression object.\r", "//\r", "//\r", "// Free the scanline buffer.\r", "//\r", "//\r", "// Tell the caller everything went well.\r", "//\r" ]
[ { "param": "pJPEG", "type": "tJPEGWidget" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pJPEG", "type": "tJPEGWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetPaint
void
static void JPEGWidgetPaint(tWidget *pWidget) { tRectangle sRect; tJPEGWidget *pJPEG; tContext sCtx; unsigned short usWidth, usHeight, usRow; unsigned short *pusRow; short sSrcX, sSrcY, sDstX, sDstY; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a JPEG widget pointer. // pJPEG = (tJPEGWidget *)pWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, pWidget->pDisplay); // // Initialize the clipping region based on the extents of this rectangular // JPEG widget. // GrContextClipRegionSet(&sCtx, &(pWidget->sPosition)); // // Take a copy of the current widget position. // sRect=pWidget->sPosition; // // See if the JPEG widget outline style is selected. // if(pJPEG->ulStyle & JW_STYLE_OUTLINE) { unsigned long ulLoop; GrContextForegroundSet(&sCtx, pJPEG->ulOutlineColor); // // Outline the JPEG widget with the outline color. // for(ulLoop = 0; ulLoop < (unsigned long)pJPEG->ucBorderWidth; ulLoop++) { GrRectDraw(&sCtx, &sRect); sRect.sXMin++; sRect.sYMin++; sRect.sXMax--; sRect.sYMax--; } } // // If the fill style is selected fill the widget with the appropriate color. // if(pJPEG->ulStyle & JW_STYLE_FILL) { // // Fill the JPEG widget with the fill color. // GrContextForegroundSet(&sCtx, pJPEG->ulFillColor); GrRectFill(&sCtx, &sRect); } // // Does the widget had a decompressed image to draw? // if(pJPEG->psJPEGInst->pusImage) { // // What is the size of the image area of the widget? // usWidth = (sRect.sXMax - sRect.sXMin) + 1; usHeight = (sRect.sYMax - sRect.sYMin) + 1; // // Is the display window wider than the image? // if(usWidth > pJPEG->psJPEGInst->usWidth) { // // The display window is wider so we need to center the image // within the window. // sDstX = sRect.sXMin + (short)(usWidth - pJPEG->psJPEGInst->usWidth) / 2; sSrcX = 0; usWidth = pJPEG->psJPEGInst->usWidth; } else { // // The image is wider so we will fill the window (in the x // direction) and clip the image accordingly. // sDstX = sRect.sXMin; sSrcX = (pJPEG->psJPEGInst->usWidth - usWidth) / 2 - pJPEG->psJPEGInst->sXOffset; // // Ensure we don't wrap the image due to an offset that is too // large. // sSrcX = (sSrcX < 0) ? 0 : sSrcX; } // // Is the image highter than the display window? // if(usHeight > pJPEG->psJPEGInst->usHeight) { // // The display window is higher so we need to center the image // within the window. // sDstY = sRect.sYMin + (short)(usHeight - pJPEG->psJPEGInst->usHeight) / 2; sSrcY = 0; usHeight = pJPEG->psJPEGInst->usHeight; } else { // // The image is higher so we will fill the window (in the y // direction) and clip the image accordingly. // sDstY = sRect.sYMin; sSrcY = (pJPEG->psJPEGInst->usHeight - usHeight) / 2 - pJPEG->psJPEGInst->sYOffset; // // Ensure we don't wrap the image due to an offset that is too // large. // sSrcY = (sSrcY < 0) ? 0 : sSrcY; } // // Start at the top left of the visible portion of the image (based on the // slider settings). // pusRow = pJPEG->psJPEGInst->pusImage + sSrcX + (sSrcY * pJPEG->psJPEGInst->usWidth); // // Draw the rows of image data using direct calls to the display driver. // for(usRow = 0; usRow < usHeight; usRow++) { sCtx.pDisplay->pfnPixelDrawMultiple( sCtx.pDisplay->pvDisplayData, sDstX, sDstY + usRow, 0, usWidth, 16, (unsigned char *)pusRow, 0); pusRow += pJPEG->psJPEGInst->usWidth; } } // // See if the JPEG widget text style is selected. // if(pJPEG->ulStyle & JW_STYLE_TEXT) { // // Compute the center of the JPEG widget. // sDstX = (sRect.sXMin + ((sRect.sXMax - sRect.sXMin + 1) / 2)); sDstY = (sRect.sYMin + ((sRect.sYMax - sRect.sYMin + 1) / 2)); // // Draw the text centered in the middle of the JPEG widget. // GrContextFontSet(&sCtx, pJPEG->pFont); GrContextForegroundSet(&sCtx, pJPEG->ulTextColor); GrStringDrawCentered(&sCtx, pJPEG->pcText, -1, sDstX, sDstY, 0); } }
//***************************************************************************** // // Draws a JPEG widget. // // \param pWidget is a pointer to the JPEG widget to be drawn. // // This function draws a JPEG widget on the display. This is called in // response to a \b WIDGET_MSG_PAINT message. // // \return None. // //*****************************************************************************
Draws a JPEG widget. \param pWidget is a pointer to the JPEG widget to be drawn. This function draws a JPEG widget on the display. This is called in response to a \b WIDGET_MSG_PAINT message. \return None.
[ "Draws", "a", "JPEG", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", "to", "be", "drawn", ".", "This", "function", "draws", "a", "JPEG", "widget", "on", "the", "display", ".", "This", "is", "called", "in", "response", "to", "a", "\\", "b", "WIDGET_MSG_PAINT", "message", ".", "\\", "return", "None", "." ]
static void JPEGWidgetPaint(tWidget *pWidget) { tRectangle sRect; tJPEGWidget *pJPEG; tContext sCtx; unsigned short usWidth, usHeight, usRow; unsigned short *pusRow; short sSrcX, sSrcY, sDstX, sDstY; ASSERT(pWidget); pJPEG = (tJPEGWidget *)pWidget; GrContextInit(&sCtx, pWidget->pDisplay); GrContextClipRegionSet(&sCtx, &(pWidget->sPosition)); sRect=pWidget->sPosition; if(pJPEG->ulStyle & JW_STYLE_OUTLINE) { unsigned long ulLoop; GrContextForegroundSet(&sCtx, pJPEG->ulOutlineColor); for(ulLoop = 0; ulLoop < (unsigned long)pJPEG->ucBorderWidth; ulLoop++) { GrRectDraw(&sCtx, &sRect); sRect.sXMin++; sRect.sYMin++; sRect.sXMax--; sRect.sYMax--; } } if(pJPEG->ulStyle & JW_STYLE_FILL) { GrContextForegroundSet(&sCtx, pJPEG->ulFillColor); GrRectFill(&sCtx, &sRect); } if(pJPEG->psJPEGInst->pusImage) { usWidth = (sRect.sXMax - sRect.sXMin) + 1; usHeight = (sRect.sYMax - sRect.sYMin) + 1; if(usWidth > pJPEG->psJPEGInst->usWidth) { sDstX = sRect.sXMin + (short)(usWidth - pJPEG->psJPEGInst->usWidth) / 2; sSrcX = 0; usWidth = pJPEG->psJPEGInst->usWidth; } else { sDstX = sRect.sXMin; sSrcX = (pJPEG->psJPEGInst->usWidth - usWidth) / 2 - pJPEG->psJPEGInst->sXOffset; sSrcX = (sSrcX < 0) ? 0 : sSrcX; } if(usHeight > pJPEG->psJPEGInst->usHeight) { sDstY = sRect.sYMin + (short)(usHeight - pJPEG->psJPEGInst->usHeight) / 2; sSrcY = 0; usHeight = pJPEG->psJPEGInst->usHeight; } else { sDstY = sRect.sYMin; sSrcY = (pJPEG->psJPEGInst->usHeight - usHeight) / 2 - pJPEG->psJPEGInst->sYOffset; sSrcY = (sSrcY < 0) ? 0 : sSrcY; } pusRow = pJPEG->psJPEGInst->pusImage + sSrcX + (sSrcY * pJPEG->psJPEGInst->usWidth); for(usRow = 0; usRow < usHeight; usRow++) { sCtx.pDisplay->pfnPixelDrawMultiple( sCtx.pDisplay->pvDisplayData, sDstX, sDstY + usRow, 0, usWidth, 16, (unsigned char *)pusRow, 0); pusRow += pJPEG->psJPEGInst->usWidth; } } if(pJPEG->ulStyle & JW_STYLE_TEXT) { sDstX = (sRect.sXMin + ((sRect.sXMax - sRect.sXMin + 1) / 2)); sDstY = (sRect.sYMin + ((sRect.sYMax - sRect.sYMin + 1) / 2)); GrContextFontSet(&sCtx, pJPEG->pFont); GrContextForegroundSet(&sCtx, pJPEG->ulTextColor); GrStringDrawCentered(&sCtx, pJPEG->pcText, -1, sDstX, sDstY, 0); } }
[ "static", "void", "JPEGWidgetPaint", "(", "tWidget", "*", "pWidget", ")", "{", "tRectangle", "sRect", ";", "tJPEGWidget", "*", "pJPEG", ";", "tContext", "sCtx", ";", "unsigned", "short", "usWidth", ",", "usHeight", ",", "usRow", ";", "unsigned", "short", "*", "pusRow", ";", "short", "sSrcX", ",", "sSrcY", ",", "sDstX", ",", "sDstY", ";", "ASSERT", "(", "pWidget", ")", ";", "pJPEG", "=", "(", "tJPEGWidget", "*", ")", "pWidget", ";", "GrContextInit", "(", "&", "sCtx", ",", "pWidget", "->", "pDisplay", ")", ";", "GrContextClipRegionSet", "(", "&", "sCtx", ",", "&", "(", "pWidget", "->", "sPosition", ")", ")", ";", "sRect", "=", "pWidget", "->", "sPosition", ";", "if", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_OUTLINE", ")", "{", "unsigned", "long", "ulLoop", ";", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pJPEG", "->", "ulOutlineColor", ")", ";", "for", "(", "ulLoop", "=", "0", ";", "ulLoop", "<", "(", "unsigned", "long", ")", "pJPEG", "->", "ucBorderWidth", ";", "ulLoop", "++", ")", "{", "GrRectDraw", "(", "&", "sCtx", ",", "&", "sRect", ")", ";", "sRect", ".", "sXMin", "++", ";", "sRect", ".", "sYMin", "++", ";", "sRect", ".", "sXMax", "--", ";", "sRect", ".", "sYMax", "--", ";", "}", "}", "if", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_FILL", ")", "{", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pJPEG", "->", "ulFillColor", ")", ";", "GrRectFill", "(", "&", "sCtx", ",", "&", "sRect", ")", ";", "}", "if", "(", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ")", "{", "usWidth", "=", "(", "sRect", ".", "sXMax", "-", "sRect", ".", "sXMin", ")", "+", "1", ";", "usHeight", "=", "(", "sRect", ".", "sYMax", "-", "sRect", ".", "sYMin", ")", "+", "1", ";", "if", "(", "usWidth", ">", "pJPEG", "->", "psJPEGInst", "->", "usWidth", ")", "{", "sDstX", "=", "sRect", ".", "sXMin", "+", "(", "short", ")", "(", "usWidth", "-", "pJPEG", "->", "psJPEGInst", "->", "usWidth", ")", "/", "2", ";", "sSrcX", "=", "0", ";", "usWidth", "=", "pJPEG", "->", "psJPEGInst", "->", "usWidth", ";", "}", "else", "{", "sDstX", "=", "sRect", ".", "sXMin", ";", "sSrcX", "=", "(", "pJPEG", "->", "psJPEGInst", "->", "usWidth", "-", "usWidth", ")", "/", "2", "-", "pJPEG", "->", "psJPEGInst", "->", "sXOffset", ";", "sSrcX", "=", "(", "sSrcX", "<", "0", ")", "?", "0", ":", "sSrcX", ";", "}", "if", "(", "usHeight", ">", "pJPEG", "->", "psJPEGInst", "->", "usHeight", ")", "{", "sDstY", "=", "sRect", ".", "sYMin", "+", "(", "short", ")", "(", "usHeight", "-", "pJPEG", "->", "psJPEGInst", "->", "usHeight", ")", "/", "2", ";", "sSrcY", "=", "0", ";", "usHeight", "=", "pJPEG", "->", "psJPEGInst", "->", "usHeight", ";", "}", "else", "{", "sDstY", "=", "sRect", ".", "sYMin", ";", "sSrcY", "=", "(", "pJPEG", "->", "psJPEGInst", "->", "usHeight", "-", "usHeight", ")", "/", "2", "-", "pJPEG", "->", "psJPEGInst", "->", "sYOffset", ";", "sSrcY", "=", "(", "sSrcY", "<", "0", ")", "?", "0", ":", "sSrcY", ";", "}", "pusRow", "=", "pJPEG", "->", "psJPEGInst", "->", "pusImage", "+", "sSrcX", "+", "(", "sSrcY", "*", "pJPEG", "->", "psJPEGInst", "->", "usWidth", ")", ";", "for", "(", "usRow", "=", "0", ";", "usRow", "<", "usHeight", ";", "usRow", "++", ")", "{", "sCtx", ".", "pDisplay", "->", "pfnPixelDrawMultiple", "(", "sCtx", ".", "pDisplay", "->", "pvDisplayData", ",", "sDstX", ",", "sDstY", "+", "usRow", ",", "0", ",", "usWidth", ",", "16", ",", "(", "unsigned", "char", "*", ")", "pusRow", ",", "0", ")", ";", "pusRow", "+=", "pJPEG", "->", "psJPEGInst", "->", "usWidth", ";", "}", "}", "if", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_TEXT", ")", "{", "sDstX", "=", "(", "sRect", ".", "sXMin", "+", "(", "(", "sRect", ".", "sXMax", "-", "sRect", ".", "sXMin", "+", "1", ")", "/", "2", ")", ")", ";", "sDstY", "=", "(", "sRect", ".", "sYMin", "+", "(", "(", "sRect", ".", "sYMax", "-", "sRect", ".", "sYMin", "+", "1", ")", "/", "2", ")", ")", ";", "GrContextFontSet", "(", "&", "sCtx", ",", "pJPEG", "->", "pFont", ")", ";", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pJPEG", "->", "ulTextColor", ")", ";", "GrStringDrawCentered", "(", "&", "sCtx", ",", "pJPEG", "->", "pcText", ",", "-1", ",", "sDstX", ",", "sDstY", ",", "0", ")", ";", "}", "}" ]
Draws a JPEG widget.
[ "Draws", "a", "JPEG", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a JPEG widget pointer.\r", "//\r", "//\r", "// Initialize a drawing context.\r", "//\r", "//\r", "// Initialize the clipping region based on the extents of this rectangular\r", "// JPEG widget.\r", "//\r", "//\r", "// Take a copy of the current widget position.\r", "//\r", "//\r", "// See if the JPEG widget outline style is selected.\r", "//\r", "//\r", "// Outline the JPEG widget with the outline color.\r", "//\r", "//\r", "// If the fill style is selected fill the widget with the appropriate color.\r", "//\r", "//\r", "// Fill the JPEG widget with the fill color.\r", "//\r", "//\r", "// Does the widget had a decompressed image to draw?\r", "//\r", "//\r", "// What is the size of the image area of the widget?\r", "//\r", "//\r", "// Is the display window wider than the image?\r", "//\r", "//\r", "// The display window is wider so we need to center the image\r", "// within the window.\r", "//\r", "//\r", "// The image is wider so we will fill the window (in the x\r", "// direction) and clip the image accordingly.\r", "//\r", "//\r", "// Ensure we don't wrap the image due to an offset that is too\r", "// large.\r", "//\r", "//\r", "// Is the image highter than the display window?\r", "//\r", "//\r", "// The display window is higher so we need to center the image\r", "// within the window.\r", "//\r", "//\r", "// The image is higher so we will fill the window (in the y\r", "// direction) and clip the image accordingly.\r", "//\r", "//\r", "// Ensure we don't wrap the image due to an offset that is too\r", "// large.\r", "//\r", "//\r", "// Start at the top left of the visible portion of the image (based on the\r", "// slider settings).\r", "//\r", "//\r", "// Draw the rows of image data using direct calls to the display driver.\r", "//\r", "//\r", "// See if the JPEG widget text style is selected.\r", "//\r", "//\r", "// Compute the center of the JPEG widget.\r", "//\r", "//\r", "// Draw the text centered in the middle of the JPEG widget.\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": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetHandlePtrPos
tBoolean
static tBoolean JPEGWidgetHandlePtrPos(tJPEGWidget *pJPEG, long lX, long lY) { short sDeltaX, sDeltaY, sXOffset, sYOffset, sMaxX, sMaxY; tBoolean bRetcode; // // Assume nothing changes until we know otherwise. // bRetcode = false; // // Do we have an image? // if(!pJPEG->psJPEGInst->pusImage) { // // No image so just return immediately since there's nothing we can // scroll. // return(false); } // // Did the pointer position change? // if((pJPEG->psJPEGInst->sXStart == (short)lX) && (pJPEG->psJPEGInst->sYStart == (short)lY)) { // // The pointer position didn't change so we have nothing to do. // return(false); } // // Determine the new offset and apply it to the current total offset. // sDeltaX = (short)lX - pJPEG->psJPEGInst->sXStart; sDeltaY = (short)lY - pJPEG->psJPEGInst->sYStart; sXOffset = pJPEG->psJPEGInst->sXOffset + sDeltaX; sYOffset = pJPEG->psJPEGInst->sYOffset + sDeltaY; // // Now check to make sure that neither offset causes the image to move // out of the display window and limit them as required. // sDeltaX = (pJPEG->sBase.sPosition.sXMax - pJPEG->sBase.sPosition.sXMin) + 1; sDeltaY = (pJPEG->sBase.sPosition.sYMax - pJPEG->sBase.sPosition.sYMin) + 1; sMaxX = abs((pJPEG->psJPEGInst->usWidth - sDeltaX) / 2); sMaxY = abs((pJPEG->psJPEGInst->usHeight - sDeltaY) / 2); // // If the window is wider than the image, we don't allow any scrolling. // if(sMaxX < 0) { sXOffset = 0; } else { // // Make sure that the total offset is not too large for the image we // are displaying. // if(abs(sXOffset) > sMaxX) { sXOffset = (sXOffset < 0) ? -sMaxX : sMaxX; } } // // If the window is higher than the image, we don't allow any scrolling. // if(sMaxY < 0) { sYOffset = 0; } else { // // Make sure that the total offset is not too large for the image we // are displaying. // if(abs(sYOffset) > sMaxY) { sYOffset = (sYOffset < 0) ? -sMaxY : sMaxY; } } // // Now we've calculated the new image offset. Is it different from the // previous offset? // if((sXOffset != pJPEG->psJPEGInst->sXOffset) || (sYOffset != pJPEG->psJPEGInst->sYOffset)) { // // Yes - something changed. // bRetcode = true; pJPEG->psJPEGInst->sXOffset = sXOffset; pJPEG->psJPEGInst->sYOffset = sYOffset; // // Do we need to make a callback? // if(pJPEG->pfnOnScroll) { pJPEG->pfnOnScroll((tWidget *)pJPEG, sXOffset, sYOffset); } } // // Remember where the pointer was the last time we looked at it. // pJPEG->psJPEGInst->sXStart = (short)lX; pJPEG->psJPEGInst->sYStart = (short)lY; // // Tell the caller whether anything changed or not. // return(bRetcode); }
//***************************************************************************** // // Handles changes required as a result of pointer movement. // // \param pJPEG is a pointer to the JPEG widget. // \param lX is the X coordinate of the pointer event. // \param lY is the Y coordinate of the pointer event. // // This function is called whenever a new pointer message is received which // may indicate a change in position that requires us to scroll the JPEG image. // If necessary, the OnScroll callback is made indicating the current offset // of the image. This function does not cause any repainting of the widget. // // \return Returns \b true if one or other of the image offsets changed as a // result of the call or \b false if no changes were made. // //*****************************************************************************
Handles changes required as a result of pointer movement. \param pJPEG is a pointer to the JPEG widget. \param lX is the X coordinate of the pointer event. \param lY is the Y coordinate of the pointer event. This function is called whenever a new pointer message is received which may indicate a change in position that requires us to scroll the JPEG image. If necessary, the OnScroll callback is made indicating the current offset of the image. This function does not cause any repainting of the widget. \return Returns \b true if one or other of the image offsets changed as a result of the call or \b false if no changes were made.
[ "Handles", "changes", "required", "as", "a", "result", "of", "pointer", "movement", ".", "\\", "param", "pJPEG", "is", "a", "pointer", "to", "the", "JPEG", "widget", ".", "\\", "param", "lX", "is", "the", "X", "coordinate", "of", "the", "pointer", "event", ".", "\\", "param", "lY", "is", "the", "Y", "coordinate", "of", "the", "pointer", "event", ".", "This", "function", "is", "called", "whenever", "a", "new", "pointer", "message", "is", "received", "which", "may", "indicate", "a", "change", "in", "position", "that", "requires", "us", "to", "scroll", "the", "JPEG", "image", ".", "If", "necessary", "the", "OnScroll", "callback", "is", "made", "indicating", "the", "current", "offset", "of", "the", "image", ".", "This", "function", "does", "not", "cause", "any", "repainting", "of", "the", "widget", ".", "\\", "return", "Returns", "\\", "b", "true", "if", "one", "or", "other", "of", "the", "image", "offsets", "changed", "as", "a", "result", "of", "the", "call", "or", "\\", "b", "false", "if", "no", "changes", "were", "made", "." ]
static tBoolean JPEGWidgetHandlePtrPos(tJPEGWidget *pJPEG, long lX, long lY) { short sDeltaX, sDeltaY, sXOffset, sYOffset, sMaxX, sMaxY; tBoolean bRetcode; bRetcode = false; if(!pJPEG->psJPEGInst->pusImage) { return(false); } if((pJPEG->psJPEGInst->sXStart == (short)lX) && (pJPEG->psJPEGInst->sYStart == (short)lY)) { return(false); } sDeltaX = (short)lX - pJPEG->psJPEGInst->sXStart; sDeltaY = (short)lY - pJPEG->psJPEGInst->sYStart; sXOffset = pJPEG->psJPEGInst->sXOffset + sDeltaX; sYOffset = pJPEG->psJPEGInst->sYOffset + sDeltaY; sDeltaX = (pJPEG->sBase.sPosition.sXMax - pJPEG->sBase.sPosition.sXMin) + 1; sDeltaY = (pJPEG->sBase.sPosition.sYMax - pJPEG->sBase.sPosition.sYMin) + 1; sMaxX = abs((pJPEG->psJPEGInst->usWidth - sDeltaX) / 2); sMaxY = abs((pJPEG->psJPEGInst->usHeight - sDeltaY) / 2); if(sMaxX < 0) { sXOffset = 0; } else { if(abs(sXOffset) > sMaxX) { sXOffset = (sXOffset < 0) ? -sMaxX : sMaxX; } } if(sMaxY < 0) { sYOffset = 0; } else { if(abs(sYOffset) > sMaxY) { sYOffset = (sYOffset < 0) ? -sMaxY : sMaxY; } } if((sXOffset != pJPEG->psJPEGInst->sXOffset) || (sYOffset != pJPEG->psJPEGInst->sYOffset)) { bRetcode = true; pJPEG->psJPEGInst->sXOffset = sXOffset; pJPEG->psJPEGInst->sYOffset = sYOffset; if(pJPEG->pfnOnScroll) { pJPEG->pfnOnScroll((tWidget *)pJPEG, sXOffset, sYOffset); } } pJPEG->psJPEGInst->sXStart = (short)lX; pJPEG->psJPEGInst->sYStart = (short)lY; return(bRetcode); }
[ "static", "tBoolean", "JPEGWidgetHandlePtrPos", "(", "tJPEGWidget", "*", "pJPEG", ",", "long", "lX", ",", "long", "lY", ")", "{", "short", "sDeltaX", ",", "sDeltaY", ",", "sXOffset", ",", "sYOffset", ",", "sMaxX", ",", "sMaxY", ";", "tBoolean", "bRetcode", ";", "bRetcode", "=", "false", ";", "if", "(", "!", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ")", "{", "return", "(", "false", ")", ";", "}", "if", "(", "(", "pJPEG", "->", "psJPEGInst", "->", "sXStart", "==", "(", "short", ")", "lX", ")", "&&", "(", "pJPEG", "->", "psJPEGInst", "->", "sYStart", "==", "(", "short", ")", "lY", ")", ")", "{", "return", "(", "false", ")", ";", "}", "sDeltaX", "=", "(", "short", ")", "lX", "-", "pJPEG", "->", "psJPEGInst", "->", "sXStart", ";", "sDeltaY", "=", "(", "short", ")", "lY", "-", "pJPEG", "->", "psJPEGInst", "->", "sYStart", ";", "sXOffset", "=", "pJPEG", "->", "psJPEGInst", "->", "sXOffset", "+", "sDeltaX", ";", "sYOffset", "=", "pJPEG", "->", "psJPEGInst", "->", "sYOffset", "+", "sDeltaY", ";", "sDeltaX", "=", "(", "pJPEG", "->", "sBase", ".", "sPosition", ".", "sXMax", "-", "pJPEG", "->", "sBase", ".", "sPosition", ".", "sXMin", ")", "+", "1", ";", "sDeltaY", "=", "(", "pJPEG", "->", "sBase", ".", "sPosition", ".", "sYMax", "-", "pJPEG", "->", "sBase", ".", "sPosition", ".", "sYMin", ")", "+", "1", ";", "sMaxX", "=", "abs", "(", "(", "pJPEG", "->", "psJPEGInst", "->", "usWidth", "-", "sDeltaX", ")", "/", "2", ")", ";", "sMaxY", "=", "abs", "(", "(", "pJPEG", "->", "psJPEGInst", "->", "usHeight", "-", "sDeltaY", ")", "/", "2", ")", ";", "if", "(", "sMaxX", "<", "0", ")", "{", "sXOffset", "=", "0", ";", "}", "else", "{", "if", "(", "abs", "(", "sXOffset", ")", ">", "sMaxX", ")", "{", "sXOffset", "=", "(", "sXOffset", "<", "0", ")", "?", "-", "sMaxX", ":", "sMaxX", ";", "}", "}", "if", "(", "sMaxY", "<", "0", ")", "{", "sYOffset", "=", "0", ";", "}", "else", "{", "if", "(", "abs", "(", "sYOffset", ")", ">", "sMaxY", ")", "{", "sYOffset", "=", "(", "sYOffset", "<", "0", ")", "?", "-", "sMaxY", ":", "sMaxY", ";", "}", "}", "if", "(", "(", "sXOffset", "!=", "pJPEG", "->", "psJPEGInst", "->", "sXOffset", ")", "||", "(", "sYOffset", "!=", "pJPEG", "->", "psJPEGInst", "->", "sYOffset", ")", ")", "{", "bRetcode", "=", "true", ";", "pJPEG", "->", "psJPEGInst", "->", "sXOffset", "=", "sXOffset", ";", "pJPEG", "->", "psJPEGInst", "->", "sYOffset", "=", "sYOffset", ";", "if", "(", "pJPEG", "->", "pfnOnScroll", ")", "{", "pJPEG", "->", "pfnOnScroll", "(", "(", "tWidget", "*", ")", "pJPEG", ",", "sXOffset", ",", "sYOffset", ")", ";", "}", "}", "pJPEG", "->", "psJPEGInst", "->", "sXStart", "=", "(", "short", ")", "lX", ";", "pJPEG", "->", "psJPEGInst", "->", "sYStart", "=", "(", "short", ")", "lY", ";", "return", "(", "bRetcode", ")", ";", "}" ]
Handles changes required as a result of pointer movement.
[ "Handles", "changes", "required", "as", "a", "result", "of", "pointer", "movement", "." ]
[ "//\r", "// Assume nothing changes until we know otherwise.\r", "//\r", "//\r", "// Do we have an image?\r", "//\r", "//\r", "// No image so just return immediately since there's nothing we can\r", "// scroll.\r", "//\r", "//\r", "// Did the pointer position change?\r", "//\r", "//\r", "// The pointer position didn't change so we have nothing to do.\r", "//\r", "//\r", "// Determine the new offset and apply it to the current total offset.\r", "//\r", "//\r", "// Now check to make sure that neither offset causes the image to move\r", "// out of the display window and limit them as required.\r", "//\r", "//\r", "// If the window is wider than the image, we don't allow any scrolling.\r", "//\r", "//\r", "// Make sure that the total offset is not too large for the image we\r", "// are displaying.\r", "//\r", "//\r", "// If the window is higher than the image, we don't allow any scrolling.\r", "//\r", "//\r", "// Make sure that the total offset is not too large for the image we\r", "// are displaying.\r", "//\r", "//\r", "// Now we've calculated the new image offset. Is it different from the\r", "// previous offset?\r", "//\r", "//\r", "// Yes - something changed.\r", "//\r", "//\r", "// Do we need to make a callback?\r", "//\r", "//\r", "// Remember where the pointer was the last time we looked at it.\r", "//\r", "//\r", "// Tell the caller whether anything changed or not.\r", "//\r" ]
[ { "param": "pJPEG", "type": "tJPEGWidget" }, { "param": "lX", "type": "long" }, { "param": "lY", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pJPEG", "type": "tJPEGWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lX", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lY", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetClick
null
static long JPEGWidgetClick(tWidget *pWidget, unsigned long ulMsg, long lX, long lY) { tJPEGWidget *pJPEG; tBoolean bWithinWidget, bChanged; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a JPEG widget pointer. // pJPEG = (tJPEGWidget *)pWidget; // // Is the widget currently locked? // if(pJPEG->ulStyle & JW_STYLE_LOCKED) { // // We ignore this message and have the widget manager pass it back // up the tree. // return(0); } // // Does this event occur within the bounds of this widget? // bWithinWidget = GrRectContainsPoint(&pWidget->sPosition, lX, lY); // // Is this widget a button type? // if(pJPEG->ulStyle & JW_STYLE_BUTTON) { // // Yes - it's a button. In this case, we only look for PTR_UP and // PTR_DOWN messages so that we can trigger the OnClick callback. // if(pJPEG->pfnOnClick) { // // Call the click callback if the screen has been pressed and we // are notifying on press or if the screen has been released and // we are notifying on release. // if(((ulMsg == WIDGET_MSG_PTR_UP) && (pJPEG->ulStyle & JW_STYLE_RELEASE_NOTIFY)) || ((ulMsg == WIDGET_MSG_PTR_DOWN) && !(pJPEG->ulStyle & JW_STYLE_RELEASE_NOTIFY))) { pJPEG->pfnOnClick(pWidget); } } } else { // // This is a canvas style JPEG widget so we track mouse movement to // allow us to scroll the image based on touchscreen gestures. // switch(ulMsg) { // // The user has pressed the touchscreen. // case WIDGET_MSG_PTR_DOWN: { // // Did this event occur within the bounds of this particular // widget? // if(bWithinWidget) { // // Yes, it's our press so remember where it occurred and // remember that the touchscreen is pressed. // pJPEG->ulStyle |= JW_STYLE_PRESSED; pJPEG->psJPEGInst->sXStart = (short)lX; pJPEG->psJPEGInst->sYStart = (short)lY; } break; } // // The touchscreen has been released. // case WIDGET_MSG_PTR_UP: { // // Remember that the touchscreen is no longer pressed. // pJPEG->ulStyle &= ~ JW_STYLE_PRESSED; // // Has the pointer moved since the last time we looked? If so // handle it appropriately. // bChanged = JPEGWidgetHandlePtrPos(pJPEG, lX, lY); // // Repaint the widget. // WidgetPaint(pWidget); break; } // // The pointer position has changed. // case WIDGET_MSG_PTR_MOVE: { // // Calculate the new image offsets based on the new pointer // position. // bChanged = JPEGWidgetHandlePtrPos(pJPEG, lX, lY); // // If something changed and we were asked to redraw // automatically on scrolling, do so here. // if(bChanged && (pJPEG->ulStyle & JW_STYLE_SCROLL)) { WidgetPaint(pWidget); } break; } default: break; } } // // Tell the widget manager whether this event occurred within the bounds // of this widget. // return((long)bWithinWidget); }
//***************************************************************************** // //! Handles pointer events for a JPEG widget. //! //! \param pWidget is a pointer to the JPEG widget. //! \param ulMsg is the pointer event message. //! \param lX is the X coordinate of the pointer event. //! \param lY is the Y coordinate of the pointer event. //! //! This function processes pointer event messages for a JPEG widget. //! This is called in response to a \b WIDGET_MSG_PTR_DOWN, //! \b WIDGET_MSG_PTR_MOVE, and \b WIDGET_MSG_PTR_UP messages. //! //! If the widget has the \b #JW_STYLE_LOCKED flag set, the input is ignored //! and this function returns immediately. //! //! If the widget is a button type (having style flag \b #JW_STYLE_BUTTON set), //! and the mouse message is within the extent of the widget, the OnClick //! callback function will be called on \b WIDGET_MSG_PTR_DOWN if style flag //! \b #JW_STYLE_RELEASE_NOTIFY is not set or on \b WIDGET_MSG_PTR_UP if //! \b #JW_STYLE_RELEASE_NOTIFY is set. //! //! If the widget is a canvas type (style flag \b #JW_STYLE_BUTTON not set), //! pointer messages are used to control scrolling of the JPEG image within //! the area of the widget. In this case, any pointer movement that will cause //! a change in the image position is reported to the client via the OnScroll //! callback function. //! //! \return Returns 1 if the coordinates are within the extents of the widget //! and 0 otherwise. // //*****************************************************************************
Handles pointer events for a JPEG widget. \param pWidget is a pointer to the JPEG widget. \param ulMsg is the pointer event message. \param lX is the X coordinate of the pointer event. \param lY is the Y coordinate of the pointer event. This function processes pointer event messages for a JPEG widget. This is called in response to a \b WIDGET_MSG_PTR_DOWN, \b WIDGET_MSG_PTR_MOVE, and \b WIDGET_MSG_PTR_UP messages. If the widget has the \b #JW_STYLE_LOCKED flag set, the input is ignored and this function returns immediately. If the widget is a canvas type (style flag \b #JW_STYLE_BUTTON not set), pointer messages are used to control scrolling of the JPEG image within the area of the widget. In this case, any pointer movement that will cause a change in the image position is reported to the client via the OnScroll callback function. \return Returns 1 if the coordinates are within the extents of the widget and 0 otherwise.
[ "Handles", "pointer", "events", "for", "a", "JPEG", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", ".", "\\", "param", "ulMsg", "is", "the", "pointer", "event", "message", ".", "\\", "param", "lX", "is", "the", "X", "coordinate", "of", "the", "pointer", "event", ".", "\\", "param", "lY", "is", "the", "Y", "coordinate", "of", "the", "pointer", "event", ".", "This", "function", "processes", "pointer", "event", "messages", "for", "a", "JPEG", "widget", ".", "This", "is", "called", "in", "response", "to", "a", "\\", "b", "WIDGET_MSG_PTR_DOWN", "\\", "b", "WIDGET_MSG_PTR_MOVE", "and", "\\", "b", "WIDGET_MSG_PTR_UP", "messages", ".", "If", "the", "widget", "has", "the", "\\", "b", "#JW_STYLE_LOCKED", "flag", "set", "the", "input", "is", "ignored", "and", "this", "function", "returns", "immediately", ".", "If", "the", "widget", "is", "a", "canvas", "type", "(", "style", "flag", "\\", "b", "#JW_STYLE_BUTTON", "not", "set", ")", "pointer", "messages", "are", "used", "to", "control", "scrolling", "of", "the", "JPEG", "image", "within", "the", "area", "of", "the", "widget", ".", "In", "this", "case", "any", "pointer", "movement", "that", "will", "cause", "a", "change", "in", "the", "image", "position", "is", "reported", "to", "the", "client", "via", "the", "OnScroll", "callback", "function", ".", "\\", "return", "Returns", "1", "if", "the", "coordinates", "are", "within", "the", "extents", "of", "the", "widget", "and", "0", "otherwise", "." ]
static long JPEGWidgetClick(tWidget *pWidget, unsigned long ulMsg, long lX, long lY) { tJPEGWidget *pJPEG; tBoolean bWithinWidget, bChanged; ASSERT(pWidget); pJPEG = (tJPEGWidget *)pWidget; if(pJPEG->ulStyle & JW_STYLE_LOCKED) { return(0); } bWithinWidget = GrRectContainsPoint(&pWidget->sPosition, lX, lY); if(pJPEG->ulStyle & JW_STYLE_BUTTON) { if(pJPEG->pfnOnClick) { if(((ulMsg == WIDGET_MSG_PTR_UP) && (pJPEG->ulStyle & JW_STYLE_RELEASE_NOTIFY)) || ((ulMsg == WIDGET_MSG_PTR_DOWN) && !(pJPEG->ulStyle & JW_STYLE_RELEASE_NOTIFY))) { pJPEG->pfnOnClick(pWidget); } } } else { switch(ulMsg) { case WIDGET_MSG_PTR_DOWN: { if(bWithinWidget) { pJPEG->ulStyle |= JW_STYLE_PRESSED; pJPEG->psJPEGInst->sXStart = (short)lX; pJPEG->psJPEGInst->sYStart = (short)lY; } break; } case WIDGET_MSG_PTR_UP: { pJPEG->ulStyle &= ~ JW_STYLE_PRESSED; bChanged = JPEGWidgetHandlePtrPos(pJPEG, lX, lY); WidgetPaint(pWidget); break; } case WIDGET_MSG_PTR_MOVE: { bChanged = JPEGWidgetHandlePtrPos(pJPEG, lX, lY); if(bChanged && (pJPEG->ulStyle & JW_STYLE_SCROLL)) { WidgetPaint(pWidget); } break; } default: break; } } return((long)bWithinWidget); }
[ "static", "long", "JPEGWidgetClick", "(", "tWidget", "*", "pWidget", ",", "unsigned", "long", "ulMsg", ",", "long", "lX", ",", "long", "lY", ")", "{", "tJPEGWidget", "*", "pJPEG", ";", "tBoolean", "bWithinWidget", ",", "bChanged", ";", "ASSERT", "(", "pWidget", ")", ";", "pJPEG", "=", "(", "tJPEGWidget", "*", ")", "pWidget", ";", "if", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_LOCKED", ")", "{", "return", "(", "0", ")", ";", "}", "bWithinWidget", "=", "GrRectContainsPoint", "(", "&", "pWidget", "->", "sPosition", ",", "lX", ",", "lY", ")", ";", "if", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_BUTTON", ")", "{", "if", "(", "pJPEG", "->", "pfnOnClick", ")", "{", "if", "(", "(", "(", "ulMsg", "==", "WIDGET_MSG_PTR_UP", ")", "&&", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_RELEASE_NOTIFY", ")", ")", "||", "(", "(", "ulMsg", "==", "WIDGET_MSG_PTR_DOWN", ")", "&&", "!", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_RELEASE_NOTIFY", ")", ")", ")", "{", "pJPEG", "->", "pfnOnClick", "(", "pWidget", ")", ";", "}", "}", "}", "else", "{", "switch", "(", "ulMsg", ")", "{", "case", "WIDGET_MSG_PTR_DOWN", ":", "{", "if", "(", "bWithinWidget", ")", "{", "pJPEG", "->", "ulStyle", "|=", "JW_STYLE_PRESSED", ";", "pJPEG", "->", "psJPEGInst", "->", "sXStart", "=", "(", "short", ")", "lX", ";", "pJPEG", "->", "psJPEGInst", "->", "sYStart", "=", "(", "short", ")", "lY", ";", "}", "break", ";", "}", "case", "WIDGET_MSG_PTR_UP", ":", "{", "pJPEG", "->", "ulStyle", "&=", "~", "JW_STYLE_PRESSED", ";", "bChanged", "=", "JPEGWidgetHandlePtrPos", "(", "pJPEG", ",", "lX", ",", "lY", ")", ";", "WidgetPaint", "(", "pWidget", ")", ";", "break", ";", "}", "case", "WIDGET_MSG_PTR_MOVE", ":", "{", "bChanged", "=", "JPEGWidgetHandlePtrPos", "(", "pJPEG", ",", "lX", ",", "lY", ")", ";", "if", "(", "bChanged", "&&", "(", "pJPEG", "->", "ulStyle", "&", "JW_STYLE_SCROLL", ")", ")", "{", "WidgetPaint", "(", "pWidget", ")", ";", "}", "break", ";", "}", "default", ":", "break", ";", "}", "}", "return", "(", "(", "long", ")", "bWithinWidget", ")", ";", "}" ]
Handles pointer events for a JPEG widget.
[ "Handles", "pointer", "events", "for", "a", "JPEG", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a JPEG widget pointer.\r", "//\r", "//\r", "// Is the widget currently locked?\r", "//\r", "//\r", "// We ignore this message and have the widget manager pass it back\r", "// up the tree.\r", "//\r", "//\r", "// Does this event occur within the bounds of this widget?\r", "//\r", "//\r", "// Is this widget a button type?\r", "//\r", "//\r", "// Yes - it's a button. In this case, we only look for PTR_UP and\r", "// PTR_DOWN messages so that we can trigger the OnClick callback.\r", "//\r", "//\r", "// Call the click callback if the screen has been pressed and we\r", "// are notifying on press or if the screen has been released and\r", "// we are notifying on release.\r", "//\r", "//\r", "// This is a canvas style JPEG widget so we track mouse movement to\r", "// allow us to scroll the image based on touchscreen gestures.\r", "//\r", "//\r", "// The user has pressed the touchscreen.\r", "//\r", "//\r", "// Did this event occur within the bounds of this particular\r", "// widget?\r", "//\r", "//\r", "// Yes, it's our press so remember where it occurred and\r", "// remember that the touchscreen is pressed.\r", "//\r", "//\r", "// The touchscreen has been released.\r", "//\r", "//\r", "// Remember that the touchscreen is no longer pressed.\r", "//\r", "//\r", "// Has the pointer moved since the last time we looked? If so\r", "// handle it appropriately.\r", "//\r", "//\r", "// Repaint the widget.\r", "//\r", "//\r", "// The pointer position has changed.\r", "//\r", "//\r", "// Calculate the new image offsets based on the new pointer\r", "// position.\r", "//\r", "//\r", "// If something changed and we were asked to redraw\r", "// automatically on scrolling, do so here.\r", "//\r", "//\r", "// Tell the widget manager whether this event occurred within the bounds\r", "// of this widget.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "ulMsg", "type": "unsigned long" }, { "param": "lX", "type": "long" }, { "param": "lY", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsg", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lX", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lY", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetMsgProc
null
long JPEGWidgetMsgProc(tWidget *pWidget, unsigned long ulMsg, unsigned long ulParam1, unsigned long ulParam2) { // // Check the arguments. // ASSERT(pWidget); // // Determine which message is being sent. // switch(ulMsg) { // // The widget paint request has been sent. // case WIDGET_MSG_PAINT: { // // Handle the widget paint request. // JPEGWidgetPaint(pWidget); // // Return one to indicate that the message was successfully // processed. // return(1); } // // One of the pointer requests has been sent. // case WIDGET_MSG_PTR_DOWN: case WIDGET_MSG_PTR_MOVE: case WIDGET_MSG_PTR_UP: { // // Handle the pointer request, returning the appropriate value. // return(JPEGWidgetClick(pWidget, ulMsg, ulParam1, ulParam2)); } // // An unknown request has been sent. // default: { // // Let the default message handler process this message. // return(WidgetDefaultMsgProc(pWidget, ulMsg, ulParam1, ulParam2)); } } }
//***************************************************************************** // //! Handles messages for a JPEG widget. //! //! \param pWidget is a pointer to the JPEG widget. //! \param ulMsg is the message. //! \param ulParam1 is the first parameter to the message. //! \param ulParam2 is the second parameter to the message. //! //! This function receives messages intended for this JPEG widget and //! processes them accordingly. The processing of the message varies based on //! the message in question. //! //! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). //! //! \return Returns a value appropriate to the supplied message. // //*****************************************************************************
Handles messages for a JPEG widget. \param pWidget is a pointer to the JPEG widget. \param ulMsg is the message. \param ulParam1 is the first parameter to the message. \param ulParam2 is the second parameter to the message. This function receives messages intended for this JPEG widget and processes them accordingly. The processing of the message varies based on the message in question. Unrecognized messages are handled by calling WidgetDefaultMsgProc(). \return Returns a value appropriate to the supplied message.
[ "Handles", "messages", "for", "a", "JPEG", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", ".", "\\", "param", "ulMsg", "is", "the", "message", ".", "\\", "param", "ulParam1", "is", "the", "first", "parameter", "to", "the", "message", ".", "\\", "param", "ulParam2", "is", "the", "second", "parameter", "to", "the", "message", ".", "This", "function", "receives", "messages", "intended", "for", "this", "JPEG", "widget", "and", "processes", "them", "accordingly", ".", "The", "processing", "of", "the", "message", "varies", "based", "on", "the", "message", "in", "question", ".", "Unrecognized", "messages", "are", "handled", "by", "calling", "WidgetDefaultMsgProc", "()", ".", "\\", "return", "Returns", "a", "value", "appropriate", "to", "the", "supplied", "message", "." ]
long JPEGWidgetMsgProc(tWidget *pWidget, unsigned long ulMsg, unsigned long ulParam1, unsigned long ulParam2) { ASSERT(pWidget); switch(ulMsg) { case WIDGET_MSG_PAINT: { JPEGWidgetPaint(pWidget); return(1); } case WIDGET_MSG_PTR_DOWN: case WIDGET_MSG_PTR_MOVE: case WIDGET_MSG_PTR_UP: { return(JPEGWidgetClick(pWidget, ulMsg, ulParam1, ulParam2)); } default: { return(WidgetDefaultMsgProc(pWidget, ulMsg, ulParam1, ulParam2)); } } }
[ "long", "JPEGWidgetMsgProc", "(", "tWidget", "*", "pWidget", ",", "unsigned", "long", "ulMsg", ",", "unsigned", "long", "ulParam1", ",", "unsigned", "long", "ulParam2", ")", "{", "ASSERT", "(", "pWidget", ")", ";", "switch", "(", "ulMsg", ")", "{", "case", "WIDGET_MSG_PAINT", ":", "{", "JPEGWidgetPaint", "(", "pWidget", ")", ";", "return", "(", "1", ")", ";", "}", "case", "WIDGET_MSG_PTR_DOWN", ":", "case", "WIDGET_MSG_PTR_MOVE", ":", "case", "WIDGET_MSG_PTR_UP", ":", "{", "return", "(", "JPEGWidgetClick", "(", "pWidget", ",", "ulMsg", ",", "ulParam1", ",", "ulParam2", ")", ")", ";", "}", "default", ":", "{", "return", "(", "WidgetDefaultMsgProc", "(", "pWidget", ",", "ulMsg", ",", "ulParam1", ",", "ulParam2", ")", ")", ";", "}", "}", "}" ]
Handles messages for a JPEG widget.
[ "Handles", "messages", "for", "a", "JPEG", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Determine which message is being sent.\r", "//\r", "//\r", "// The widget paint request has been sent.\r", "//\r", "//\r", "// Handle the widget paint request.\r", "//\r", "//\r", "// Return one to indicate that the message was successfully\r", "// processed.\r", "//\r", "//\r", "// One of the pointer requests has been sent.\r", "//\r", "//\r", "// Handle the pointer request, returning the appropriate value.\r", "//\r", "//\r", "// An unknown request has been sent.\r", "//\r", "//\r", "// Let the default message handler process this message.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "ulMsg", "type": "unsigned long" }, { "param": "ulParam1", "type": "unsigned long" }, { "param": "ulParam2", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsg", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulParam1", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulParam2", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetInit
void
void JPEGWidgetInit(tJPEGWidget *pWidget, const tDisplay *pDisplay, long lX, long lY, long lWidth, long lHeight) { unsigned long ulIdx; // // Check the arguments. // ASSERT(pWidget); ASSERT(pDisplay); // // Clear out the widget structure. // for(ulIdx = 0; ulIdx < sizeof(tJPEGWidget); ulIdx += 4) { ((unsigned long *)pWidget)[ulIdx / 4] = 0; } // // Set the size of the JPEG widget structure. // pWidget->sBase.lSize = sizeof(tJPEGWidget); // // Mark this widget as fully disconnected. // pWidget->sBase.pParent = 0; pWidget->sBase.pNext = 0; pWidget->sBase.pChild = 0; // // Save the display pointer. // pWidget->sBase.pDisplay = pDisplay; // // Set the extents of this rectangular JPEG widget. // pWidget->sBase.sPosition.sXMin = lX; pWidget->sBase.sPosition.sYMin = lY; pWidget->sBase.sPosition.sXMax = lX + lWidth - 1; pWidget->sBase.sPosition.sYMax = lY + lHeight - 1; // // Use the JPEG widget message handler to process messages to // this JPEG widget. // pWidget->sBase.pfnMsgProc = JPEGWidgetMsgProc; }
//***************************************************************************** // //! Initializes a JPEG widget. //! //! \param pWidget is a pointer to the JPEG widget to initialize. //! \param pDisplay is a pointer to the display on which to draw the push //! button. //! \param lX is the X coordinate of the upper left corner of the JPEG widget. //! \param lY is the Y coordinate of the upper left corner of the JPEG widget. //! \param lWidth is the width of the JPEG widget. //! \param lHeight is the height of the JPEG widget. //! //! This function initializes the provided JPEG widget. The widget position //! is set and all styles and parameters set to 0. The caller must make use //! of the various widget functions to set any required parameters after //! making this call. //! //! \return None. // //*****************************************************************************
Initializes a JPEG widget. \param pWidget is a pointer to the JPEG widget to initialize. \param pDisplay is a pointer to the display on which to draw the push button. \param lX is the X coordinate of the upper left corner of the JPEG widget. \param lY is the Y coordinate of the upper left corner of the JPEG widget. \param lWidth is the width of the JPEG widget. \param lHeight is the height of the JPEG widget. This function initializes the provided JPEG widget. The widget position is set and all styles and parameters set to 0. The caller must make use of the various widget functions to set any required parameters after making this call. \return None.
[ "Initializes", "a", "JPEG", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", "to", "initialize", ".", "\\", "param", "pDisplay", "is", "a", "pointer", "to", "the", "display", "on", "which", "to", "draw", "the", "push", "button", ".", "\\", "param", "lX", "is", "the", "X", "coordinate", "of", "the", "upper", "left", "corner", "of", "the", "JPEG", "widget", ".", "\\", "param", "lY", "is", "the", "Y", "coordinate", "of", "the", "upper", "left", "corner", "of", "the", "JPEG", "widget", ".", "\\", "param", "lWidth", "is", "the", "width", "of", "the", "JPEG", "widget", ".", "\\", "param", "lHeight", "is", "the", "height", "of", "the", "JPEG", "widget", ".", "This", "function", "initializes", "the", "provided", "JPEG", "widget", ".", "The", "widget", "position", "is", "set", "and", "all", "styles", "and", "parameters", "set", "to", "0", ".", "The", "caller", "must", "make", "use", "of", "the", "various", "widget", "functions", "to", "set", "any", "required", "parameters", "after", "making", "this", "call", ".", "\\", "return", "None", "." ]
void JPEGWidgetInit(tJPEGWidget *pWidget, const tDisplay *pDisplay, long lX, long lY, long lWidth, long lHeight) { unsigned long ulIdx; ASSERT(pWidget); ASSERT(pDisplay); for(ulIdx = 0; ulIdx < sizeof(tJPEGWidget); ulIdx += 4) { ((unsigned long *)pWidget)[ulIdx / 4] = 0; } pWidget->sBase.lSize = sizeof(tJPEGWidget); pWidget->sBase.pParent = 0; pWidget->sBase.pNext = 0; pWidget->sBase.pChild = 0; pWidget->sBase.pDisplay = pDisplay; pWidget->sBase.sPosition.sXMin = lX; pWidget->sBase.sPosition.sYMin = lY; pWidget->sBase.sPosition.sXMax = lX + lWidth - 1; pWidget->sBase.sPosition.sYMax = lY + lHeight - 1; pWidget->sBase.pfnMsgProc = JPEGWidgetMsgProc; }
[ "void", "JPEGWidgetInit", "(", "tJPEGWidget", "*", "pWidget", ",", "const", "tDisplay", "*", "pDisplay", ",", "long", "lX", ",", "long", "lY", ",", "long", "lWidth", ",", "long", "lHeight", ")", "{", "unsigned", "long", "ulIdx", ";", "ASSERT", "(", "pWidget", ")", ";", "ASSERT", "(", "pDisplay", ")", ";", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "sizeof", "(", "tJPEGWidget", ")", ";", "ulIdx", "+=", "4", ")", "{", "(", "(", "unsigned", "long", "*", ")", "pWidget", ")", "[", "ulIdx", "/", "4", "]", "=", "0", ";", "}", "pWidget", "->", "sBase", ".", "lSize", "=", "sizeof", "(", "tJPEGWidget", ")", ";", "pWidget", "->", "sBase", ".", "pParent", "=", "0", ";", "pWidget", "->", "sBase", ".", "pNext", "=", "0", ";", "pWidget", "->", "sBase", ".", "pChild", "=", "0", ";", "pWidget", "->", "sBase", ".", "pDisplay", "=", "pDisplay", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sXMin", "=", "lX", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sYMin", "=", "lY", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sXMax", "=", "lX", "+", "lWidth", "-", "1", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sYMax", "=", "lY", "+", "lHeight", "-", "1", ";", "pWidget", "->", "sBase", ".", "pfnMsgProc", "=", "JPEGWidgetMsgProc", ";", "}" ]
Initializes a JPEG widget.
[ "Initializes", "a", "JPEG", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Clear out the widget structure.\r", "//\r", "//\r", "// Set the size of the JPEG widget structure.\r", "//\r", "//\r", "// Mark this widget as fully disconnected.\r", "//\r", "//\r", "// Save the display pointer.\r", "//\r", "//\r", "// Set the extents of this rectangular JPEG widget.\r", "//\r", "//\r", "// Use the JPEG widget message handler to process messages to\r", "// this JPEG widget.\r", "//\r" ]
[ { "param": "pWidget", "type": "tJPEGWidget" }, { "param": "pDisplay", "type": "tDisplay" }, { "param": "lX", "type": "long" }, { "param": "lY", "type": "long" }, { "param": "lWidth", "type": "long" }, { "param": "lHeight", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tJPEGWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pDisplay", "type": "tDisplay", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lX", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lY", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lWidth", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lHeight", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetImageSet
null
long JPEGWidgetImageSet(tWidget *pWidget, const unsigned char *pImg, unsigned long ulImgLen) { tJPEGWidget *pJPEG; // // Check the arguments. // ASSERT(pWidget); ASSERT(pImg); ASSERT(ulImgLen); // // Convert the generic widget pointer into a JPEG widget pointer. // pJPEG = (tJPEGWidget *)pWidget; // // Discard any existing image. // JPEGWidgetImageDiscard(pWidget); // // Store the new image information. // pJPEG->ulImageLen = ulImgLen; pJPEG->pucImage = pImg; // // Decompress the new image. // return(JPEGDecompressImage(pJPEG)); }
//***************************************************************************** // //! Pass a new compressed image to the widget. //! //! \param pWidget is a pointer to the JPEG widget whose image is to be //! set. //! \param pImg is a pointer to the compressed JPEG data for the image. //! \param ulImgLen is the number of bytes of data pointed to by pImg. //! //! This function is used to change the image displayed by a JPEG widget. It is //! safe to call it when the widget is already displaying an image since it //! will free any existing image before decompressing the new one. The client //! is responsible for repainting the widget after this call is made. //! //! \return Returns 0 on success. Any other return code indicates failure. // //*****************************************************************************
Pass a new compressed image to the widget. \param pWidget is a pointer to the JPEG widget whose image is to be set. \param pImg is a pointer to the compressed JPEG data for the image. \param ulImgLen is the number of bytes of data pointed to by pImg. This function is used to change the image displayed by a JPEG widget. It is safe to call it when the widget is already displaying an image since it will free any existing image before decompressing the new one. The client is responsible for repainting the widget after this call is made. \return Returns 0 on success. Any other return code indicates failure.
[ "Pass", "a", "new", "compressed", "image", "to", "the", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", "whose", "image", "is", "to", "be", "set", ".", "\\", "param", "pImg", "is", "a", "pointer", "to", "the", "compressed", "JPEG", "data", "for", "the", "image", ".", "\\", "param", "ulImgLen", "is", "the", "number", "of", "bytes", "of", "data", "pointed", "to", "by", "pImg", ".", "This", "function", "is", "used", "to", "change", "the", "image", "displayed", "by", "a", "JPEG", "widget", ".", "It", "is", "safe", "to", "call", "it", "when", "the", "widget", "is", "already", "displaying", "an", "image", "since", "it", "will", "free", "any", "existing", "image", "before", "decompressing", "the", "new", "one", ".", "The", "client", "is", "responsible", "for", "repainting", "the", "widget", "after", "this", "call", "is", "made", ".", "\\", "return", "Returns", "0", "on", "success", ".", "Any", "other", "return", "code", "indicates", "failure", "." ]
long JPEGWidgetImageSet(tWidget *pWidget, const unsigned char *pImg, unsigned long ulImgLen) { tJPEGWidget *pJPEG; ASSERT(pWidget); ASSERT(pImg); ASSERT(ulImgLen); pJPEG = (tJPEGWidget *)pWidget; JPEGWidgetImageDiscard(pWidget); pJPEG->ulImageLen = ulImgLen; pJPEG->pucImage = pImg; return(JPEGDecompressImage(pJPEG)); }
[ "long", "JPEGWidgetImageSet", "(", "tWidget", "*", "pWidget", ",", "const", "unsigned", "char", "*", "pImg", ",", "unsigned", "long", "ulImgLen", ")", "{", "tJPEGWidget", "*", "pJPEG", ";", "ASSERT", "(", "pWidget", ")", ";", "ASSERT", "(", "pImg", ")", ";", "ASSERT", "(", "ulImgLen", ")", ";", "pJPEG", "=", "(", "tJPEGWidget", "*", ")", "pWidget", ";", "JPEGWidgetImageDiscard", "(", "pWidget", ")", ";", "pJPEG", "->", "ulImageLen", "=", "ulImgLen", ";", "pJPEG", "->", "pucImage", "=", "pImg", ";", "return", "(", "JPEGDecompressImage", "(", "pJPEG", ")", ")", ";", "}" ]
Pass a new compressed image to the widget.
[ "Pass", "a", "new", "compressed", "image", "to", "the", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a JPEG widget pointer.\r", "//\r", "//\r", "// Discard any existing image.\r", "//\r", "//\r", "// Store the new image information.\r", "//\r", "//\r", "// Decompress the new image.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "pImg", "type": "unsigned char" }, { "param": "ulImgLen", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pImg", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulImgLen", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetImageDecompress
null
long JPEGWidgetImageDecompress(tWidget *pWidget) { tJPEGWidget *pJPEG; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a JPEG widget pointer. // pJPEG = (tJPEGWidget *)pWidget; // // Decompress the image. // return(JPEGDecompressImage(pJPEG)); }
//***************************************************************************** // //! Decompresses the image associated with a JPEG widget. //! //! \param pWidget is a pointer to the JPEG widget whose image is to be //! decompressed. //! //! This function must be called by the client for any JPEG widget whose //! compressed data pointer is initialized using the JPEGCanvas, JPEGButton //! or JPEGWidgetStruct macros. It decompresses the image and readies it //! for display. //! //! This function must NOT be used if the widget already holds a decompressed //! image (i.e. if this function has been called before or if a prior call //! has been made to JPEGWidgetImageSet() without a later call to //! JPEGWidgetImageDiscard()) since this will result in a serious memory leak. //! //! The client is responsible for repainting the widget after this call is //! made. //! //! \return Returns 0 on success. Any other return code indicates failure. // //*****************************************************************************
Decompresses the image associated with a JPEG widget. \param pWidget is a pointer to the JPEG widget whose image is to be decompressed. This function must be called by the client for any JPEG widget whose compressed data pointer is initialized using the JPEGCanvas, JPEGButton or JPEGWidgetStruct macros. It decompresses the image and readies it for display. This function must NOT be used if the widget already holds a decompressed image without a later call to JPEGWidgetImageDiscard()) since this will result in a serious memory leak. The client is responsible for repainting the widget after this call is made. \return Returns 0 on success. Any other return code indicates failure.
[ "Decompresses", "the", "image", "associated", "with", "a", "JPEG", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", "whose", "image", "is", "to", "be", "decompressed", ".", "This", "function", "must", "be", "called", "by", "the", "client", "for", "any", "JPEG", "widget", "whose", "compressed", "data", "pointer", "is", "initialized", "using", "the", "JPEGCanvas", "JPEGButton", "or", "JPEGWidgetStruct", "macros", ".", "It", "decompresses", "the", "image", "and", "readies", "it", "for", "display", ".", "This", "function", "must", "NOT", "be", "used", "if", "the", "widget", "already", "holds", "a", "decompressed", "image", "without", "a", "later", "call", "to", "JPEGWidgetImageDiscard", "()", ")", "since", "this", "will", "result", "in", "a", "serious", "memory", "leak", ".", "The", "client", "is", "responsible", "for", "repainting", "the", "widget", "after", "this", "call", "is", "made", ".", "\\", "return", "Returns", "0", "on", "success", ".", "Any", "other", "return", "code", "indicates", "failure", "." ]
long JPEGWidgetImageDecompress(tWidget *pWidget) { tJPEGWidget *pJPEG; ASSERT(pWidget); pJPEG = (tJPEGWidget *)pWidget; return(JPEGDecompressImage(pJPEG)); }
[ "long", "JPEGWidgetImageDecompress", "(", "tWidget", "*", "pWidget", ")", "{", "tJPEGWidget", "*", "pJPEG", ";", "ASSERT", "(", "pWidget", ")", ";", "pJPEG", "=", "(", "tJPEGWidget", "*", ")", "pWidget", ";", "return", "(", "JPEGDecompressImage", "(", "pJPEG", ")", ")", ";", "}" ]
Decompresses the image associated with a JPEG widget.
[ "Decompresses", "the", "image", "associated", "with", "a", "JPEG", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a JPEG widget pointer.\r", "//\r", "//\r", "// Decompress the image.\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": [] }
f4d60d996572eee13eb3b60c1a800e937b6c9806
junyanl-code/Luminary-Micro-Library
boards/dk-lm3s9b96/drivers/jpgwidget.c
[ "BSD-3-Clause" ]
C
JPEGWidgetImageDiscard
void
void JPEGWidgetImageDiscard(tWidget *pWidget) { tJPEGWidget *pJPEG; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a JPEG widget pointer. // pJPEG = (tJPEGWidget *)pWidget; // // Does this widget currently have a decompressed image? // if(pJPEG->psJPEGInst->pusImage) { // // Yes - free it up and clear all the image sizes back to zero. // ExtRAMFree(pJPEG->psJPEGInst->pusImage); pJPEG->psJPEGInst->pusImage = 0; pJPEG->psJPEGInst->usHeight = 0; pJPEG->psJPEGInst->usWidth = 0; } }
//***************************************************************************** // //! Frees any decompressed image held by the widget. //! //! \param pWidget is a pointer to the JPEG widget whose image is to be //! discarded. //! //! This function frees any decompressed image that is currently held by the //! widget and returns the memory it was occupying to the RAM heap. After //! this call, JPEGWidgetImageDecompress() may be called to re-decompress the //! same image or JPEGWidgetImageSet() can be called to have the widget //! decompress a new image. //! //! \return None. // //*****************************************************************************
Frees any decompressed image held by the widget. \param pWidget is a pointer to the JPEG widget whose image is to be discarded. This function frees any decompressed image that is currently held by the widget and returns the memory it was occupying to the RAM heap. After this call, JPEGWidgetImageDecompress() may be called to re-decompress the same image or JPEGWidgetImageSet() can be called to have the widget decompress a new image. \return None.
[ "Frees", "any", "decompressed", "image", "held", "by", "the", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "JPEG", "widget", "whose", "image", "is", "to", "be", "discarded", ".", "This", "function", "frees", "any", "decompressed", "image", "that", "is", "currently", "held", "by", "the", "widget", "and", "returns", "the", "memory", "it", "was", "occupying", "to", "the", "RAM", "heap", ".", "After", "this", "call", "JPEGWidgetImageDecompress", "()", "may", "be", "called", "to", "re", "-", "decompress", "the", "same", "image", "or", "JPEGWidgetImageSet", "()", "can", "be", "called", "to", "have", "the", "widget", "decompress", "a", "new", "image", ".", "\\", "return", "None", "." ]
void JPEGWidgetImageDiscard(tWidget *pWidget) { tJPEGWidget *pJPEG; ASSERT(pWidget); pJPEG = (tJPEGWidget *)pWidget; if(pJPEG->psJPEGInst->pusImage) { ExtRAMFree(pJPEG->psJPEGInst->pusImage); pJPEG->psJPEGInst->pusImage = 0; pJPEG->psJPEGInst->usHeight = 0; pJPEG->psJPEGInst->usWidth = 0; } }
[ "void", "JPEGWidgetImageDiscard", "(", "tWidget", "*", "pWidget", ")", "{", "tJPEGWidget", "*", "pJPEG", ";", "ASSERT", "(", "pWidget", ")", ";", "pJPEG", "=", "(", "tJPEGWidget", "*", ")", "pWidget", ";", "if", "(", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ")", "{", "ExtRAMFree", "(", "pJPEG", "->", "psJPEGInst", "->", "pusImage", ")", ";", "pJPEG", "->", "psJPEGInst", "->", "pusImage", "=", "0", ";", "pJPEG", "->", "psJPEGInst", "->", "usHeight", "=", "0", ";", "pJPEG", "->", "psJPEGInst", "->", "usWidth", "=", "0", ";", "}", "}" ]
Frees any decompressed image held by the widget.
[ "Frees", "any", "decompressed", "image", "held", "by", "the", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a JPEG widget pointer.\r", "//\r", "//\r", "// Does this widget currently have a decompressed image?\r", "//\r", "//\r", "// Yes - free it up and clear all the image sizes back to zero.\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": [] }
606898c4077f2457d0bb55a5ed0337cd097acdf0
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/udma_timer_ccp/udma_timer_ccp.c
[ "BSD-3-Clause" ]
C
Timer0BIntHandler
void
void Timer0BIntHandler(void) { unsigned long ulStatus; // // Clear the timer interrupt. // ROM_TimerIntClear(TIMER0_BASE, TIMER_CAPB_EVENT); // // Read the uDMA channel status to verify it is done // ulStatus = uDMAChannelModeGet(UDMA_CHANNEL_TMR0B); if(ulStatus == UDMA_MODE_STOP) { // // Disable the capture timer and set the done flag // ROM_TimerDisable(TIMER0_BASE, TIMER_B); g_bDoneFlag = 1; } // // Increment a counter to indicate the number of times this handler // was invoked // g_ulTimer0BIntCount++; }
//***************************************************************************** // // The interrupt handler for the Timer0B edge capture timer interrupt. When // the uDMA channel is used, interrupts from the capture timer are used as DMA // requests, and this interrupt handler is invoked only at the end of all of // the DMA transfers. // //*****************************************************************************
The interrupt handler for the Timer0B edge capture timer interrupt. When the uDMA channel is used, interrupts from the capture timer are used as DMA requests, and this interrupt handler is invoked only at the end of all of the DMA transfers.
[ "The", "interrupt", "handler", "for", "the", "Timer0B", "edge", "capture", "timer", "interrupt", ".", "When", "the", "uDMA", "channel", "is", "used", "interrupts", "from", "the", "capture", "timer", "are", "used", "as", "DMA", "requests", "and", "this", "interrupt", "handler", "is", "invoked", "only", "at", "the", "end", "of", "all", "of", "the", "DMA", "transfers", "." ]
void Timer0BIntHandler(void) { unsigned long ulStatus; ROM_TimerIntClear(TIMER0_BASE, TIMER_CAPB_EVENT); ulStatus = uDMAChannelModeGet(UDMA_CHANNEL_TMR0B); if(ulStatus == UDMA_MODE_STOP) { ROM_TimerDisable(TIMER0_BASE, TIMER_B); g_bDoneFlag = 1; } g_ulTimer0BIntCount++; }
[ "void", "Timer0BIntHandler", "(", "void", ")", "{", "unsigned", "long", "ulStatus", ";", "ROM_TimerIntClear", "(", "TIMER0_BASE", ",", "TIMER_CAPB_EVENT", ")", ";", "ulStatus", "=", "uDMAChannelModeGet", "(", "UDMA_CHANNEL_TMR0B", ")", ";", "if", "(", "ulStatus", "==", "UDMA_MODE_STOP", ")", "{", "ROM_TimerDisable", "(", "TIMER0_BASE", ",", "TIMER_B", ")", ";", "g_bDoneFlag", "=", "1", ";", "}", "g_ulTimer0BIntCount", "++", ";", "}" ]
The interrupt handler for the Timer0B edge capture timer interrupt.
[ "The", "interrupt", "handler", "for", "the", "Timer0B", "edge", "capture", "timer", "interrupt", "." ]
[ "//\r", "// Clear the timer interrupt.\r", "//\r", "//\r", "// Read the uDMA channel status to verify it is done\r", "//\r", "//\r", "// Disable the capture timer and set the done flag\r", "//\r", "//\r", "// Increment a counter to indicate the number of times this handler\r", "// was invoked\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
606898c4077f2457d0bb55a5ed0337cd097acdf0
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9d92/udma_timer_ccp/udma_timer_ccp.c
[ "BSD-3-Clause" ]
C
SetupSignalSource
void
static void SetupSignalSource(void) { // // Enable the GPIO port used for PWM0 output. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); // // Enable the PWM peripheral and configure the GPIO pin // used for PWM0. GPIO pin D0 is used for PWM0 output. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0); GPIOPinConfigure(GPIO_PD0_PWM0); GPIOPinTypePWM(GPIO_PORTD_BASE, GPIO_PIN_0); // // Configure the PWM0 output to generate a 50% square wave with a // period of 5000 processor cycles. // PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, TIMEOUT_VAL); PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, TIMEOUT_VAL / 2); PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, 1); PWMGenEnable(PWM0_BASE, PWM_GEN_0); }
//***************************************************************************** // // Set up the PWM0 output to be used as a signal source for the CCP1 input // pin. This example application uses PWM0 as the signal source in order // to demonstrate the CCP usage and also to provide a predictable timing // source that will produce known values for the capture timer. In a real // application some external signal would be used as the signal source for // the CCP input. // //*****************************************************************************
Set up the PWM0 output to be used as a signal source for the CCP1 input pin. This example application uses PWM0 as the signal source in order to demonstrate the CCP usage and also to provide a predictable timing source that will produce known values for the capture timer. In a real application some external signal would be used as the signal source for the CCP input.
[ "Set", "up", "the", "PWM0", "output", "to", "be", "used", "as", "a", "signal", "source", "for", "the", "CCP1", "input", "pin", ".", "This", "example", "application", "uses", "PWM0", "as", "the", "signal", "source", "in", "order", "to", "demonstrate", "the", "CCP", "usage", "and", "also", "to", "provide", "a", "predictable", "timing", "source", "that", "will", "produce", "known", "values", "for", "the", "capture", "timer", ".", "In", "a", "real", "application", "some", "external", "signal", "would", "be", "used", "as", "the", "signal", "source", "for", "the", "CCP", "input", "." ]
static void SetupSignalSource(void) { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_PWM0); GPIOPinConfigure(GPIO_PD0_PWM0); GPIOPinTypePWM(GPIO_PORTD_BASE, GPIO_PIN_0); PWMGenConfigure(PWM0_BASE, PWM_GEN_0, PWM_GEN_MODE_DOWN); PWMGenPeriodSet(PWM0_BASE, PWM_GEN_0, TIMEOUT_VAL); PWMPulseWidthSet(PWM0_BASE, PWM_OUT_0, TIMEOUT_VAL / 2); PWMOutputState(PWM0_BASE, PWM_OUT_0_BIT, 1); PWMGenEnable(PWM0_BASE, PWM_GEN_0); }
[ "static", "void", "SetupSignalSource", "(", "void", ")", "{", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOD", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_PWM0", ")", ";", "GPIOPinConfigure", "(", "GPIO_PD0_PWM0", ")", ";", "GPIOPinTypePWM", "(", "GPIO_PORTD_BASE", ",", "GPIO_PIN_0", ")", ";", "PWMGenConfigure", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "PWM_GEN_MODE_DOWN", ")", ";", "PWMGenPeriodSet", "(", "PWM0_BASE", ",", "PWM_GEN_0", ",", "TIMEOUT_VAL", ")", ";", "PWMPulseWidthSet", "(", "PWM0_BASE", ",", "PWM_OUT_0", ",", "TIMEOUT_VAL", "/", "2", ")", ";", "PWMOutputState", "(", "PWM0_BASE", ",", "PWM_OUT_0_BIT", ",", "1", ")", ";", "PWMGenEnable", "(", "PWM0_BASE", ",", "PWM_GEN_0", ")", ";", "}" ]
Set up the PWM0 output to be used as a signal source for the CCP1 input pin.
[ "Set", "up", "the", "PWM0", "output", "to", "be", "used", "as", "a", "signal", "source", "for", "the", "CCP1", "input", "pin", "." ]
[ "//\r", "// Enable the GPIO port used for PWM0 output.\r", "//\r", "//\r", "// Enable the PWM peripheral and configure the GPIO pin\r", "// used for PWM0. GPIO pin D0 is used for PWM0 output.\r", "//\r", "//\r", "// Configure the PWM0 output to generate a 50% square wave with a\r", "// period of 5000 processor cycles.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
28e04846ce231481f8bc315d5cbea9c53e07ef7f
junyanl-code/Luminary-Micro-Library
boards/mdl-lm3s818cncd/uart_echo/uart_echo.c
[ "BSD-3-Clause" ]
C
UARTSend
void
void UARTSend(const unsigned char *pucBuffer, unsigned long ulCount) { // // Loop while there are more characters to send. // while(ulCount--) { // // Write the next character to the UART. // UARTCharPutNonBlocking(UART0_BASE, *pucBuffer++); } }
//***************************************************************************** // // Send a string to the UART. // //*****************************************************************************
Send a string to the UART.
[ "Send", "a", "string", "to", "the", "UART", "." ]
void UARTSend(const unsigned char *pucBuffer, unsigned long ulCount) { while(ulCount--) { UARTCharPutNonBlocking(UART0_BASE, *pucBuffer++); } }
[ "void", "UARTSend", "(", "const", "unsigned", "char", "*", "pucBuffer", ",", "unsigned", "long", "ulCount", ")", "{", "while", "(", "ulCount", "--", ")", "{", "UARTCharPutNonBlocking", "(", "UART0_BASE", ",", "*", "pucBuffer", "++", ")", ";", "}", "}" ]
Send a string to the UART.
[ "Send", "a", "string", "to", "the", "UART", "." ]
[ "//\r", "// Loop while there are more characters to send.\r", "//\r", "//\r", "// Write the next character to the UART.\r", "//\r" ]
[ { "param": "pucBuffer", "type": "unsigned char" }, { "param": "ulCount", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pucBuffer", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulCount", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
AudioCallback
void
static void AudioCallback(void *pvBuffer, unsigned long ulParam, unsigned long ulEvent) { switch(ulEvent) { // // New USB audio device has been enabled. // case USBH_AUDIO_EVENT_OPEN: { // // Set the EVENT_OPEN flag and let the main routine handle it. // HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_OPEN) = 1; break; } // // USB audio device has been removed. // case USBH_AUDIO_EVENT_CLOSE: { // // Set the EVENT_CLOSE flag and let the main routine handle it. // HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_CLOSE) = 1; break; } default: { } } }
//***************************************************************************** // // This function was the callback function registered with the USB host audio // class driver. The only two events that are handled at this point are the // USBH_AUDIO_EVENT_OPEN and USBH_AUDIO_EVENT_CLOSE which indicate that a new // audio device has been found or that an existing audio device has been // disconnected. // //*****************************************************************************
This function was the callback function registered with the USB host audio class driver. The only two events that are handled at this point are the USBH_AUDIO_EVENT_OPEN and USBH_AUDIO_EVENT_CLOSE which indicate that a new audio device has been found or that an existing audio device has been disconnected.
[ "This", "function", "was", "the", "callback", "function", "registered", "with", "the", "USB", "host", "audio", "class", "driver", ".", "The", "only", "two", "events", "that", "are", "handled", "at", "this", "point", "are", "the", "USBH_AUDIO_EVENT_OPEN", "and", "USBH_AUDIO_EVENT_CLOSE", "which", "indicate", "that", "a", "new", "audio", "device", "has", "been", "found", "or", "that", "an", "existing", "audio", "device", "has", "been", "disconnected", "." ]
static void AudioCallback(void *pvBuffer, unsigned long ulParam, unsigned long ulEvent) { switch(ulEvent) { New USB audio device has been enabled. case USBH_AUDIO_EVENT_OPEN: { Set the EVENT_OPEN flag and let the main routine handle it. HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_OPEN) = 1; break; } USB audio device has been removed. case USBH_AUDIO_EVENT_CLOSE: { Set the EVENT_CLOSE flag and let the main routine handle it. HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_CLOSE) = 1; break; } default: { } } }
[ "static", "void", "AudioCallback", "(", "void", "*", "pvBuffer", ",", "unsigned", "long", "ulParam", ",", "unsigned", "long", "ulEvent", ")", "{", "switch", "(", "ulEvent", ")", "{", "case", "USBH_AUDIO_EVENT_OPEN", ":", "{", "HWREGBITW", "(", "&", "g_sAudioState", ".", "ulEventFlags", ",", "EVENT_OPEN", ")", "=", "1", ";", "break", ";", "}", "case", "USBH_AUDIO_EVENT_CLOSE", ":", "{", "HWREGBITW", "(", "&", "g_sAudioState", ".", "ulEventFlags", ",", "EVENT_CLOSE", ")", "=", "1", ";", "break", ";", "}", "default", ":", "{", "}", "}", "}" ]
This function was the callback function registered with the USB host audio class driver.
[ "This", "function", "was", "the", "callback", "function", "registered", "with", "the", "USB", "host", "audio", "class", "driver", "." ]
[ "//", "// New USB audio device has been enabled.", "//", "//", "// Set the EVENT_OPEN flag and let the main routine handle it.", "//", "//", "// USB audio device has been removed.", "//", "//", "// Set the EVENT_CLOSE flag and let the main routine handle it.", "//" ]
[ { "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": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundInit
void
void USBSoundInit(unsigned long ulFlags, tEventCallback pfnCallback) { // // Enable the peripherals used by this example. // SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Set the USB power pins to be controlled by the USB controller. // GPIOPinTypeUSBDigital(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7); // // Enable the uDMA controller and set up the control table base. // SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); uDMAEnable(); uDMAControlBaseSet(g_sDMAControlTable); // // Initialize the USB stack mode to OTG. // USBStackModeSet(0, USB_MODE_OTG, 0); // // Register the host class drivers. // USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ulNumHostClassDrivers); // // Open an instance of the audio class driver. // g_ulAudioInstance = USBHostAudioOpen(0, AudioCallback); // // 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); // // Initialize the USB controller for OTG operation with a 2ms polling // rate. // USBOTGModeInit(0, 2000, g_pHCDPool, HCD_MEMORY_SIZE); // // Save the event callback function. // g_sAudioState.pfnCallbackEvent = pfnCallback; }
//***************************************************************************** // // Initializes the sound output. // // \param ulFlags is unused as this point but is included for future // functionality. // \param pfnCallback is the event callback function for audio devices. // // This function prepares the sound driver to enumerate an audio device and // prepares to play audio once a valid audio device is detected. The // \e pfnCallback function can be used to receive callbacks when there are // changes related to the audio device. The ulEvent parameter to the callback // will be one of the SOUND_EVENT_* values. // // \return None // //*****************************************************************************
Initializes the sound output. \param ulFlags is unused as this point but is included for future functionality. \param pfnCallback is the event callback function for audio devices. This function prepares the sound driver to enumerate an audio device and prepares to play audio once a valid audio device is detected. The \e pfnCallback function can be used to receive callbacks when there are changes related to the audio device. The ulEvent parameter to the callback will be one of the SOUND_EVENT_* values. \return None
[ "Initializes", "the", "sound", "output", ".", "\\", "param", "ulFlags", "is", "unused", "as", "this", "point", "but", "is", "included", "for", "future", "functionality", ".", "\\", "param", "pfnCallback", "is", "the", "event", "callback", "function", "for", "audio", "devices", ".", "This", "function", "prepares", "the", "sound", "driver", "to", "enumerate", "an", "audio", "device", "and", "prepares", "to", "play", "audio", "once", "a", "valid", "audio", "device", "is", "detected", ".", "The", "\\", "e", "pfnCallback", "function", "can", "be", "used", "to", "receive", "callbacks", "when", "there", "are", "changes", "related", "to", "the", "audio", "device", ".", "The", "ulEvent", "parameter", "to", "the", "callback", "will", "be", "one", "of", "the", "SOUND_EVENT_", "*", "values", ".", "\\", "return", "None" ]
void USBSoundInit(unsigned long ulFlags, tEventCallback pfnCallback) { Enable the peripherals used by this example. SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); Set the USB power pins to be controlled by the USB controller. GPIOPinTypeUSBDigital(GPIO_PORTA_BASE, GPIO_PIN_6 | GPIO_PIN_7); Enable the uDMA controller and set up the control table base. SysCtlPeripheralEnable(SYSCTL_PERIPH_UDMA); uDMAEnable(); uDMAControlBaseSet(g_sDMAControlTable); Initialize the USB stack mode to OTG. USBStackModeSet(0, USB_MODE_OTG, 0); Register the host class drivers. USBHCDRegisterDrivers(0, g_ppHostClassDrivers, g_ulNumHostClassDrivers); Open an instance of the audio class driver. g_ulAudioInstance = USBHostAudioOpen(0, AudioCallback); 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); Initialize the USB controller for OTG operation with a 2ms polling rate. USBOTGModeInit(0, 2000, g_pHCDPool, HCD_MEMORY_SIZE); Save the event callback function. g_sAudioState.pfnCallbackEvent = pfnCallback; }
[ "void", "USBSoundInit", "(", "unsigned", "long", "ulFlags", ",", "tEventCallback", "pfnCallback", ")", "{", "SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOA", ")", ";", "GPIOPinTypeUSBDigital", "(", "GPIO_PORTA_BASE", ",", "GPIO_PIN_6", "|", "GPIO_PIN_7", ")", ";", "SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_UDMA", ")", ";", "uDMAEnable", "(", ")", ";", "uDMAControlBaseSet", "(", "g_sDMAControlTable", ")", ";", "USBStackModeSet", "(", "0", ",", "USB_MODE_OTG", ",", "0", ")", ";", "USBHCDRegisterDrivers", "(", "0", ",", "g_ppHostClassDrivers", ",", "g_ulNumHostClassDrivers", ")", ";", "g_ulAudioInstance", "=", "USBHostAudioOpen", "(", "0", ",", "AudioCallback", ")", ";", "USBHCDPowerConfigInit", "(", "0", ",", "USBHCD_VBUS_AUTO_HIGH", "|", "USBHCD_VBUS_FILTER", ")", ";", "USBOTGModeInit", "(", "0", ",", "2000", ",", "g_pHCDPool", ",", "HCD_MEMORY_SIZE", ")", ";", "g_sAudioState", ".", "pfnCallbackEvent", "=", "pfnCallback", ";", "}" ]
Initializes the sound output.
[ "Initializes", "the", "sound", "output", "." ]
[ "//", "// Enable the peripherals used by this example.", "//", "//", "// Set the USB power pins to be controlled by the USB controller.", "//", "//", "// Enable the uDMA controller and set up the control table base.", "//", "//", "// Initialize the USB stack mode to OTG.", "//", "//", "// Register the host class drivers.", "//", "//", "// Open an instance of the audio class driver.", "//", "//", "// Initialize the power configuration. This sets the power enable signal", "// to be active high and does not enable the power fault.", "//", "//", "// Initialize the USB controller for OTG operation with a 2ms polling", "// rate.", "//", "//", "// Save the event callback function.", "//" ]
[ { "param": "ulFlags", "type": "unsigned long" }, { "param": "pfnCallback", "type": "tEventCallback" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulFlags", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pfnCallback", "type": "tEventCallback", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundVolumeGet
null
unsigned long USBSoundVolumeGet(unsigned long ulChannel) { unsigned long ulVolume; // // Initialize the return value in case there is no USB device present. // ulVolume = 0xffffffff; // // Ignore volume request if there is no device present. // if(g_sAudioState.eState == STATE_DEVICE_READY) { ulVolume = USBHostAudioVolumeGet(g_ulAudioInstance, 0, ulChannel); } return(ulVolume); }
//***************************************************************************** // // Returns the current volume level. // // \param ulChannel is the 0 based channel number to query. // // This function returns the current volume, specified as a percentage between // 0% (silence) and 100% (full volume), inclusive. The \e ulChannel value // starts with 0 which is the master audio volume control interface. The // remaining \e ulChannel values provide access to various other audio // channels, with 1 and 2 being left and right audio channels. // // \return Returns the current volume. // //*****************************************************************************
Returns the current volume level. \param ulChannel is the 0 based channel number to query. This function returns the current volume, specified as a percentage between 0% (silence) and 100% (full volume), inclusive. The \e ulChannel value starts with 0 which is the master audio volume control interface. The remaining \e ulChannel values provide access to various other audio channels, with 1 and 2 being left and right audio channels. \return Returns the current volume.
[ "Returns", "the", "current", "volume", "level", ".", "\\", "param", "ulChannel", "is", "the", "0", "based", "channel", "number", "to", "query", ".", "This", "function", "returns", "the", "current", "volume", "specified", "as", "a", "percentage", "between", "0%", "(", "silence", ")", "and", "100%", "(", "full", "volume", ")", "inclusive", ".", "The", "\\", "e", "ulChannel", "value", "starts", "with", "0", "which", "is", "the", "master", "audio", "volume", "control", "interface", ".", "The", "remaining", "\\", "e", "ulChannel", "values", "provide", "access", "to", "various", "other", "audio", "channels", "with", "1", "and", "2", "being", "left", "and", "right", "audio", "channels", ".", "\\", "return", "Returns", "the", "current", "volume", "." ]
unsigned long USBSoundVolumeGet(unsigned long ulChannel) { unsigned long ulVolume; Initialize the return value in case there is no USB device present. ulVolume = 0xffffffff; Ignore volume request if there is no device present. if(g_sAudioState.eState == STATE_DEVICE_READY) { ulVolume = USBHostAudioVolumeGet(g_ulAudioInstance, 0, ulChannel); } return(ulVolume); }
[ "unsigned", "long", "USBSoundVolumeGet", "(", "unsigned", "long", "ulChannel", ")", "{", "unsigned", "long", "ulVolume", ";", "ulVolume", "=", "0xffffffff", ";", "if", "(", "g_sAudioState", ".", "eState", "==", "STATE_DEVICE_READY", ")", "{", "ulVolume", "=", "USBHostAudioVolumeGet", "(", "g_ulAudioInstance", ",", "0", ",", "ulChannel", ")", ";", "}", "return", "(", "ulVolume", ")", ";", "}" ]
Returns the current volume level.
[ "Returns", "the", "current", "volume", "level", "." ]
[ "//", "// Initialize the return value in case there is no USB device present.", "//", "//", "// Ignore volume request if there is no device present.", "//" ]
[ { "param": "ulChannel", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulChannel", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundOutputFormatSet
null
unsigned long USBSoundOutputFormatSet(unsigned long ulSampleRate, unsigned long ulBitsPerSample, unsigned long ulChannels) { // // Just return if there is no device at this time. // if(g_sAudioState.eState != STATE_DEVICE_READY) { return(1); } // // Call the USB Host Audio function to set the format. // return(USBHostAudioFormatSet(g_ulAudioInstance, ulSampleRate, ulBitsPerSample, ulChannels, USBH_AUDIO_FORMAT_OUT)); }
//***************************************************************************** // // This will set the current output audio format of the USB audio device. // // \param ulSampleRate is the sample rate. // \param ulBitsPerSample is the number of bits per sample. // \param ulChannels is the number of channels. // // This sets the current audio format for the USB device that is currently // connected. If there is no USB device connected or the format is not // supported then the function will return a non-zero value. The function // will return zero if the USB audio device was successfully configured to the // requested audio format. // // \return Returns zero if the format was successfully set or returns an // non-zero value if the format was not able to be set. // //*****************************************************************************
This will set the current output audio format of the USB audio device. \param ulSampleRate is the sample rate. \param ulBitsPerSample is the number of bits per sample. \param ulChannels is the number of channels. This sets the current audio format for the USB device that is currently connected. If there is no USB device connected or the format is not supported then the function will return a non-zero value. The function will return zero if the USB audio device was successfully configured to the requested audio format. \return Returns zero if the format was successfully set or returns an non-zero value if the format was not able to be set.
[ "This", "will", "set", "the", "current", "output", "audio", "format", "of", "the", "USB", "audio", "device", ".", "\\", "param", "ulSampleRate", "is", "the", "sample", "rate", ".", "\\", "param", "ulBitsPerSample", "is", "the", "number", "of", "bits", "per", "sample", ".", "\\", "param", "ulChannels", "is", "the", "number", "of", "channels", ".", "This", "sets", "the", "current", "audio", "format", "for", "the", "USB", "device", "that", "is", "currently", "connected", ".", "If", "there", "is", "no", "USB", "device", "connected", "or", "the", "format", "is", "not", "supported", "then", "the", "function", "will", "return", "a", "non", "-", "zero", "value", ".", "The", "function", "will", "return", "zero", "if", "the", "USB", "audio", "device", "was", "successfully", "configured", "to", "the", "requested", "audio", "format", ".", "\\", "return", "Returns", "zero", "if", "the", "format", "was", "successfully", "set", "or", "returns", "an", "non", "-", "zero", "value", "if", "the", "format", "was", "not", "able", "to", "be", "set", "." ]
unsigned long USBSoundOutputFormatSet(unsigned long ulSampleRate, unsigned long ulBitsPerSample, unsigned long ulChannels) { Just return if there is no device at this time. if(g_sAudioState.eState != STATE_DEVICE_READY) { return(1); } Call the USB Host Audio function to set the format. return(USBHostAudioFormatSet(g_ulAudioInstance, ulSampleRate, ulBitsPerSample, ulChannels, USBH_AUDIO_FORMAT_OUT)); }
[ "unsigned", "long", "USBSoundOutputFormatSet", "(", "unsigned", "long", "ulSampleRate", ",", "unsigned", "long", "ulBitsPerSample", ",", "unsigned", "long", "ulChannels", ")", "{", "if", "(", "g_sAudioState", ".", "eState", "!=", "STATE_DEVICE_READY", ")", "{", "return", "(", "1", ")", ";", "}", "return", "(", "USBHostAudioFormatSet", "(", "g_ulAudioInstance", ",", "ulSampleRate", ",", "ulBitsPerSample", ",", "ulChannels", ",", "USBH_AUDIO_FORMAT_OUT", ")", ")", ";", "}" ]
This will set the current output audio format of the USB audio device.
[ "This", "will", "set", "the", "current", "output", "audio", "format", "of", "the", "USB", "audio", "device", "." ]
[ "//", "// Just return if there is no device at this time.", "//", "//", "// Call the USB Host Audio function to set the format.", "//" ]
[ { "param": "ulSampleRate", "type": "unsigned long" }, { "param": "ulBitsPerSample", "type": "unsigned long" }, { "param": "ulChannels", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulSampleRate", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulBitsPerSample", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulChannels", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundInputFormatSet
null
unsigned long USBSoundInputFormatSet(unsigned long ulSampleRate, unsigned long ulBitsPerSample, unsigned long ulChannels) { // // Just return if there is no device at this time. // if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } return(USBHostAudioFormatSet(g_ulAudioInstance, ulSampleRate, ulBitsPerSample, ulChannels, USBH_AUDIO_FORMAT_IN)); }
//***************************************************************************** // // This will set the current input audio format of the USB audio device // // \param ulSampleRate is the sample rate. // \param ulBitsPerSample is the number of bits per sample. // \param ulChannels is the number of channels. // // This sets the current format for the USB device that is currently connect. // If there is no USB device connected or the format is not supported then the // function will return 0. The function will return 1 if the USB audio device // was successfully configured to the requested format. // // \return Returns 1 if the format was successfully set or returns 0 if the // format was not changed. // //*****************************************************************************
This will set the current input audio format of the USB audio device \param ulSampleRate is the sample rate. \param ulBitsPerSample is the number of bits per sample. \param ulChannels is the number of channels. This sets the current format for the USB device that is currently connect. If there is no USB device connected or the format is not supported then the function will return 0. The function will return 1 if the USB audio device was successfully configured to the requested format. \return Returns 1 if the format was successfully set or returns 0 if the format was not changed.
[ "This", "will", "set", "the", "current", "input", "audio", "format", "of", "the", "USB", "audio", "device", "\\", "param", "ulSampleRate", "is", "the", "sample", "rate", ".", "\\", "param", "ulBitsPerSample", "is", "the", "number", "of", "bits", "per", "sample", ".", "\\", "param", "ulChannels", "is", "the", "number", "of", "channels", ".", "This", "sets", "the", "current", "format", "for", "the", "USB", "device", "that", "is", "currently", "connect", ".", "If", "there", "is", "no", "USB", "device", "connected", "or", "the", "format", "is", "not", "supported", "then", "the", "function", "will", "return", "0", ".", "The", "function", "will", "return", "1", "if", "the", "USB", "audio", "device", "was", "successfully", "configured", "to", "the", "requested", "format", ".", "\\", "return", "Returns", "1", "if", "the", "format", "was", "successfully", "set", "or", "returns", "0", "if", "the", "format", "was", "not", "changed", "." ]
unsigned long USBSoundInputFormatSet(unsigned long ulSampleRate, unsigned long ulBitsPerSample, unsigned long ulChannels) { Just return if there is no device at this time. if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } return(USBHostAudioFormatSet(g_ulAudioInstance, ulSampleRate, ulBitsPerSample, ulChannels, USBH_AUDIO_FORMAT_IN)); }
[ "unsigned", "long", "USBSoundInputFormatSet", "(", "unsigned", "long", "ulSampleRate", ",", "unsigned", "long", "ulBitsPerSample", ",", "unsigned", "long", "ulChannels", ")", "{", "if", "(", "g_sAudioState", ".", "eState", "!=", "STATE_DEVICE_READY", ")", "{", "return", "(", "0", ")", ";", "}", "return", "(", "USBHostAudioFormatSet", "(", "g_ulAudioInstance", ",", "ulSampleRate", ",", "ulBitsPerSample", ",", "ulChannels", ",", "USBH_AUDIO_FORMAT_IN", ")", ")", ";", "}" ]
This will set the current input audio format of the USB audio device \param ulSampleRate is the sample rate.
[ "This", "will", "set", "the", "current", "input", "audio", "format", "of", "the", "USB", "audio", "device", "\\", "param", "ulSampleRate", "is", "the", "sample", "rate", "." ]
[ "//", "// Just return if there is no device at this time.", "//" ]
[ { "param": "ulSampleRate", "type": "unsigned long" }, { "param": "ulBitsPerSample", "type": "unsigned long" }, { "param": "ulChannels", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulSampleRate", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulBitsPerSample", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulChannels", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundOutputFormatGet
null
unsigned long USBSoundOutputFormatGet(unsigned long ulSampleRate, unsigned long ulBits, unsigned long ulChannels) { // // Just return if there is no device at this time. // if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } return(USBHostAudioFormatGet(g_ulAudioInstance, ulSampleRate, ulBits, ulChannels, USBH_AUDIO_FORMAT_OUT)); }
//***************************************************************************** // // Returns the current sample rate. // // This function returns the sample rate that was set by a call to // USBSoundSetFormat(). This is needed to retrieve the exact sample rate that is // in use in case the requested rate could not be matched exactly. // // \return The current sample rate in samples/second. // //*****************************************************************************
Returns the current sample rate. This function returns the sample rate that was set by a call to USBSoundSetFormat(). This is needed to retrieve the exact sample rate that is in use in case the requested rate could not be matched exactly. \return The current sample rate in samples/second.
[ "Returns", "the", "current", "sample", "rate", ".", "This", "function", "returns", "the", "sample", "rate", "that", "was", "set", "by", "a", "call", "to", "USBSoundSetFormat", "()", ".", "This", "is", "needed", "to", "retrieve", "the", "exact", "sample", "rate", "that", "is", "in", "use", "in", "case", "the", "requested", "rate", "could", "not", "be", "matched", "exactly", ".", "\\", "return", "The", "current", "sample", "rate", "in", "samples", "/", "second", "." ]
unsigned long USBSoundOutputFormatGet(unsigned long ulSampleRate, unsigned long ulBits, unsigned long ulChannels) { Just return if there is no device at this time. if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } return(USBHostAudioFormatGet(g_ulAudioInstance, ulSampleRate, ulBits, ulChannels, USBH_AUDIO_FORMAT_OUT)); }
[ "unsigned", "long", "USBSoundOutputFormatGet", "(", "unsigned", "long", "ulSampleRate", ",", "unsigned", "long", "ulBits", ",", "unsigned", "long", "ulChannels", ")", "{", "if", "(", "g_sAudioState", ".", "eState", "!=", "STATE_DEVICE_READY", ")", "{", "return", "(", "0", ")", ";", "}", "return", "(", "USBHostAudioFormatGet", "(", "g_ulAudioInstance", ",", "ulSampleRate", ",", "ulBits", ",", "ulChannels", ",", "USBH_AUDIO_FORMAT_OUT", ")", ")", ";", "}" ]
Returns the current sample rate.
[ "Returns", "the", "current", "sample", "rate", "." ]
[ "//", "// Just return if there is no device at this time.", "//" ]
[ { "param": "ulSampleRate", "type": "unsigned long" }, { "param": "ulBits", "type": "unsigned long" }, { "param": "ulChannels", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulSampleRate", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulBits", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulChannels", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundInputFormatGet
null
unsigned long USBSoundInputFormatGet(unsigned long ulSampleRate, unsigned long ulBits, unsigned long ulChannels) { // // Just return if there is no device at this time. // if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } return(USBHostAudioFormatGet(g_ulAudioInstance, ulSampleRate, ulBits, ulChannels, USBH_AUDIO_FORMAT_IN)); }
//***************************************************************************** // // Returns the current sample rate. // // This function returns the sample rate that was set by a call to // USBSoundSetFormat(). This is needed to retrieve the exact sample rate that is // in use in case the requested rate could not be matched exactly. // // \return The current sample rate in samples/second. // //*****************************************************************************
Returns the current sample rate. This function returns the sample rate that was set by a call to USBSoundSetFormat(). This is needed to retrieve the exact sample rate that is in use in case the requested rate could not be matched exactly. \return The current sample rate in samples/second.
[ "Returns", "the", "current", "sample", "rate", ".", "This", "function", "returns", "the", "sample", "rate", "that", "was", "set", "by", "a", "call", "to", "USBSoundSetFormat", "()", ".", "This", "is", "needed", "to", "retrieve", "the", "exact", "sample", "rate", "that", "is", "in", "use", "in", "case", "the", "requested", "rate", "could", "not", "be", "matched", "exactly", ".", "\\", "return", "The", "current", "sample", "rate", "in", "samples", "/", "second", "." ]
unsigned long USBSoundInputFormatGet(unsigned long ulSampleRate, unsigned long ulBits, unsigned long ulChannels) { Just return if there is no device at this time. if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } return(USBHostAudioFormatGet(g_ulAudioInstance, ulSampleRate, ulBits, ulChannels, USBH_AUDIO_FORMAT_IN)); }
[ "unsigned", "long", "USBSoundInputFormatGet", "(", "unsigned", "long", "ulSampleRate", ",", "unsigned", "long", "ulBits", ",", "unsigned", "long", "ulChannels", ")", "{", "if", "(", "g_sAudioState", ".", "eState", "!=", "STATE_DEVICE_READY", ")", "{", "return", "(", "0", ")", ";", "}", "return", "(", "USBHostAudioFormatGet", "(", "g_ulAudioInstance", ",", "ulSampleRate", ",", "ulBits", ",", "ulChannels", ",", "USBH_AUDIO_FORMAT_IN", ")", ")", ";", "}" ]
Returns the current sample rate.
[ "Returns", "the", "current", "sample", "rate", "." ]
[ "//", "// Just return if there is no device at this time.", "//" ]
[ { "param": "ulSampleRate", "type": "unsigned long" }, { "param": "ulBits", "type": "unsigned long" }, { "param": "ulChannels", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulSampleRate", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulBits", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulChannels", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBHCDEvents
void
void USBHCDEvents(void *pvData) { tEventInfo *pEventInfo; // // Cast this pointer to its actual type. // pEventInfo = (tEventInfo *)pvData; switch(pEventInfo->ulEvent) { // // Unknown device detected. // case USB_EVENT_UNKNOWN_CONNECTED: { // // An unknown device was detected. // g_sAudioState.eState = STATE_UNKNOWN_DEVICE; // // Call the general event handler if present. // if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_UNKNOWN_DEV, 1); } break; } // // Device unplugged. // case USB_EVENT_DISCONNECTED: { // // Handle the case where an unknown device is disconnected. // if(g_sAudioState.eState == STATE_UNKNOWN_DEVICE) { g_sAudioState.eState = STATE_NO_DEVICE; // // Call the general event handler if present. // if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_UNKNOWN_DEV, 0); } } else { // // Call the general event handler if present. // if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_DISCONNECT, 0); } } break; } // // A power fault has occurred. // case USB_EVENT_POWER_FAULT: { // // No power means no device is present. // g_sAudioState.eState = STATE_POWER_FAULT; break; } default: { break; } } }
//***************************************************************************** // // This is the generic callback from host stack. // // \param pvData is actually a pointer to a tEventInfo structure. // // This function will be called to inform the application when a USB event has // occurred that is outside those related to the audio device. At this // point this is used to detect unsupported devices being inserted and removed. // It is also used to inform the application when a power fault has occurred. // This function is required when the g_USBGenericEventDriver is included in // the host controller driver array that is passed in to the // USBHCDRegisterDrivers() function. // // \return None. // //*****************************************************************************
This is the generic callback from host stack. \param pvData is actually a pointer to a tEventInfo structure. This function will be called to inform the application when a USB event has occurred that is outside those related to the audio device. At this point this is used to detect unsupported devices being inserted and removed. It is also used to inform the application when a power fault has occurred. This function is required when the g_USBGenericEventDriver is included in the host controller driver array that is passed in to the USBHCDRegisterDrivers() function. \return None.
[ "This", "is", "the", "generic", "callback", "from", "host", "stack", ".", "\\", "param", "pvData", "is", "actually", "a", "pointer", "to", "a", "tEventInfo", "structure", ".", "This", "function", "will", "be", "called", "to", "inform", "the", "application", "when", "a", "USB", "event", "has", "occurred", "that", "is", "outside", "those", "related", "to", "the", "audio", "device", ".", "At", "this", "point", "this", "is", "used", "to", "detect", "unsupported", "devices", "being", "inserted", "and", "removed", ".", "It", "is", "also", "used", "to", "inform", "the", "application", "when", "a", "power", "fault", "has", "occurred", ".", "This", "function", "is", "required", "when", "the", "g_USBGenericEventDriver", "is", "included", "in", "the", "host", "controller", "driver", "array", "that", "is", "passed", "in", "to", "the", "USBHCDRegisterDrivers", "()", "function", ".", "\\", "return", "None", "." ]
void USBHCDEvents(void *pvData) { tEventInfo *pEventInfo; Cast this pointer to its actual type. pEventInfo = (tEventInfo *)pvData; switch(pEventInfo->ulEvent) { Unknown device detected. case USB_EVENT_UNKNOWN_CONNECTED: { An unknown device was detected. g_sAudioState.eState = STATE_UNKNOWN_DEVICE; Call the general event handler if present. if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_UNKNOWN_DEV, 1); } break; } Device unplugged. case USB_EVENT_DISCONNECTED: { Handle the case where an unknown device is disconnected. if(g_sAudioState.eState == STATE_UNKNOWN_DEVICE) { g_sAudioState.eState = STATE_NO_DEVICE; Call the general event handler if present. if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_UNKNOWN_DEV, 0); } } else { Call the general event handler if present. if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_DISCONNECT, 0); } } break; } A power fault has occurred. case USB_EVENT_POWER_FAULT: { No power means no device is present. g_sAudioState.eState = STATE_POWER_FAULT; break; } default: { break; } } }
[ "void", "USBHCDEvents", "(", "void", "*", "pvData", ")", "{", "tEventInfo", "*", "pEventInfo", ";", "pEventInfo", "=", "(", "tEventInfo", "*", ")", "pvData", ";", "switch", "(", "pEventInfo", "->", "ulEvent", ")", "{", "case", "USB_EVENT_UNKNOWN_CONNECTED", ":", "{", "g_sAudioState", ".", "eState", "=", "STATE_UNKNOWN_DEVICE", ";", "if", "(", "g_sAudioState", ".", "pfnCallbackEvent", ")", "{", "g_sAudioState", ".", "pfnCallbackEvent", "(", "SOUND_EVENT_UNKNOWN_DEV", ",", "1", ")", ";", "}", "break", ";", "}", "case", "USB_EVENT_DISCONNECTED", ":", "{", "if", "(", "g_sAudioState", ".", "eState", "==", "STATE_UNKNOWN_DEVICE", ")", "{", "g_sAudioState", ".", "eState", "=", "STATE_NO_DEVICE", ";", "if", "(", "g_sAudioState", ".", "pfnCallbackEvent", ")", "{", "g_sAudioState", ".", "pfnCallbackEvent", "(", "SOUND_EVENT_UNKNOWN_DEV", ",", "0", ")", ";", "}", "}", "else", "{", "if", "(", "g_sAudioState", ".", "pfnCallbackEvent", ")", "{", "g_sAudioState", ".", "pfnCallbackEvent", "(", "SOUND_EVENT_DISCONNECT", ",", "0", ")", ";", "}", "}", "break", ";", "}", "case", "USB_EVENT_POWER_FAULT", ":", "{", "g_sAudioState", ".", "eState", "=", "STATE_POWER_FAULT", ";", "break", ";", "}", "default", ":", "{", "break", ";", "}", "}", "}" ]
This is the generic callback from host stack.
[ "This", "is", "the", "generic", "callback", "from", "host", "stack", "." ]
[ "//", "// Cast this pointer to its actual type.", "//", "//", "// Unknown device detected.", "//", "//", "// An unknown device was detected.", "//", "//", "// Call the general event handler if present.", "//", "//", "// Device unplugged.", "//", "//", "// Handle the case where an unknown device is disconnected.", "//", "//", "// Call the general event handler if present.", "//", "//", "// Call the general event handler if present.", "//", "//", "// A power fault has occurred.", "//", "//", "// No power means no device is present.", "//" ]
[ { "param": "pvData", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBHostAudioCallback
void
void USBHostAudioCallback(void *pvBuffer, unsigned long ulParam, unsigned long ulEvent) { // // Only call the callback if it is actually present. // if(g_sAudioState.pfnCallbackOut) { g_sAudioState.pfnCallbackOut(pvBuffer, ulEvent); } // // Only call the callback if it is actually present. // if(g_sAudioState.pfnCallbackIn) { g_sAudioState.pfnCallbackIn(pvBuffer, ulEvent); } }
//***************************************************************************** // // This function passes along a buffer callback from the USB host audio driver // so that the application can process or release the buffers. // //*****************************************************************************
This function passes along a buffer callback from the USB host audio driver so that the application can process or release the buffers.
[ "This", "function", "passes", "along", "a", "buffer", "callback", "from", "the", "USB", "host", "audio", "driver", "so", "that", "the", "application", "can", "process", "or", "release", "the", "buffers", "." ]
void USBHostAudioCallback(void *pvBuffer, unsigned long ulParam, unsigned long ulEvent) { Only call the callback if it is actually present. if(g_sAudioState.pfnCallbackOut) { g_sAudioState.pfnCallbackOut(pvBuffer, ulEvent); } Only call the callback if it is actually present. if(g_sAudioState.pfnCallbackIn) { g_sAudioState.pfnCallbackIn(pvBuffer, ulEvent); } }
[ "void", "USBHostAudioCallback", "(", "void", "*", "pvBuffer", ",", "unsigned", "long", "ulParam", ",", "unsigned", "long", "ulEvent", ")", "{", "if", "(", "g_sAudioState", ".", "pfnCallbackOut", ")", "{", "g_sAudioState", ".", "pfnCallbackOut", "(", "pvBuffer", ",", "ulEvent", ")", ";", "}", "if", "(", "g_sAudioState", ".", "pfnCallbackIn", ")", "{", "g_sAudioState", ".", "pfnCallbackIn", "(", "pvBuffer", ",", "ulEvent", ")", ";", "}", "}" ]
This function passes along a buffer callback from the USB host audio driver so that the application can process or release the buffers.
[ "This", "function", "passes", "along", "a", "buffer", "callback", "from", "the", "USB", "host", "audio", "driver", "so", "that", "the", "application", "can", "process", "or", "release", "the", "buffers", "." ]
[ "//", "// Only call the callback if it is actually present.", "//", "//", "// Only call the callback if it is actually present.", "//" ]
[ { "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": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundBufferOut
null
unsigned long USBSoundBufferOut(const void *pvBuffer, unsigned long ulSize, tUSBBufferCallback pfnCallback) { // // If there is no device present or there is a pending buffer then just // return with a failure. // if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } // // Save this buffer callback. // g_sAudioState.pfnCallbackOut = pfnCallback; // // Pass the buffer along to the USB host audio driver for playback. // return(USBHostAudioPlay(g_ulAudioInstance, (void *)pvBuffer, ulSize, USBHostAudioCallback)); }
//***************************************************************************** // // Starts output of a block of PCM audio samples. // // \param pvBuffer is a pointer to the audio data to play. // \param ulSize is the length of the data in bytes. // \param pfnCallback is a function to call when this buffer has be played. // // This function starts the output of a block of PCM audio samples. // // \return This function returns a non-zero value if the buffer was accepted, // and returns zero if the buffer was not accepted. // //*****************************************************************************
Starts output of a block of PCM audio samples. \param pvBuffer is a pointer to the audio data to play. \param ulSize is the length of the data in bytes. \param pfnCallback is a function to call when this buffer has be played. This function starts the output of a block of PCM audio samples. \return This function returns a non-zero value if the buffer was accepted, and returns zero if the buffer was not accepted.
[ "Starts", "output", "of", "a", "block", "of", "PCM", "audio", "samples", ".", "\\", "param", "pvBuffer", "is", "a", "pointer", "to", "the", "audio", "data", "to", "play", ".", "\\", "param", "ulSize", "is", "the", "length", "of", "the", "data", "in", "bytes", ".", "\\", "param", "pfnCallback", "is", "a", "function", "to", "call", "when", "this", "buffer", "has", "be", "played", ".", "This", "function", "starts", "the", "output", "of", "a", "block", "of", "PCM", "audio", "samples", ".", "\\", "return", "This", "function", "returns", "a", "non", "-", "zero", "value", "if", "the", "buffer", "was", "accepted", "and", "returns", "zero", "if", "the", "buffer", "was", "not", "accepted", "." ]
unsigned long USBSoundBufferOut(const void *pvBuffer, unsigned long ulSize, tUSBBufferCallback pfnCallback) { If there is no device present or there is a pending buffer then just return with a failure. if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } Save this buffer callback. g_sAudioState.pfnCallbackOut = pfnCallback; Pass the buffer along to the USB host audio driver for playback. return(USBHostAudioPlay(g_ulAudioInstance, (void *)pvBuffer, ulSize, USBHostAudioCallback)); }
[ "unsigned", "long", "USBSoundBufferOut", "(", "const", "void", "*", "pvBuffer", ",", "unsigned", "long", "ulSize", ",", "tUSBBufferCallback", "pfnCallback", ")", "{", "if", "(", "g_sAudioState", ".", "eState", "!=", "STATE_DEVICE_READY", ")", "{", "return", "(", "0", ")", ";", "}", "g_sAudioState", ".", "pfnCallbackOut", "=", "pfnCallback", ";", "return", "(", "USBHostAudioPlay", "(", "g_ulAudioInstance", ",", "(", "void", "*", ")", "pvBuffer", ",", "ulSize", ",", "USBHostAudioCallback", ")", ")", ";", "}" ]
Starts output of a block of PCM audio samples.
[ "Starts", "output", "of", "a", "block", "of", "PCM", "audio", "samples", "." ]
[ "//", "// If there is no device present or there is a pending buffer then just", "// return with a failure.", "//", "//", "// Save this buffer callback.", "//", "//", "// Pass the buffer along to the USB host audio driver for playback.", "//" ]
[ { "param": "pvBuffer", "type": "void" }, { "param": "ulSize", "type": "unsigned long" }, { "param": "pfnCallback", "type": "tUSBBufferCallback" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvBuffer", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulSize", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pfnCallback", "type": "tUSBBufferCallback", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBSoundBufferIn
null
unsigned long USBSoundBufferIn(const void *pvBuffer, unsigned long ulSize, tUSBBufferCallback pfnCallback) { // // If there is no device present or there is a pending buffer then just // return with a failure. // if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } // // Save this buffer callback. // g_sAudioState.pfnCallbackIn = pfnCallback; // // Pass the buffer along to the USB host audio driver for input. // return(USBHostAudioRecord(g_ulAudioInstance, (void *)pvBuffer, ulSize, USBHostAudioCallback)); }
//***************************************************************************** // // Requests a new block of PCM audio samples from a USB audio device. // // \param pvBuffer is a pointer to a location to store the audio data. // \param ulSize is the size of the pvData buffer in bytes. // \param pfnCallback is a function to call when this buffer has new data. // // This function request a new block of PCM audio samples from a USB audio // device. // // \return This function returns a non-zero value if the buffer was accepted, // and returns zero if the buffer was not accepted. // //*****************************************************************************
Requests a new block of PCM audio samples from a USB audio device. \param pvBuffer is a pointer to a location to store the audio data. \param ulSize is the size of the pvData buffer in bytes. \param pfnCallback is a function to call when this buffer has new data. This function request a new block of PCM audio samples from a USB audio device. \return This function returns a non-zero value if the buffer was accepted, and returns zero if the buffer was not accepted.
[ "Requests", "a", "new", "block", "of", "PCM", "audio", "samples", "from", "a", "USB", "audio", "device", ".", "\\", "param", "pvBuffer", "is", "a", "pointer", "to", "a", "location", "to", "store", "the", "audio", "data", ".", "\\", "param", "ulSize", "is", "the", "size", "of", "the", "pvData", "buffer", "in", "bytes", ".", "\\", "param", "pfnCallback", "is", "a", "function", "to", "call", "when", "this", "buffer", "has", "new", "data", ".", "This", "function", "request", "a", "new", "block", "of", "PCM", "audio", "samples", "from", "a", "USB", "audio", "device", ".", "\\", "return", "This", "function", "returns", "a", "non", "-", "zero", "value", "if", "the", "buffer", "was", "accepted", "and", "returns", "zero", "if", "the", "buffer", "was", "not", "accepted", "." ]
unsigned long USBSoundBufferIn(const void *pvBuffer, unsigned long ulSize, tUSBBufferCallback pfnCallback) { If there is no device present or there is a pending buffer then just return with a failure. if(g_sAudioState.eState != STATE_DEVICE_READY) { return(0); } Save this buffer callback. g_sAudioState.pfnCallbackIn = pfnCallback; Pass the buffer along to the USB host audio driver for input. return(USBHostAudioRecord(g_ulAudioInstance, (void *)pvBuffer, ulSize, USBHostAudioCallback)); }
[ "unsigned", "long", "USBSoundBufferIn", "(", "const", "void", "*", "pvBuffer", ",", "unsigned", "long", "ulSize", ",", "tUSBBufferCallback", "pfnCallback", ")", "{", "if", "(", "g_sAudioState", ".", "eState", "!=", "STATE_DEVICE_READY", ")", "{", "return", "(", "0", ")", ";", "}", "g_sAudioState", ".", "pfnCallbackIn", "=", "pfnCallback", ";", "return", "(", "USBHostAudioRecord", "(", "g_ulAudioInstance", ",", "(", "void", "*", ")", "pvBuffer", ",", "ulSize", ",", "USBHostAudioCallback", ")", ")", ";", "}" ]
Requests a new block of PCM audio samples from a USB audio device.
[ "Requests", "a", "new", "block", "of", "PCM", "audio", "samples", "from", "a", "USB", "audio", "device", "." ]
[ "//", "// If there is no device present or there is a pending buffer then just", "// return with a failure.", "//", "//", "// Save this buffer callback.", "//", "//", "// Pass the buffer along to the USB host audio driver for input.", "//" ]
[ { "param": "pvBuffer", "type": "void" }, { "param": "ulSize", "type": "unsigned long" }, { "param": "pfnCallback", "type": "tUSBBufferCallback" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvBuffer", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulSize", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pfnCallback", "type": "tUSBBufferCallback", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
GetVolumeParameters
void
static void GetVolumeParameters(void) { unsigned long ulMax, ulMin, ulRes, ulChannel; for(ulChannel = 0; ulChannel < 3; ulChannel++) { ulMax = USBHostAudioVolumeMaxGet(g_ulAudioInstance, 0, ulChannel); ulMin = USBHostAudioVolumeMinGet(g_ulAudioInstance, 0, ulChannel); ulRes = USBHostAudioVolumeResGet(g_ulAudioInstance, 0, ulChannel); g_sAudioState.pulSteps[ulChannel] = (ulMax - ulMin) / ulRes; } }
//***************************************************************************** // // This function reads the audio volume settings for the USB audio device and // saves them so that the volume can be scaled correctly. // //*****************************************************************************
This function reads the audio volume settings for the USB audio device and saves them so that the volume can be scaled correctly.
[ "This", "function", "reads", "the", "audio", "volume", "settings", "for", "the", "USB", "audio", "device", "and", "saves", "them", "so", "that", "the", "volume", "can", "be", "scaled", "correctly", "." ]
static void GetVolumeParameters(void) { unsigned long ulMax, ulMin, ulRes, ulChannel; for(ulChannel = 0; ulChannel < 3; ulChannel++) { ulMax = USBHostAudioVolumeMaxGet(g_ulAudioInstance, 0, ulChannel); ulMin = USBHostAudioVolumeMinGet(g_ulAudioInstance, 0, ulChannel); ulRes = USBHostAudioVolumeResGet(g_ulAudioInstance, 0, ulChannel); g_sAudioState.pulSteps[ulChannel] = (ulMax - ulMin) / ulRes; } }
[ "static", "void", "GetVolumeParameters", "(", "void", ")", "{", "unsigned", "long", "ulMax", ",", "ulMin", ",", "ulRes", ",", "ulChannel", ";", "for", "(", "ulChannel", "=", "0", ";", "ulChannel", "<", "3", ";", "ulChannel", "++", ")", "{", "ulMax", "=", "USBHostAudioVolumeMaxGet", "(", "g_ulAudioInstance", ",", "0", ",", "ulChannel", ")", ";", "ulMin", "=", "USBHostAudioVolumeMinGet", "(", "g_ulAudioInstance", ",", "0", ",", "ulChannel", ")", ";", "ulRes", "=", "USBHostAudioVolumeResGet", "(", "g_ulAudioInstance", ",", "0", ",", "ulChannel", ")", ";", "g_sAudioState", ".", "pulSteps", "[", "ulChannel", "]", "=", "(", "ulMax", "-", "ulMin", ")", "/", "ulRes", ";", "}", "}" ]
This function reads the audio volume settings for the USB audio device and saves them so that the volume can be scaled correctly.
[ "This", "function", "reads", "the", "audio", "volume", "settings", "for", "the", "USB", "audio", "device", "and", "saves", "them", "so", "that", "the", "volume", "can", "be", "scaled", "correctly", "." ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
7d06c3522e80d0a905e09f6f4cc041cb6b1af123
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/drivers/usb_sound.c
[ "BSD-3-Clause" ]
C
USBMain
void
void USBMain(unsigned long ulTicks) { // // Tell the OTG library code how much time has passed in // milliseconds since the last call. // USBOTGMain(ulTicks); switch(g_sAudioState.eState) { // // This is the running state where buttons are checked and the // screen is updated. // case STATE_DEVICE_READY: { if(HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_CLOSE)) { HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_CLOSE) = 0; g_sAudioState.eState = STATE_NO_DEVICE; // // Call the general event handler if present. // if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_DISCONNECT, 0); } } break; } // // If there is no device then just wait for one. // case STATE_NO_DEVICE: { if(HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_OPEN)) { g_sAudioState.eState = STATE_DEVICE_READY; HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_OPEN) = 0; GetVolumeParameters(); // // Call the general event handler if present. // if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_READY, 0); } } break; } // // An unknown device was connected. // case STATE_UNKNOWN_DEVICE: { break; } // // Something has caused a power fault. // case STATE_POWER_FAULT: { break; } default: { break; } } }
//***************************************************************************** // // The main routine for handling USB audio, this should be called periodically // by the main program and pass in the amount of time in milliseconds that has // elapsed since the last call. // //*****************************************************************************
The main routine for handling USB audio, this should be called periodically by the main program and pass in the amount of time in milliseconds that has elapsed since the last call.
[ "The", "main", "routine", "for", "handling", "USB", "audio", "this", "should", "be", "called", "periodically", "by", "the", "main", "program", "and", "pass", "in", "the", "amount", "of", "time", "in", "milliseconds", "that", "has", "elapsed", "since", "the", "last", "call", "." ]
void USBMain(unsigned long ulTicks) { Tell the OTG library code how much time has passed in milliseconds since the last call. USBOTGMain(ulTicks); switch(g_sAudioState.eState) { This is the running state where buttons are checked and the screen is updated. case STATE_DEVICE_READY: { if(HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_CLOSE)) { HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_CLOSE) = 0; g_sAudioState.eState = STATE_NO_DEVICE; Call the general event handler if present. if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_DISCONNECT, 0); } } break; } If there is no device then just wait for one. case STATE_NO_DEVICE: { if(HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_OPEN)) { g_sAudioState.eState = STATE_DEVICE_READY; HWREGBITW(&g_sAudioState.ulEventFlags, EVENT_OPEN) = 0; GetVolumeParameters(); Call the general event handler if present. if(g_sAudioState.pfnCallbackEvent) { g_sAudioState.pfnCallbackEvent(SOUND_EVENT_READY, 0); } } break; } An unknown device was connected. case STATE_UNKNOWN_DEVICE: { break; } Something has caused a power fault. case STATE_POWER_FAULT: { break; } default: { break; } } }
[ "void", "USBMain", "(", "unsigned", "long", "ulTicks", ")", "{", "USBOTGMain", "(", "ulTicks", ")", ";", "switch", "(", "g_sAudioState", ".", "eState", ")", "{", "case", "STATE_DEVICE_READY", ":", "{", "if", "(", "HWREGBITW", "(", "&", "g_sAudioState", ".", "ulEventFlags", ",", "EVENT_CLOSE", ")", ")", "{", "HWREGBITW", "(", "&", "g_sAudioState", ".", "ulEventFlags", ",", "EVENT_CLOSE", ")", "=", "0", ";", "g_sAudioState", ".", "eState", "=", "STATE_NO_DEVICE", ";", "if", "(", "g_sAudioState", ".", "pfnCallbackEvent", ")", "{", "g_sAudioState", ".", "pfnCallbackEvent", "(", "SOUND_EVENT_DISCONNECT", ",", "0", ")", ";", "}", "}", "break", ";", "}", "case", "STATE_NO_DEVICE", ":", "{", "if", "(", "HWREGBITW", "(", "&", "g_sAudioState", ".", "ulEventFlags", ",", "EVENT_OPEN", ")", ")", "{", "g_sAudioState", ".", "eState", "=", "STATE_DEVICE_READY", ";", "HWREGBITW", "(", "&", "g_sAudioState", ".", "ulEventFlags", ",", "EVENT_OPEN", ")", "=", "0", ";", "GetVolumeParameters", "(", ")", ";", "if", "(", "g_sAudioState", ".", "pfnCallbackEvent", ")", "{", "g_sAudioState", ".", "pfnCallbackEvent", "(", "SOUND_EVENT_READY", ",", "0", ")", ";", "}", "}", "break", ";", "}", "case", "STATE_UNKNOWN_DEVICE", ":", "{", "break", ";", "}", "case", "STATE_POWER_FAULT", ":", "{", "break", ";", "}", "default", ":", "{", "break", ";", "}", "}", "}" ]
The main routine for handling USB audio, this should be called periodically by the main program and pass in the amount of time in milliseconds that has elapsed since the last call.
[ "The", "main", "routine", "for", "handling", "USB", "audio", "this", "should", "be", "called", "periodically", "by", "the", "main", "program", "and", "pass", "in", "the", "amount", "of", "time", "in", "milliseconds", "that", "has", "elapsed", "since", "the", "last", "call", "." ]
[ "//", "// Tell the OTG library code how much time has passed in", "// milliseconds since the last call.", "//", "//", "// This is the running state where buttons are checked and the", "// screen is updated.", "//", "//", "// Call the general event handler if present.", "//", "//", "// If there is no device then just wait for one.", "//", "//", "// Call the general event handler if present.", "//", "//", "// An unknown device was connected.", "//", "//", "// Something has caused a power fault.", "//" ]
[ { "param": "ulTicks", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulTicks", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
9e31e42a0be3f36403e738097e1b180e8c823037
junyanl-code/Luminary-Micro-Library
boards/rdk-idm-sbc/drivers/set_pinout.c
[ "BSD-3-Clause" ]
C
PinoutSet
void
void PinoutSet(void) { // // Enable all GPIO banks. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ); // // GPIO Port A pins // GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA4_SSI0RX); GPIOPinConfigure(GPIO_PA5_SSI0TX); GPIOPinConfigure(GPIO_PA6_USB0EPEN); GPIOPinConfigure(GPIO_PA7_USB0PFLT); // // GPIO Port B pins // GPIOPinConfigure(GPIO_PB2_I2C0SCL); GPIOPinConfigure(GPIO_PB3_I2C0SDA); GPIOPinConfigure(GPIO_PB4_CAN0RX); GPIOPinConfigure(GPIO_PB5_CAN0TX); GPIOPinConfigure(GPIO_PB6_I2S0TXSCK); // // GPIO Port C pins // GPIOPinConfigure(GPIO_PC4_EPI0S2); GPIOPinConfigure(GPIO_PC5_EPI0S3); GPIOPinConfigure(GPIO_PC6_EPI0S4); GPIOPinConfigure(GPIO_PC7_EPI0S5); // // GPIO Port E pins // GPIOPinConfigure(GPIO_PE0_EPI0S8); GPIOPinConfigure(GPIO_PE1_EPI0S9); GPIOPinConfigure(GPIO_PE4_I2S0TXWS); GPIOPinConfigure(GPIO_PE5_I2S0TXSD); // // GPIO Port F pins // GPIOPinConfigure(GPIO_PF1_I2S0TXMCLK); GPIOPinConfigure(GPIO_PF2_LED1); GPIOPinConfigure(GPIO_PF3_LED0); GPIOPinConfigure(GPIO_PF4_EPI0S12); GPIOPinConfigure(GPIO_PF5_EPI0S15); // // GPIO Port G pins // GPIOPinConfigure(GPIO_PG0_EPI0S13); GPIOPinConfigure(GPIO_PG1_EPI0S14); GPIOPinConfigure(GPIO_PG7_EPI0S31); // // GPIO Port H pins // GPIOPinConfigure(GPIO_PH0_EPI0S6); GPIOPinConfigure(GPIO_PH1_EPI0S7); GPIOPinConfigure(GPIO_PH2_EPI0S1); GPIOPinConfigure(GPIO_PH3_EPI0S0); GPIOPinConfigure(GPIO_PH4_EPI0S10); GPIOPinConfigure(GPIO_PH5_EPI0S11); // // GPIO Port J pins // GPIOPinConfigure(GPIO_PJ0_EPI0S16); GPIOPinConfigure(GPIO_PJ1_EPI0S17); GPIOPinConfigure(GPIO_PJ2_EPI0S18); GPIOPinConfigure(GPIO_PJ3_EPI0S19); GPIOPinConfigure(GPIO_PJ4_EPI0S28); GPIOPinConfigure(GPIO_PJ5_EPI0S29); GPIOPinConfigure(GPIO_PJ6_EPI0S30); GPIOPinConfigure(GPIO_PJ7_CCP0); }
//***************************************************************************** // //! Configures the LM3S9B92 device pinout for the RDK-IDM-SBC board. //! //! This function configures each pin of the lm3s9b92 device to route the //! appropriate peripheral signal as required by the design of the rdk-idm-sbc //! development board. //! //! \return None. // //*****************************************************************************
Configures the LM3S9B92 device pinout for the RDK-IDM-SBC board. This function configures each pin of the lm3s9b92 device to route the appropriate peripheral signal as required by the design of the rdk-idm-sbc development board. \return None.
[ "Configures", "the", "LM3S9B92", "device", "pinout", "for", "the", "RDK", "-", "IDM", "-", "SBC", "board", ".", "This", "function", "configures", "each", "pin", "of", "the", "lm3s9b92", "device", "to", "route", "the", "appropriate", "peripheral", "signal", "as", "required", "by", "the", "design", "of", "the", "rdk", "-", "idm", "-", "sbc", "development", "board", ".", "\\", "return", "None", "." ]
void PinoutSet(void) { ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOC); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOD); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOG); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOH); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOJ); GPIOPinConfigure(GPIO_PA0_U0RX); GPIOPinConfigure(GPIO_PA1_U0TX); GPIOPinConfigure(GPIO_PA2_SSI0CLK); GPIOPinConfigure(GPIO_PA4_SSI0RX); GPIOPinConfigure(GPIO_PA5_SSI0TX); GPIOPinConfigure(GPIO_PA6_USB0EPEN); GPIOPinConfigure(GPIO_PA7_USB0PFLT); GPIOPinConfigure(GPIO_PB2_I2C0SCL); GPIOPinConfigure(GPIO_PB3_I2C0SDA); GPIOPinConfigure(GPIO_PB4_CAN0RX); GPIOPinConfigure(GPIO_PB5_CAN0TX); GPIOPinConfigure(GPIO_PB6_I2S0TXSCK); GPIOPinConfigure(GPIO_PC4_EPI0S2); GPIOPinConfigure(GPIO_PC5_EPI0S3); GPIOPinConfigure(GPIO_PC6_EPI0S4); GPIOPinConfigure(GPIO_PC7_EPI0S5); GPIOPinConfigure(GPIO_PE0_EPI0S8); GPIOPinConfigure(GPIO_PE1_EPI0S9); GPIOPinConfigure(GPIO_PE4_I2S0TXWS); GPIOPinConfigure(GPIO_PE5_I2S0TXSD); GPIOPinConfigure(GPIO_PF1_I2S0TXMCLK); GPIOPinConfigure(GPIO_PF2_LED1); GPIOPinConfigure(GPIO_PF3_LED0); GPIOPinConfigure(GPIO_PF4_EPI0S12); GPIOPinConfigure(GPIO_PF5_EPI0S15); GPIOPinConfigure(GPIO_PG0_EPI0S13); GPIOPinConfigure(GPIO_PG1_EPI0S14); GPIOPinConfigure(GPIO_PG7_EPI0S31); GPIOPinConfigure(GPIO_PH0_EPI0S6); GPIOPinConfigure(GPIO_PH1_EPI0S7); GPIOPinConfigure(GPIO_PH2_EPI0S1); GPIOPinConfigure(GPIO_PH3_EPI0S0); GPIOPinConfigure(GPIO_PH4_EPI0S10); GPIOPinConfigure(GPIO_PH5_EPI0S11); GPIOPinConfigure(GPIO_PJ0_EPI0S16); GPIOPinConfigure(GPIO_PJ1_EPI0S17); GPIOPinConfigure(GPIO_PJ2_EPI0S18); GPIOPinConfigure(GPIO_PJ3_EPI0S19); GPIOPinConfigure(GPIO_PJ4_EPI0S28); GPIOPinConfigure(GPIO_PJ5_EPI0S29); GPIOPinConfigure(GPIO_PJ6_EPI0S30); GPIOPinConfigure(GPIO_PJ7_CCP0); }
[ "void", "PinoutSet", "(", "void", ")", "{", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOA", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOB", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOC", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOD", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOE", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOF", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOG", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOH", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOJ", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA0_U0RX", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA1_U0TX", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA2_SSI0CLK", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA4_SSI0RX", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA5_SSI0TX", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA6_USB0EPEN", ")", ";", "GPIOPinConfigure", "(", "GPIO_PA7_USB0PFLT", ")", ";", "GPIOPinConfigure", "(", "GPIO_PB2_I2C0SCL", ")", ";", "GPIOPinConfigure", "(", "GPIO_PB3_I2C0SDA", ")", ";", "GPIOPinConfigure", "(", "GPIO_PB4_CAN0RX", ")", ";", "GPIOPinConfigure", "(", "GPIO_PB5_CAN0TX", ")", ";", "GPIOPinConfigure", "(", "GPIO_PB6_I2S0TXSCK", ")", ";", "GPIOPinConfigure", "(", "GPIO_PC4_EPI0S2", ")", ";", "GPIOPinConfigure", "(", "GPIO_PC5_EPI0S3", ")", ";", "GPIOPinConfigure", "(", "GPIO_PC6_EPI0S4", ")", ";", "GPIOPinConfigure", "(", "GPIO_PC7_EPI0S5", ")", ";", "GPIOPinConfigure", "(", "GPIO_PE0_EPI0S8", ")", ";", "GPIOPinConfigure", "(", "GPIO_PE1_EPI0S9", ")", ";", "GPIOPinConfigure", "(", "GPIO_PE4_I2S0TXWS", ")", ";", "GPIOPinConfigure", "(", "GPIO_PE5_I2S0TXSD", ")", ";", "GPIOPinConfigure", "(", "GPIO_PF1_I2S0TXMCLK", ")", ";", "GPIOPinConfigure", "(", "GPIO_PF2_LED1", ")", ";", "GPIOPinConfigure", "(", "GPIO_PF3_LED0", ")", ";", "GPIOPinConfigure", "(", "GPIO_PF4_EPI0S12", ")", ";", "GPIOPinConfigure", "(", "GPIO_PF5_EPI0S15", ")", ";", "GPIOPinConfigure", "(", "GPIO_PG0_EPI0S13", ")", ";", "GPIOPinConfigure", "(", "GPIO_PG1_EPI0S14", ")", ";", "GPIOPinConfigure", "(", "GPIO_PG7_EPI0S31", ")", ";", "GPIOPinConfigure", "(", "GPIO_PH0_EPI0S6", ")", ";", "GPIOPinConfigure", "(", "GPIO_PH1_EPI0S7", ")", ";", "GPIOPinConfigure", "(", "GPIO_PH2_EPI0S1", ")", ";", "GPIOPinConfigure", "(", "GPIO_PH3_EPI0S0", ")", ";", "GPIOPinConfigure", "(", "GPIO_PH4_EPI0S10", ")", ";", "GPIOPinConfigure", "(", "GPIO_PH5_EPI0S11", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ0_EPI0S16", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ1_EPI0S17", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ2_EPI0S18", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ3_EPI0S19", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ4_EPI0S28", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ5_EPI0S29", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ6_EPI0S30", ")", ";", "GPIOPinConfigure", "(", "GPIO_PJ7_CCP0", ")", ";", "}" ]
Configures the LM3S9B92 device pinout for the RDK-IDM-SBC board.
[ "Configures", "the", "LM3S9B92", "device", "pinout", "for", "the", "RDK", "-", "IDM", "-", "SBC", "board", "." ]
[ "//\r", "// Enable all GPIO banks.\r", "//\r", "//\r", "// GPIO Port A pins\r", "//\r", "//\r", "// GPIO Port B pins\r", "//\r", "//\r", "// GPIO Port C pins\r", "//\r", "//\r", "// GPIO Port E pins\r", "//\r", "//\r", "// GPIO Port F pins\r", "//\r", "//\r", "// GPIO Port G pins\r", "//\r", "//\r", "// GPIO Port H pins\r", "//\r", "//\r", "// GPIO Port J pins\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
69fc0ec84a042b7da983078e23ec5c16a6aa1c59
junyanl-code/Luminary-Micro-Library
boards/rdk-bdc/bdc-ui/speed.c
[ "BSD-3-Clause" ]
C
SpeedConfigRead
void
void SpeedConfigRead(void) { // // Read the PID controller's P coefficient. // if(CANReadParameter(LM_API_SPD_PC, 0, (unsigned long *)&(g_sSpeedConfig.lP), 0) == 0) { g_sSpeedConfig.lP = 0; } else if(g_sSpeedConfig.lP < 0) { g_sSpeedConfig.lP = (((g_sSpeedConfig.lP / 65536) * 1000) + ((((g_sSpeedConfig.lP % 65536) * 1000) - 32768) / 65536)); } else { g_sSpeedConfig.lP = (((g_sSpeedConfig.lP / 65536) * 1000) + ((((g_sSpeedConfig.lP % 65536) * 1000) + 32768) / 65536)); } // // Read the PID controller's I coefficient. // if(CANReadParameter(LM_API_SPD_IC, 0, (unsigned long *)&(g_sSpeedConfig.lI), 0) == 0) { g_sSpeedConfig.lI = 0; } else if(g_sSpeedConfig.lI < 0) { g_sSpeedConfig.lI = (((g_sSpeedConfig.lI / 65536) * 1000) + ((((g_sSpeedConfig.lI % 65536) * 1000) - 32768) / 65536)); } else { g_sSpeedConfig.lI = (((g_sSpeedConfig.lI / 65536) * 1000) + ((((g_sSpeedConfig.lI % 65536) * 1000) + 32768) / 65536)); } // // Read the PID controller's D coefficient. // if(CANReadParameter(LM_API_SPD_DC, 0, (unsigned long *)&(g_sSpeedConfig.lD), 0) == 0) { g_sSpeedConfig.lD = 0; } else if(g_sSpeedConfig.lD < 0) { g_sSpeedConfig.lD = (((g_sSpeedConfig.lD / 65536) * 1000) + ((((g_sSpeedConfig.lD % 65536) * 1000) - 32768) / 65536)); } else { g_sSpeedConfig.lD = (((g_sSpeedConfig.lD / 65536) * 1000) + ((((g_sSpeedConfig.lD % 65536) * 1000) + 32768) / 65536)); } // // Read the speed reference source. // if(CANReadParameter(LM_API_SPD_REF, 0, &(g_sSpeedConfig.ulSpeedRef), 0) == 0) { g_sSpeedConfig.ulSpeedRef = 0; } else { g_sSpeedConfig.ulSpeedRef &= 3; if(g_sSpeedConfig.ulSpeedRef) { g_sSpeedConfig.ulSpeedRef--; } } }
//***************************************************************************** // // Reads the configuration of the speed control mode of the current motor // controller. // //*****************************************************************************
Reads the configuration of the speed control mode of the current motor controller.
[ "Reads", "the", "configuration", "of", "the", "speed", "control", "mode", "of", "the", "current", "motor", "controller", "." ]
void SpeedConfigRead(void) { if(CANReadParameter(LM_API_SPD_PC, 0, (unsigned long *)&(g_sSpeedConfig.lP), 0) == 0) { g_sSpeedConfig.lP = 0; } else if(g_sSpeedConfig.lP < 0) { g_sSpeedConfig.lP = (((g_sSpeedConfig.lP / 65536) * 1000) + ((((g_sSpeedConfig.lP % 65536) * 1000) - 32768) / 65536)); } else { g_sSpeedConfig.lP = (((g_sSpeedConfig.lP / 65536) * 1000) + ((((g_sSpeedConfig.lP % 65536) * 1000) + 32768) / 65536)); } if(CANReadParameter(LM_API_SPD_IC, 0, (unsigned long *)&(g_sSpeedConfig.lI), 0) == 0) { g_sSpeedConfig.lI = 0; } else if(g_sSpeedConfig.lI < 0) { g_sSpeedConfig.lI = (((g_sSpeedConfig.lI / 65536) * 1000) + ((((g_sSpeedConfig.lI % 65536) * 1000) - 32768) / 65536)); } else { g_sSpeedConfig.lI = (((g_sSpeedConfig.lI / 65536) * 1000) + ((((g_sSpeedConfig.lI % 65536) * 1000) + 32768) / 65536)); } if(CANReadParameter(LM_API_SPD_DC, 0, (unsigned long *)&(g_sSpeedConfig.lD), 0) == 0) { g_sSpeedConfig.lD = 0; } else if(g_sSpeedConfig.lD < 0) { g_sSpeedConfig.lD = (((g_sSpeedConfig.lD / 65536) * 1000) + ((((g_sSpeedConfig.lD % 65536) * 1000) - 32768) / 65536)); } else { g_sSpeedConfig.lD = (((g_sSpeedConfig.lD / 65536) * 1000) + ((((g_sSpeedConfig.lD % 65536) * 1000) + 32768) / 65536)); } if(CANReadParameter(LM_API_SPD_REF, 0, &(g_sSpeedConfig.ulSpeedRef), 0) == 0) { g_sSpeedConfig.ulSpeedRef = 0; } else { g_sSpeedConfig.ulSpeedRef &= 3; if(g_sSpeedConfig.ulSpeedRef) { g_sSpeedConfig.ulSpeedRef--; } } }
[ "void", "SpeedConfigRead", "(", "void", ")", "{", "if", "(", "CANReadParameter", "(", "LM_API_SPD_PC", ",", "0", ",", "(", "unsigned", "long", "*", ")", "&", "(", "g_sSpeedConfig", ".", "lP", ")", ",", "0", ")", "==", "0", ")", "{", "g_sSpeedConfig", ".", "lP", "=", "0", ";", "}", "else", "if", "(", "g_sSpeedConfig", ".", "lP", "<", "0", ")", "{", "g_sSpeedConfig", ".", "lP", "=", "(", "(", "(", "g_sSpeedConfig", ".", "lP", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sSpeedConfig", ".", "lP", "%", "65536", ")", "*", "1000", ")", "-", "32768", ")", "/", "65536", ")", ")", ";", "}", "else", "{", "g_sSpeedConfig", ".", "lP", "=", "(", "(", "(", "g_sSpeedConfig", ".", "lP", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sSpeedConfig", ".", "lP", "%", "65536", ")", "*", "1000", ")", "+", "32768", ")", "/", "65536", ")", ")", ";", "}", "if", "(", "CANReadParameter", "(", "LM_API_SPD_IC", ",", "0", ",", "(", "unsigned", "long", "*", ")", "&", "(", "g_sSpeedConfig", ".", "lI", ")", ",", "0", ")", "==", "0", ")", "{", "g_sSpeedConfig", ".", "lI", "=", "0", ";", "}", "else", "if", "(", "g_sSpeedConfig", ".", "lI", "<", "0", ")", "{", "g_sSpeedConfig", ".", "lI", "=", "(", "(", "(", "g_sSpeedConfig", ".", "lI", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sSpeedConfig", ".", "lI", "%", "65536", ")", "*", "1000", ")", "-", "32768", ")", "/", "65536", ")", ")", ";", "}", "else", "{", "g_sSpeedConfig", ".", "lI", "=", "(", "(", "(", "g_sSpeedConfig", ".", "lI", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sSpeedConfig", ".", "lI", "%", "65536", ")", "*", "1000", ")", "+", "32768", ")", "/", "65536", ")", ")", ";", "}", "if", "(", "CANReadParameter", "(", "LM_API_SPD_DC", ",", "0", ",", "(", "unsigned", "long", "*", ")", "&", "(", "g_sSpeedConfig", ".", "lD", ")", ",", "0", ")", "==", "0", ")", "{", "g_sSpeedConfig", ".", "lD", "=", "0", ";", "}", "else", "if", "(", "g_sSpeedConfig", ".", "lD", "<", "0", ")", "{", "g_sSpeedConfig", ".", "lD", "=", "(", "(", "(", "g_sSpeedConfig", ".", "lD", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sSpeedConfig", ".", "lD", "%", "65536", ")", "*", "1000", ")", "-", "32768", ")", "/", "65536", ")", ")", ";", "}", "else", "{", "g_sSpeedConfig", ".", "lD", "=", "(", "(", "(", "g_sSpeedConfig", ".", "lD", "/", "65536", ")", "*", "1000", ")", "+", "(", "(", "(", "(", "g_sSpeedConfig", ".", "lD", "%", "65536", ")", "*", "1000", ")", "+", "32768", ")", "/", "65536", ")", ")", ";", "}", "if", "(", "CANReadParameter", "(", "LM_API_SPD_REF", ",", "0", ",", "&", "(", "g_sSpeedConfig", ".", "ulSpeedRef", ")", ",", "0", ")", "==", "0", ")", "{", "g_sSpeedConfig", ".", "ulSpeedRef", "=", "0", ";", "}", "else", "{", "g_sSpeedConfig", ".", "ulSpeedRef", "&=", "3", ";", "if", "(", "g_sSpeedConfig", ".", "ulSpeedRef", ")", "{", "g_sSpeedConfig", ".", "ulSpeedRef", "--", ";", "}", "}", "}" ]
Reads the configuration of the speed control mode of the current motor controller.
[ "Reads", "the", "configuration", "of", "the", "speed", "control", "mode", "of", "the", "current", "motor", "controller", "." ]
[ "//\r", "// Read the PID controller's P coefficient.\r", "//\r", "//\r", "// Read the PID controller's I coefficient.\r", "//\r", "//\r", "// Read the PID controller's D coefficient.\r", "//\r", "//\r", "// Read the speed reference source.\r", "//\r" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Raw
void
void TI_CAPT_Raw(const tSensor* groupOfElements, unsigned long * counts) { CapSenseSystickRC(groupOfElements, counts); }
//***************************************************************************** // //! Measure the capacitance of each element within the Sensor //! //! \param groupOfElements Pointer to Sensor structure to be measured //! //! \param counts Address to where the measurements are to be written //! //! This function selects the appropriate HAL to perform the capacitance //! measurement based upon the halDefinition found in the sensor structure. //! The order of the elements within the Sensor structure is arbitrary but must //! be consistent between the application and configuration. The first element //! in the array (counts) corresponds to the first element within the Sensor //! structure. //! //! \return None. // //*****************************************************************************
Measure the capacitance of each element within the Sensor \param groupOfElements Pointer to Sensor structure to be measured \param counts Address to where the measurements are to be written This function selects the appropriate HAL to perform the capacitance measurement based upon the halDefinition found in the sensor structure. The order of the elements within the Sensor structure is arbitrary but must be consistent between the application and configuration. The first element in the array (counts) corresponds to the first element within the Sensor structure. \return None.
[ "Measure", "the", "capacitance", "of", "each", "element", "within", "the", "Sensor", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured", "\\", "param", "counts", "Address", "to", "where", "the", "measurements", "are", "to", "be", "written", "This", "function", "selects", "the", "appropriate", "HAL", "to", "perform", "the", "capacitance", "measurement", "based", "upon", "the", "halDefinition", "found", "in", "the", "sensor", "structure", ".", "The", "order", "of", "the", "elements", "within", "the", "Sensor", "structure", "is", "arbitrary", "but", "must", "be", "consistent", "between", "the", "application", "and", "configuration", ".", "The", "first", "element", "in", "the", "array", "(", "counts", ")", "corresponds", "to", "the", "first", "element", "within", "the", "Sensor", "structure", ".", "\\", "return", "None", "." ]
void TI_CAPT_Raw(const tSensor* groupOfElements, unsigned long * counts) { CapSenseSystickRC(groupOfElements, counts); }
[ "void", "TI_CAPT_Raw", "(", "const", "tSensor", "*", "groupOfElements", ",", "unsigned", "long", "*", "counts", ")", "{", "CapSenseSystickRC", "(", "groupOfElements", ",", "counts", ")", ";", "}" ]
Measure the capacitance of each element within the Sensor \param groupOfElements Pointer to Sensor structure to be measured
[ "Measure", "the", "capacitance", "of", "each", "element", "within", "the", "Sensor", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured" ]
[]
[ { "param": "groupOfElements", "type": "tSensor" }, { "param": "counts", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "counts", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Init_Baseline
void
void TI_CAPT_Init_Baseline(const tSensor* groupOfElements) { TI_CAPT_Raw(groupOfElements, &baseCnt[groupOfElements->ulBaseOffset]); }
//***************************************************************************** // //! Make a single capacitance meausrment to initialize baseline tracking //! //! \param groupOfElements Pointer to Sensor structure to be measured //! //! \return none // //*****************************************************************************
Make a single capacitance meausrment to initialize baseline tracking \param groupOfElements Pointer to Sensor structure to be measured \return none
[ "Make", "a", "single", "capacitance", "meausrment", "to", "initialize", "baseline", "tracking", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured", "\\", "return", "none" ]
void TI_CAPT_Init_Baseline(const tSensor* groupOfElements) { TI_CAPT_Raw(groupOfElements, &baseCnt[groupOfElements->ulBaseOffset]); }
[ "void", "TI_CAPT_Init_Baseline", "(", "const", "tSensor", "*", "groupOfElements", ")", "{", "TI_CAPT_Raw", "(", "groupOfElements", ",", "&", "baseCnt", "[", "groupOfElements", "->", "ulBaseOffset", "]", ")", ";", "}" ]
Make a single capacitance meausrment to initialize baseline tracking \param groupOfElements Pointer to Sensor structure to be measured
[ "Make", "a", "single", "capacitance", "meausrment", "to", "initialize", "baseline", "tracking", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured" ]
[]
[ { "param": "groupOfElements", "type": "tSensor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Update_Baseline
void
void TI_CAPT_Update_Baseline(const tSensor* groupOfElements, unsigned char numberOfAverages) { unsigned char i,j; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif for(j=0; j < numberOfAverages; j++) { for(i=0; i < groupOfElements->ucNumElements; i++) { TI_CAPT_Raw(groupOfElements, measCnt); baseCnt[i+groupOfElements->ulBaseOffset] = measCnt[i]/2 + baseCnt[i+groupOfElements->ulBaseOffset]/2; } } #ifndef RAM_FOR_FLASH free(measCnt); #endif }
//***************************************************************************** // //! Update baseline tracking by averaging several measurements //! //! \param groupOfElements Pointer to Sensor structure to be measured //! //! \param numberOfAverages Number of measurements to be averaged //! //! \return none // //*****************************************************************************
Update baseline tracking by averaging several measurements \param groupOfElements Pointer to Sensor structure to be measured \param numberOfAverages Number of measurements to be averaged \return none
[ "Update", "baseline", "tracking", "by", "averaging", "several", "measurements", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured", "\\", "param", "numberOfAverages", "Number", "of", "measurements", "to", "be", "averaged", "\\", "return", "none" ]
void TI_CAPT_Update_Baseline(const tSensor* groupOfElements, unsigned char numberOfAverages) { unsigned char i,j; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif for(j=0; j < numberOfAverages; j++) { for(i=0; i < groupOfElements->ucNumElements; i++) { TI_CAPT_Raw(groupOfElements, measCnt); baseCnt[i+groupOfElements->ulBaseOffset] = measCnt[i]/2 + baseCnt[i+groupOfElements->ulBaseOffset]/2; } } #ifndef RAM_FOR_FLASH free(measCnt); #endif }
[ "void", "TI_CAPT_Update_Baseline", "(", "const", "tSensor", "*", "groupOfElements", ",", "unsigned", "char", "numberOfAverages", ")", "{", "unsigned", "char", "i", ",", "j", ";", "#ifndef", "RAM_FOR_FLASH", "unsigned", "long", "*", "measCnt", ";", "measCnt", "=", "(", "unsigned", "long", "*", ")", "malloc", "(", "groupOfElements", "->", "ucNumElements", "*", "sizeof", "(", "unsigned", "long", ")", ")", ";", "if", "(", "measCnt", "==", "0", ")", "{", "while", "(", "1", ")", ";", "}", "#endif", "for", "(", "j", "=", "0", ";", "j", "<", "numberOfAverages", ";", "j", "++", ")", "{", "for", "(", "i", "=", "0", ";", "i", "<", "groupOfElements", "->", "ucNumElements", ";", "i", "++", ")", "{", "TI_CAPT_Raw", "(", "groupOfElements", ",", "measCnt", ")", ";", "baseCnt", "[", "i", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "measCnt", "[", "i", "]", "/", "2", "+", "baseCnt", "[", "i", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "2", ";", "}", "}", "#ifndef", "RAM_FOR_FLASH", "free", "(", "measCnt", ")", ";", "#endif", "}" ]
Update baseline tracking by averaging several measurements \param groupOfElements Pointer to Sensor structure to be measured
[ "Update", "baseline", "tracking", "by", "averaging", "several", "measurements", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured" ]
[]
[ { "param": "groupOfElements", "type": "tSensor" }, { "param": "numberOfAverages", "type": "unsigned char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "numberOfAverages", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Reset_Tracking
void
void TI_CAPT_Reset_Tracking(void) { ctsStatusReg = (DOI_INC+TRADOI_FAST+TRIDOI_SLOW); }
//***************************************************************************** //! Reset the Baseline Tracking algorithm to the default state //! //! \return none // //*****************************************************************************
Reset the Baseline Tracking algorithm to the default state \return none
[ "Reset", "the", "Baseline", "Tracking", "algorithm", "to", "the", "default", "state", "\\", "return", "none" ]
void TI_CAPT_Reset_Tracking(void) { ctsStatusReg = (DOI_INC+TRADOI_FAST+TRIDOI_SLOW); }
[ "void", "TI_CAPT_Reset_Tracking", "(", "void", ")", "{", "ctsStatusReg", "=", "(", "DOI_INC", "+", "TRADOI_FAST", "+", "TRIDOI_SLOW", ")", ";", "}" ]
Reset the Baseline Tracking algorithm to the default state \return none
[ "Reset", "the", "Baseline", "Tracking", "algorithm", "to", "the", "default", "state", "\\", "return", "none" ]
[]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Update_Tracking_DOI
void
void TI_CAPT_Update_Tracking_DOI(unsigned char direction) { if(direction) { ctsStatusReg |= DOI_INC; } else { ctsStatusReg &= ~DOI_INC; } }
//***************************************************************************** // //! Update the Baseline Tracking algorithm Direction of Interest //! //! \param direction Direction of increasing or decreasing capacitance //! //! \return none // //*****************************************************************************
Update the Baseline Tracking algorithm Direction of Interest \param direction Direction of increasing or decreasing capacitance \return none
[ "Update", "the", "Baseline", "Tracking", "algorithm", "Direction", "of", "Interest", "\\", "param", "direction", "Direction", "of", "increasing", "or", "decreasing", "capacitance", "\\", "return", "none" ]
void TI_CAPT_Update_Tracking_DOI(unsigned char direction) { if(direction) { ctsStatusReg |= DOI_INC; } else { ctsStatusReg &= ~DOI_INC; } }
[ "void", "TI_CAPT_Update_Tracking_DOI", "(", "unsigned", "char", "direction", ")", "{", "if", "(", "direction", ")", "{", "ctsStatusReg", "|=", "DOI_INC", ";", "}", "else", "{", "ctsStatusReg", "&=", "~", "DOI_INC", ";", "}", "}" ]
Update the Baseline Tracking algorithm Direction of Interest \param direction Direction of increasing or decreasing capacitance
[ "Update", "the", "Baseline", "Tracking", "algorithm", "Direction", "of", "Interest", "\\", "param", "direction", "Direction", "of", "increasing", "or", "decreasing", "capacitance" ]
[]
[ { "param": "direction", "type": "unsigned char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "direction", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Update_Tracking_Rate
void
void TI_CAPT_Update_Tracking_Rate(unsigned char rate) { ctsStatusReg &= ~(TRIDOI_FAST+TRADOI_VSLOW); // clear fields ctsStatusReg |= (rate & 0xF0); // update fields }
//***************************************************************************** // //! Update the baseling tracking algorithm tracking rates //! //! \param rate Rate of tracking changes in and against direction of intrest //! //! \return none // //*****************************************************************************
Update the baseling tracking algorithm tracking rates \param rate Rate of tracking changes in and against direction of intrest \return none
[ "Update", "the", "baseling", "tracking", "algorithm", "tracking", "rates", "\\", "param", "rate", "Rate", "of", "tracking", "changes", "in", "and", "against", "direction", "of", "intrest", "\\", "return", "none" ]
void TI_CAPT_Update_Tracking_Rate(unsigned char rate) { ctsStatusReg &= ~(TRIDOI_FAST+TRADOI_VSLOW); ctsStatusReg |= (rate & 0xF0); }
[ "void", "TI_CAPT_Update_Tracking_Rate", "(", "unsigned", "char", "rate", ")", "{", "ctsStatusReg", "&=", "~", "(", "TRIDOI_FAST", "+", "TRADOI_VSLOW", ")", ";", "ctsStatusReg", "|=", "(", "rate", "&", "0xF0", ")", ";", "}" ]
Update the baseling tracking algorithm tracking rates \param rate Rate of tracking changes in and against direction of intrest
[ "Update", "the", "baseling", "tracking", "algorithm", "tracking", "rates", "\\", "param", "rate", "Rate", "of", "tracking", "changes", "in", "and", "against", "direction", "of", "intrest" ]
[ "// clear fields", "// update fields" ]
[ { "param": "rate", "type": "unsigned char" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "rate", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Custom
void
void TI_CAPT_Custom(const tSensor* groupOfElements, unsigned long * deltaCnt) { unsigned char j; unsigned long tempCnt; ctsStatusReg &= ~ EVNT; // This section calculates the delta counts************************************* //****************************************************************************** TI_CAPT_Raw(groupOfElements, &deltaCnt[0]); // measure group of sensors for (j = 0; j < (groupOfElements->ucNumElements); j++) { tempCnt = deltaCnt[j]; if((!(ctsStatusReg & DOI_MASK))) { // RO method, interested in an increase in capacitance if(baseCnt[j+groupOfElements->ulBaseOffset] < deltaCnt[j]) { // If capacitance decreases, then measCnt is greater than base // , set delta to zero deltaCnt[j] = 0; // Limit the change in the opposite direction to the threshold if(((groupOfElements->Element[j])->ulThreshold) && (baseCnt[j+groupOfElements->ulBaseOffset]+(groupOfElements->Element[j])->ulThreshold < tempCnt)) { tempCnt = baseCnt[j+groupOfElements->ulBaseOffset]+(groupOfElements->Element[j])->ulThreshold; } } else { // change occuring in our DOI, save result deltaCnt[j] = baseCnt[j+groupOfElements->ulBaseOffset]-deltaCnt[j]; } } if(((ctsStatusReg & DOI_MASK))) { // RO method: interested in a decrease in capactiance // measCnt is greater than baseCnt if(baseCnt[j+groupOfElements->ulBaseOffset] > deltaCnt[j]) { // If capacitance increases, set delta to zero deltaCnt[j] = 0; // Limit the change in the opposite direction to the threshold if(((groupOfElements->Element[j])->ulThreshold) && (baseCnt[j+groupOfElements->ulBaseOffset] > tempCnt+(groupOfElements->Element[j])->ulThreshold)) { tempCnt = baseCnt[j+groupOfElements->ulBaseOffset]-(groupOfElements->Element[j])->ulThreshold; } } else { // change occuring in our DOI deltaCnt[j] = deltaCnt[j] - baseCnt[j+groupOfElements->ulBaseOffset]; } } // This section updates the baseline capacitance**************************** //************************************************************************** if (deltaCnt[j]==0) { // if delta counts is 0, then the change in capacitance was opposite the // direction of interest. The baseCnt[i] is updated with the saved // measCnt value for the current index value 'i'. switch ((ctsStatusReg & TRADOI_VSLOW)) { case TRADOI_FAST://Fast tempCnt = tempCnt/2; baseCnt[j+groupOfElements->ulBaseOffset] = (baseCnt[j+groupOfElements->ulBaseOffset]/2); break; case TRADOI_MED://Medium tempCnt = tempCnt/4; baseCnt[j+groupOfElements->ulBaseOffset] = 3*(baseCnt[j+groupOfElements->ulBaseOffset]/4); break; case TRADOI_SLOW://slow tempCnt = tempCnt/64; baseCnt[j+groupOfElements->ulBaseOffset] = 63*(baseCnt[j+groupOfElements->ulBaseOffset]/64); break; case TRADOI_VSLOW://very slow tempCnt = tempCnt/128; baseCnt[j+groupOfElements->ulBaseOffset] = 127*(baseCnt[j+groupOfElements->ulBaseOffset]/128); break; } // set X, Y & Z, then perform calculation for baseline tracking: // Base_Capacitance = X*(Measured_Capacitance/Z) + Y*(Base_Capacitance/Z) baseCnt[j+groupOfElements->ulBaseOffset] = (tempCnt)+(baseCnt[j+groupOfElements->ulBaseOffset]); } // delta counts are either 0, less than threshold, or greater than threshold // never negative else if(deltaCnt[j]<(groupOfElements->Element[j])->ulThreshold && !(ctsStatusReg & PAST_EVNT)) { //if delta counts is positive but less than threshold, switch ((ctsStatusReg & TRIDOI_FAST)) { case TRIDOI_VSLOW://very slow if(deltaCnt[j] > 15) { if(tempCnt < baseCnt[j+groupOfElements->ulBaseOffset]) { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] - 1; } else { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] + 1; } } tempCnt = 0; break; case TRIDOI_SLOW://slow if(tempCnt < baseCnt[j+groupOfElements->ulBaseOffset]) { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] - 1; } else { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] + 1; } tempCnt = 0; break; case TRIDOI_MED://medium tempCnt = tempCnt/4; baseCnt[j+groupOfElements->ulBaseOffset] = 3*(baseCnt[j+groupOfElements->ulBaseOffset]/4); break; case TRIDOI_FAST://fast tempCnt = tempCnt/2; baseCnt[j+groupOfElements->ulBaseOffset] = (baseCnt[j+groupOfElements->ulBaseOffset]/2); break; } // set X, Y & Z, then perform calculation for baseline tracking: // Base_Capacitance = X*(Measured_Capacitance/Z) + Y*(Base_Capacitance/Z) baseCnt[j+groupOfElements->ulBaseOffset] = (tempCnt)+(baseCnt[j+groupOfElements->ulBaseOffset]); } //if delta counts above the threshold, event has occurred else if(deltaCnt[j]>=(groupOfElements->Element[j])->ulThreshold) { ctsStatusReg |= EVNT; ctsStatusReg |= PAST_EVNT; } }// end of for-loop if(!(ctsStatusReg & EVNT)) { ctsStatusReg &= ~PAST_EVNT; } }
//***************************************************************************** // //! Measure the change in capacitance of the Sensor //! //! \param groupOfElements Pointer to Sensor structure to be measured //! //! \param deltaCnt Address to where the measurements are to be written //! //! This function measures the change in capacitance of each element within a //! sensor and updates the baseline tracking in the event that no change //! exceeds the detection threshold. The order of the elements within the //! Sensor structure is arbitrary but must be consistent between the //! application and configuration. The first element in the array (deltaCnt) //! corresponds to the first element within the Sensor structure. //! //! \return none // //*****************************************************************************
Measure the change in capacitance of the Sensor \param groupOfElements Pointer to Sensor structure to be measured \param deltaCnt Address to where the measurements are to be written This function measures the change in capacitance of each element within a sensor and updates the baseline tracking in the event that no change exceeds the detection threshold. The order of the elements within the Sensor structure is arbitrary but must be consistent between the application and configuration. The first element in the array (deltaCnt) corresponds to the first element within the Sensor structure. \return none
[ "Measure", "the", "change", "in", "capacitance", "of", "the", "Sensor", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured", "\\", "param", "deltaCnt", "Address", "to", "where", "the", "measurements", "are", "to", "be", "written", "This", "function", "measures", "the", "change", "in", "capacitance", "of", "each", "element", "within", "a", "sensor", "and", "updates", "the", "baseline", "tracking", "in", "the", "event", "that", "no", "change", "exceeds", "the", "detection", "threshold", ".", "The", "order", "of", "the", "elements", "within", "the", "Sensor", "structure", "is", "arbitrary", "but", "must", "be", "consistent", "between", "the", "application", "and", "configuration", ".", "The", "first", "element", "in", "the", "array", "(", "deltaCnt", ")", "corresponds", "to", "the", "first", "element", "within", "the", "Sensor", "structure", ".", "\\", "return", "none" ]
void TI_CAPT_Custom(const tSensor* groupOfElements, unsigned long * deltaCnt) { unsigned char j; unsigned long tempCnt; ctsStatusReg &= ~ EVNT; TI_CAPT_Raw(groupOfElements, &deltaCnt[0]); for (j = 0; j < (groupOfElements->ucNumElements); j++) { tempCnt = deltaCnt[j]; if((!(ctsStatusReg & DOI_MASK))) { if(baseCnt[j+groupOfElements->ulBaseOffset] < deltaCnt[j]) { deltaCnt[j] = 0; if(((groupOfElements->Element[j])->ulThreshold) && (baseCnt[j+groupOfElements->ulBaseOffset]+(groupOfElements->Element[j])->ulThreshold < tempCnt)) { tempCnt = baseCnt[j+groupOfElements->ulBaseOffset]+(groupOfElements->Element[j])->ulThreshold; } } else { deltaCnt[j] = baseCnt[j+groupOfElements->ulBaseOffset]-deltaCnt[j]; } } if(((ctsStatusReg & DOI_MASK))) { if(baseCnt[j+groupOfElements->ulBaseOffset] > deltaCnt[j]) { deltaCnt[j] = 0; if(((groupOfElements->Element[j])->ulThreshold) && (baseCnt[j+groupOfElements->ulBaseOffset] > tempCnt+(groupOfElements->Element[j])->ulThreshold)) { tempCnt = baseCnt[j+groupOfElements->ulBaseOffset]-(groupOfElements->Element[j])->ulThreshold; } } else { deltaCnt[j] = deltaCnt[j] - baseCnt[j+groupOfElements->ulBaseOffset]; } } if (deltaCnt[j]==0) { switch ((ctsStatusReg & TRADOI_VSLOW)) { case TRADOI_FAST: tempCnt = tempCnt/2; baseCnt[j+groupOfElements->ulBaseOffset] = (baseCnt[j+groupOfElements->ulBaseOffset]/2); break; case TRADOI_MED: tempCnt = tempCnt/4; baseCnt[j+groupOfElements->ulBaseOffset] = 3*(baseCnt[j+groupOfElements->ulBaseOffset]/4); break; case TRADOI_SLOW: tempCnt = tempCnt/64; baseCnt[j+groupOfElements->ulBaseOffset] = 63*(baseCnt[j+groupOfElements->ulBaseOffset]/64); break; case TRADOI_VSLOW: tempCnt = tempCnt/128; baseCnt[j+groupOfElements->ulBaseOffset] = 127*(baseCnt[j+groupOfElements->ulBaseOffset]/128); break; } baseCnt[j+groupOfElements->ulBaseOffset] = (tempCnt)+(baseCnt[j+groupOfElements->ulBaseOffset]); } else if(deltaCnt[j]<(groupOfElements->Element[j])->ulThreshold && !(ctsStatusReg & PAST_EVNT)) { switch ((ctsStatusReg & TRIDOI_FAST)) { case TRIDOI_VSLOW: if(deltaCnt[j] > 15) { if(tempCnt < baseCnt[j+groupOfElements->ulBaseOffset]) { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] - 1; } else { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] + 1; } } tempCnt = 0; break; case TRIDOI_SLOW: if(tempCnt < baseCnt[j+groupOfElements->ulBaseOffset]) { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] - 1; } else { baseCnt[j+groupOfElements->ulBaseOffset] = baseCnt[j+groupOfElements->ulBaseOffset] + 1; } tempCnt = 0; break; case TRIDOI_MED: tempCnt = tempCnt/4; baseCnt[j+groupOfElements->ulBaseOffset] = 3*(baseCnt[j+groupOfElements->ulBaseOffset]/4); break; case TRIDOI_FAST: tempCnt = tempCnt/2; baseCnt[j+groupOfElements->ulBaseOffset] = (baseCnt[j+groupOfElements->ulBaseOffset]/2); break; } baseCnt[j+groupOfElements->ulBaseOffset] = (tempCnt)+(baseCnt[j+groupOfElements->ulBaseOffset]); } else if(deltaCnt[j]>=(groupOfElements->Element[j])->ulThreshold) { ctsStatusReg |= EVNT; ctsStatusReg |= PAST_EVNT; } } if(!(ctsStatusReg & EVNT)) { ctsStatusReg &= ~PAST_EVNT; } }
[ "void", "TI_CAPT_Custom", "(", "const", "tSensor", "*", "groupOfElements", ",", "unsigned", "long", "*", "deltaCnt", ")", "{", "unsigned", "char", "j", ";", "unsigned", "long", "tempCnt", ";", "ctsStatusReg", "&=", "~", "EVNT", ";", "TI_CAPT_Raw", "(", "groupOfElements", ",", "&", "deltaCnt", "[", "0", "]", ")", ";", "for", "(", "j", "=", "0", ";", "j", "<", "(", "groupOfElements", "->", "ucNumElements", ")", ";", "j", "++", ")", "{", "tempCnt", "=", "deltaCnt", "[", "j", "]", ";", "if", "(", "(", "!", "(", "ctsStatusReg", "&", "DOI_MASK", ")", ")", ")", "{", "if", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "<", "deltaCnt", "[", "j", "]", ")", "{", "deltaCnt", "[", "j", "]", "=", "0", ";", "if", "(", "(", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", ")", "&&", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "+", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", "<", "tempCnt", ")", ")", "{", "tempCnt", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "+", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", ";", "}", "}", "else", "{", "deltaCnt", "[", "j", "]", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "-", "deltaCnt", "[", "j", "]", ";", "}", "}", "if", "(", "(", "(", "ctsStatusReg", "&", "DOI_MASK", ")", ")", ")", "{", "if", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ">", "deltaCnt", "[", "j", "]", ")", "{", "deltaCnt", "[", "j", "]", "=", "0", ";", "if", "(", "(", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", ")", "&&", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ">", "tempCnt", "+", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", ")", ")", "{", "tempCnt", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "-", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", ";", "}", "}", "else", "{", "deltaCnt", "[", "j", "]", "=", "deltaCnt", "[", "j", "]", "-", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ";", "}", "}", "if", "(", "deltaCnt", "[", "j", "]", "==", "0", ")", "{", "switch", "(", "(", "ctsStatusReg", "&", "TRADOI_VSLOW", ")", ")", "{", "case", "TRADOI_FAST", ":", "tempCnt", "=", "tempCnt", "/", "2", ";", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "2", ")", ";", "break", ";", "case", "TRADOI_MED", ":", "tempCnt", "=", "tempCnt", "/", "4", ";", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "3", "*", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "4", ")", ";", "break", ";", "case", "TRADOI_SLOW", ":", "tempCnt", "=", "tempCnt", "/", "64", ";", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "63", "*", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "64", ")", ";", "break", ";", "case", "TRADOI_VSLOW", ":", "tempCnt", "=", "tempCnt", "/", "128", ";", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "127", "*", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "128", ")", ";", "break", ";", "}", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "(", "tempCnt", ")", "+", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ")", ";", "}", "else", "if", "(", "deltaCnt", "[", "j", "]", "<", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", "&&", "!", "(", "ctsStatusReg", "&", "PAST_EVNT", ")", ")", "{", "switch", "(", "(", "ctsStatusReg", "&", "TRIDOI_FAST", ")", ")", "{", "case", "TRIDOI_VSLOW", ":", "if", "(", "deltaCnt", "[", "j", "]", ">", "15", ")", "{", "if", "(", "tempCnt", "<", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ")", "{", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "-", "1", ";", "}", "else", "{", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "+", "1", ";", "}", "}", "tempCnt", "=", "0", ";", "break", ";", "case", "TRIDOI_SLOW", ":", "if", "(", "tempCnt", "<", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ")", "{", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "-", "1", ";", "}", "else", "{", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "+", "1", ";", "}", "tempCnt", "=", "0", ";", "break", ";", "case", "TRIDOI_MED", ":", "tempCnt", "=", "tempCnt", "/", "4", ";", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "3", "*", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "4", ")", ";", "break", ";", "case", "TRIDOI_FAST", ":", "tempCnt", "=", "tempCnt", "/", "2", ";", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "/", "2", ")", ";", "break", ";", "}", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", "=", "(", "tempCnt", ")", "+", "(", "baseCnt", "[", "j", "+", "groupOfElements", "->", "ulBaseOffset", "]", ")", ";", "}", "else", "if", "(", "deltaCnt", "[", "j", "]", ">=", "(", "groupOfElements", "->", "Element", "[", "j", "]", ")", "->", "ulThreshold", ")", "{", "ctsStatusReg", "|=", "EVNT", ";", "ctsStatusReg", "|=", "PAST_EVNT", ";", "}", "}", "if", "(", "!", "(", "ctsStatusReg", "&", "EVNT", ")", ")", "{", "ctsStatusReg", "&=", "~", "PAST_EVNT", ";", "}", "}" ]
Measure the change in capacitance of the Sensor \param groupOfElements Pointer to Sensor structure to be measured
[ "Measure", "the", "change", "in", "capacitance", "of", "the", "Sensor", "\\", "param", "groupOfElements", "Pointer", "to", "Sensor", "structure", "to", "be", "measured" ]
[ "// This section calculates the delta counts*************************************", "//******************************************************************************", "// measure group of sensors", "// RO method, interested in an increase in capacitance", "// If capacitance decreases, then measCnt is greater than base", "// , set delta to zero", "// Limit the change in the opposite direction to the threshold", "// change occuring in our DOI, save result", "// RO method: interested in a decrease in capactiance", "// measCnt is greater than baseCnt", "// If capacitance increases, set delta to zero", "// Limit the change in the opposite direction to the threshold", "// change occuring in our DOI", "// This section updates the baseline capacitance****************************", "//************************************************************************** ", "// if delta counts is 0, then the change in capacitance was opposite the", "// direction of interest. The baseCnt[i] is updated with the saved ", "// measCnt value for the current index value 'i'.", "//Fast", "//Medium", "//slow", "//very slow", "// set X, Y & Z, then perform calculation for baseline tracking:", "// Base_Capacitance = X*(Measured_Capacitance/Z) + Y*(Base_Capacitance/Z)", "// delta counts are either 0, less than threshold, or greater than threshold", "// never negative", "//if delta counts is positive but less than threshold,", "//very slow", "//slow", "//medium", "//fast", "// set X, Y & Z, then perform calculation for baseline tracking:", "// Base_Capacitance = X*(Measured_Capacitance/Z) + Y*(Base_Capacitance/Z)", "//if delta counts above the threshold, event has occurred", "// end of for-loop" ]
[ { "param": "groupOfElements", "type": "tSensor" }, { "param": "deltaCnt", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "deltaCnt", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Button
null
unsigned char TI_CAPT_Button(const tSensor * groupOfElements) { unsigned char result = 0; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif TI_CAPT_Custom(groupOfElements, measCnt); #ifndef RAM_FOR_FLASH free(measCnt); #endif if(ctsStatusReg & EVNT) { result = 1; } return result; }
//***************************************************************************** // //! Determine if a button is being pressed //! //! \param groupOfElements Pointer to button to be scanned //! //! \return result Indication if button is (1) or is not (0) being pressed //! // //*****************************************************************************
Determine if a button is being pressed \param groupOfElements Pointer to button to be scanned \return result Indication if button is (1) or is not (0) being pressed
[ "Determine", "if", "a", "button", "is", "being", "pressed", "\\", "param", "groupOfElements", "Pointer", "to", "button", "to", "be", "scanned", "\\", "return", "result", "Indication", "if", "button", "is", "(", "1", ")", "or", "is", "not", "(", "0", ")", "being", "pressed" ]
unsigned char TI_CAPT_Button(const tSensor * groupOfElements) { unsigned char result = 0; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif TI_CAPT_Custom(groupOfElements, measCnt); #ifndef RAM_FOR_FLASH free(measCnt); #endif if(ctsStatusReg & EVNT) { result = 1; } return result; }
[ "unsigned", "char", "TI_CAPT_Button", "(", "const", "tSensor", "*", "groupOfElements", ")", "{", "unsigned", "char", "result", "=", "0", ";", "#ifndef", "RAM_FOR_FLASH", "unsigned", "long", "*", "measCnt", ";", "measCnt", "=", "(", "unsigned", "long", "*", ")", "malloc", "(", "groupOfElements", "->", "ucNumElements", "*", "sizeof", "(", "unsigned", "long", ")", ")", ";", "if", "(", "measCnt", "==", "0", ")", "{", "while", "(", "1", ")", ";", "}", "#endif", "TI_CAPT_Custom", "(", "groupOfElements", ",", "measCnt", ")", ";", "#ifndef", "RAM_FOR_FLASH", "free", "(", "measCnt", ")", ";", "#endif", "if", "(", "ctsStatusReg", "&", "EVNT", ")", "{", "result", "=", "1", ";", "}", "return", "result", ";", "}" ]
Determine if a button is being pressed \param groupOfElements Pointer to button to be scanned
[ "Determine", "if", "a", "button", "is", "being", "pressed", "\\", "param", "groupOfElements", "Pointer", "to", "button", "to", "be", "scanned" ]
[]
[ { "param": "groupOfElements", "type": "tSensor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Buttons
tCapTouchElement
const tCapTouchElement * TI_CAPT_Buttons(const tSensor *groupOfElements) { unsigned char index; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif TI_CAPT_Custom(groupOfElements, measCnt); if(ctsStatusReg & EVNT) { index = Dominant_Element(groupOfElements, measCnt); //ctsStatusReg &= ~EVNT; index++; } else { index = 0; } #ifndef RAM_FOR_FLASH free(measCnt); #endif if(index) { return groupOfElements->Element[index-1]; } return 0; }
//***************************************************************************** // //! \brief Determine which button if any is being pressed //! //! \param groupOfElements Pointer to buttons to be scanned //! //! \return result pointer to element (button) being pressed or 0 none // //*****************************************************************************
\brief Determine which button if any is being pressed \param groupOfElements Pointer to buttons to be scanned \return result pointer to element (button) being pressed or 0 none
[ "\\", "brief", "Determine", "which", "button", "if", "any", "is", "being", "pressed", "\\", "param", "groupOfElements", "Pointer", "to", "buttons", "to", "be", "scanned", "\\", "return", "result", "pointer", "to", "element", "(", "button", ")", "being", "pressed", "or", "0", "none" ]
const tCapTouchElement * TI_CAPT_Buttons(const tSensor *groupOfElements) { unsigned char index; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif TI_CAPT_Custom(groupOfElements, measCnt); if(ctsStatusReg & EVNT) { index = Dominant_Element(groupOfElements, measCnt); index++; } else { index = 0; } #ifndef RAM_FOR_FLASH free(measCnt); #endif if(index) { return groupOfElements->Element[index-1]; } return 0; }
[ "const", "tCapTouchElement", "*", "TI_CAPT_Buttons", "(", "const", "tSensor", "*", "groupOfElements", ")", "{", "unsigned", "char", "index", ";", "#ifndef", "RAM_FOR_FLASH", "unsigned", "long", "*", "measCnt", ";", "measCnt", "=", "(", "unsigned", "long", "*", ")", "malloc", "(", "groupOfElements", "->", "ucNumElements", "*", "sizeof", "(", "unsigned", "long", ")", ")", ";", "if", "(", "measCnt", "==", "0", ")", "{", "while", "(", "1", ")", ";", "}", "#endif", "TI_CAPT_Custom", "(", "groupOfElements", ",", "measCnt", ")", ";", "if", "(", "ctsStatusReg", "&", "EVNT", ")", "{", "index", "=", "Dominant_Element", "(", "groupOfElements", ",", "measCnt", ")", ";", "index", "++", ";", "}", "else", "{", "index", "=", "0", ";", "}", "#ifndef", "RAM_FOR_FLASH", "free", "(", "measCnt", ")", ";", "#endif", "if", "(", "index", ")", "{", "return", "groupOfElements", "->", "Element", "[", "index", "-", "1", "]", ";", "}", "return", "0", ";", "}" ]
\brief Determine which button if any is being pressed \param groupOfElements Pointer to buttons to be scanned
[ "\\", "brief", "Determine", "which", "button", "if", "any", "is", "being", "pressed", "\\", "param", "groupOfElements", "Pointer", "to", "buttons", "to", "be", "scanned" ]
[ "//ctsStatusReg &= ~EVNT;" ]
[ { "param": "groupOfElements", "type": "tSensor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Slider
null
unsigned long TI_CAPT_Slider(const tSensor* groupOfElements) { unsigned char index; signed long position; // allocate memory for measurement #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif position = ILLEGAL_SLIDER_WHEEL_POSITION; //make measurement TI_CAPT_Custom(groupOfElements, measCnt); // Use EVNT flag to determine if slider was touched. // The EVNT flag is a global variable and managed within the TI_CAPT_Custom function. if(ctsStatusReg & EVNT) { index = Dominant_Element(groupOfElements, &measCnt[0]); // The index represents the element within the array with the highest return. if(index == 0) { // Special case of 1st element in slider, add 1st, last, and 2nd position = measCnt[0] + measCnt[1]; } else if(index == (groupOfElements->ucNumElements -1)) { // Special case of Last element in slider, add last, 1st, and 2nd to last position = measCnt[groupOfElements->ucNumElements -1] + measCnt[groupOfElements->ucNumElements -2]; } else { position = measCnt[index] + measCnt[index+1] + measCnt[index-1]; } // Determine if sensor threshold criteria is met if(position > groupOfElements->ulSensorThreshold) { // calculate position position = index*(groupOfElements->ucPoints/groupOfElements->ucNumElements); position += (groupOfElements->ucPoints/groupOfElements->ucNumElements)/2; if(index == 0) { // Special case of 1st element in slider, which only has one // neighbor, measCnt[1]. measCnt is limited to ulMaxResponse // within dominantElement function if(measCnt[1]) { position += (measCnt[1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } else { position = (measCnt[0]*(groupOfElements->ucPoints/groupOfElements->ucNumElements)/2)/100; } } else if(index == (groupOfElements->ucNumElements -1)) { // Special case of Last element in slider, which only has one // neighbor, measCnt[x-1] or measCnt[ucNumElements-1] if(measCnt[index-1]) { position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } else { position = groupOfElements->ucPoints; position -= (measCnt[index]*(groupOfElements->ucPoints/groupOfElements->ucNumElements)/2)/100; } } else { position += (measCnt[index+1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } if((position > groupOfElements->ucPoints) || (position < 0)) { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } else { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } #ifndef RAM_FOR_FLASH free(measCnt); #endif return position; }
//***************************************************************************** // //! Determine the position on a slider // //! \param groupOfElements Pointer to slider // //! \return result position on slider or illegal value if no touch // //*****************************************************************************
Determine the position on a slider \param groupOfElements Pointer to slider \return result position on slider or illegal value if no touch
[ "Determine", "the", "position", "on", "a", "slider", "\\", "param", "groupOfElements", "Pointer", "to", "slider", "\\", "return", "result", "position", "on", "slider", "or", "illegal", "value", "if", "no", "touch" ]
unsigned long TI_CAPT_Slider(const tSensor* groupOfElements) { unsigned char index; signed long position; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif position = ILLEGAL_SLIDER_WHEEL_POSITION; TI_CAPT_Custom(groupOfElements, measCnt); if(ctsStatusReg & EVNT) { index = Dominant_Element(groupOfElements, &measCnt[0]); if(index == 0) { position = measCnt[0] + measCnt[1]; } else if(index == (groupOfElements->ucNumElements -1)) { position = measCnt[groupOfElements->ucNumElements -1] + measCnt[groupOfElements->ucNumElements -2]; } else { position = measCnt[index] + measCnt[index+1] + measCnt[index-1]; } if(position > groupOfElements->ulSensorThreshold) { position = index*(groupOfElements->ucPoints/groupOfElements->ucNumElements); position += (groupOfElements->ucPoints/groupOfElements->ucNumElements)/2; if(index == 0) { if(measCnt[1]) { position += (measCnt[1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } else { position = (measCnt[0]*(groupOfElements->ucPoints/groupOfElements->ucNumElements)/2)/100; } } else if(index == (groupOfElements->ucNumElements -1)) { if(measCnt[index-1]) { position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } else { position = groupOfElements->ucPoints; position -= (measCnt[index]*(groupOfElements->ucPoints/groupOfElements->ucNumElements)/2)/100; } } else { position += (measCnt[index+1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } if((position > groupOfElements->ucPoints) || (position < 0)) { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } else { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } #ifndef RAM_FOR_FLASH free(measCnt); #endif return position; }
[ "unsigned", "long", "TI_CAPT_Slider", "(", "const", "tSensor", "*", "groupOfElements", ")", "{", "unsigned", "char", "index", ";", "signed", "long", "position", ";", "#ifndef", "RAM_FOR_FLASH", "unsigned", "long", "*", "measCnt", ";", "measCnt", "=", "(", "unsigned", "long", "*", ")", "malloc", "(", "groupOfElements", "->", "ucNumElements", "*", "sizeof", "(", "unsigned", "long", ")", ")", ";", "if", "(", "measCnt", "==", "0", ")", "{", "while", "(", "1", ")", ";", "}", "#endif", "position", "=", "ILLEGAL_SLIDER_WHEEL_POSITION", ";", "TI_CAPT_Custom", "(", "groupOfElements", ",", "measCnt", ")", ";", "if", "(", "ctsStatusReg", "&", "EVNT", ")", "{", "index", "=", "Dominant_Element", "(", "groupOfElements", ",", "&", "measCnt", "[", "0", "]", ")", ";", "if", "(", "index", "==", "0", ")", "{", "position", "=", "measCnt", "[", "0", "]", "+", "measCnt", "[", "1", "]", ";", "}", "else", "if", "(", "index", "==", "(", "groupOfElements", "->", "ucNumElements", "-", "1", ")", ")", "{", "position", "=", "measCnt", "[", "groupOfElements", "->", "ucNumElements", "-", "1", "]", "+", "measCnt", "[", "groupOfElements", "->", "ucNumElements", "-", "2", "]", ";", "}", "else", "{", "position", "=", "measCnt", "[", "index", "]", "+", "measCnt", "[", "index", "+", "1", "]", "+", "measCnt", "[", "index", "-", "1", "]", ";", "}", "if", "(", "position", ">", "groupOfElements", "->", "ulSensorThreshold", ")", "{", "position", "=", "index", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ";", "position", "+=", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", "/", "2", ";", "if", "(", "index", "==", "0", ")", "{", "if", "(", "measCnt", "[", "1", "]", ")", "{", "position", "+=", "(", "measCnt", "[", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "}", "else", "{", "position", "=", "(", "measCnt", "[", "0", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", "/", "2", ")", "/", "100", ";", "}", "}", "else", "if", "(", "index", "==", "(", "groupOfElements", "->", "ucNumElements", "-", "1", ")", ")", "{", "if", "(", "measCnt", "[", "index", "-", "1", "]", ")", "{", "position", "-=", "(", "measCnt", "[", "index", "-", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "}", "else", "{", "position", "=", "groupOfElements", "->", "ucPoints", ";", "position", "-=", "(", "measCnt", "[", "index", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", "/", "2", ")", "/", "100", ";", "}", "}", "else", "{", "position", "+=", "(", "measCnt", "[", "index", "+", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "position", "-=", "(", "measCnt", "[", "index", "-", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "}", "if", "(", "(", "position", ">", "groupOfElements", "->", "ucPoints", ")", "||", "(", "position", "<", "0", ")", ")", "{", "position", "=", "ILLEGAL_SLIDER_WHEEL_POSITION", ";", "}", "}", "else", "{", "position", "=", "ILLEGAL_SLIDER_WHEEL_POSITION", ";", "}", "}", "#ifndef", "RAM_FOR_FLASH", "free", "(", "measCnt", ")", ";", "#endif", "return", "position", ";", "}" ]
Determine the position on a slider \param groupOfElements Pointer to slider
[ "Determine", "the", "position", "on", "a", "slider", "\\", "param", "groupOfElements", "Pointer", "to", "slider" ]
[ "// allocate memory for measurement", "//make measurement", "// Use EVNT flag to determine if slider was touched.", "// The EVNT flag is a global variable and managed within the TI_CAPT_Custom function.", "// The index represents the element within the array with the highest return.", "// Special case of 1st element in slider, add 1st, last, and 2nd", "// Special case of Last element in slider, add last, 1st, and 2nd to last", "// Determine if sensor threshold criteria is met", "// calculate position", "// Special case of 1st element in slider, which only has one ", "// neighbor, measCnt[1]. measCnt is limited to ulMaxResponse ", "// within dominantElement function", "// Special case of Last element in slider, which only has one ", "// neighbor, measCnt[x-1] or measCnt[ucNumElements-1]" ]
[ { "param": "groupOfElements", "type": "tSensor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
a9c546756083e42a0912ba63d39dff2b33b389b3
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_Layer.c
[ "BSD-3-Clause" ]
C
TI_CAPT_Wheel
null
unsigned long TI_CAPT_Wheel(const tSensor* groupOfElements) { unsigned char index; signed long position; // allocate memory for measurement #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif position = ILLEGAL_SLIDER_WHEEL_POSITION; //make measurement TI_CAPT_Custom(groupOfElements, measCnt); // Translate the EVNT flag from an element level EVNT to a sensor level EVNT. // The sensor must read at least 75% cumulative response before indicating a // touch. if(ctsStatusReg & EVNT) { index = Dominant_Element(groupOfElements, &measCnt[0]); // The index represents the element within the array with the highest return. // if(index == 0) { // Special case of 1st element in slider, add 1st, last, and 2nd position = measCnt[0] + measCnt[groupOfElements->ucNumElements -1] + measCnt[1]; } else if(index == (groupOfElements->ucNumElements -1)) { // Special case of Last element in slider, add last, 1st, and 2nd to last position = measCnt[index] + measCnt[0] + measCnt[index-1]; } else { position = measCnt[index] + measCnt[index+1] + measCnt[index-1]; } if(position > groupOfElements->ulSensorThreshold) { //index = Dominant_Element(groupOfElements, &measCnt[0]); // The index represents the element within the array with the highest return. // position = index*(groupOfElements->ucPoints/groupOfElements->ucNumElements); position += (groupOfElements->ucPoints/groupOfElements->ucNumElements)/2; if(index == 0) { // Special case of 1st element in slider, which only has one neighbor, measCnt[1] // measCnt is limited to ulMaxResponse within dominantElement function position += (measCnt[1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[groupOfElements->ucNumElements -1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; if(position < 0) { position = position + (unsigned long)groupOfElements->ucPoints; } } else if(index == (groupOfElements->ucNumElements -1)) { // Special case of Last element in slider, which only has one neighbor, measCnt[x-1] or measCnt[ucNumElements-1] // measCnt is limited to ulMaxResponse within dominantElement function position += (measCnt[0]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; if(position > (groupOfElements->ucPoints -1)) { position = position - (unsigned long)groupOfElements->ucPoints; } } else { position += (measCnt[index+1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } if((position > groupOfElements->ucPoints) || position < 0) { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } else { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } #ifndef RAM_FOR_FLASH free(measCnt); #endif return position; }
//***************************************************************************** // //! Determine the position on a wheel // //! \param groupOfElements Pointer to wheel // //! \return result position on wheel or illegal value if no touch // //*****************************************************************************
Determine the position on a wheel \param groupOfElements Pointer to wheel \return result position on wheel or illegal value if no touch
[ "Determine", "the", "position", "on", "a", "wheel", "\\", "param", "groupOfElements", "Pointer", "to", "wheel", "\\", "return", "result", "position", "on", "wheel", "or", "illegal", "value", "if", "no", "touch" ]
unsigned long TI_CAPT_Wheel(const tSensor* groupOfElements) { unsigned char index; signed long position; #ifndef RAM_FOR_FLASH unsigned long *measCnt; measCnt = (unsigned long *)malloc(groupOfElements->ucNumElements * sizeof(unsigned long)); if(measCnt ==0) { while(1); } #endif position = ILLEGAL_SLIDER_WHEEL_POSITION; TI_CAPT_Custom(groupOfElements, measCnt); if(ctsStatusReg & EVNT) { index = Dominant_Element(groupOfElements, &measCnt[0]); if(index == 0) { Special case of 1st element in slider, add 1st, last, and 2nd position = measCnt[0] + measCnt[groupOfElements->ucNumElements -1] + measCnt[1]; } else if(index == (groupOfElements->ucNumElements -1)) { Special case of Last element in slider, add last, 1st, and 2nd to last position = measCnt[index] + measCnt[0] + measCnt[index-1]; } else { position = measCnt[index] + measCnt[index+1] + measCnt[index-1]; } if(position > groupOfElements->ulSensorThreshold) { position = index*(groupOfElements->ucPoints/groupOfElements->ucNumElements); position += (groupOfElements->ucPoints/groupOfElements->ucNumElements)/2; if(index == 0) { Special case of 1st element in slider, which only has one neighbor, measCnt[1] measCnt is limited to ulMaxResponse within dominantElement function position += (measCnt[1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[groupOfElements->ucNumElements -1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; if(position < 0) { position = position + (unsigned long)groupOfElements->ucPoints; } } else if(index == (groupOfElements->ucNumElements -1)) { Special case of Last element in slider, which only has one neighbor, measCnt[x-1] or measCnt[ucNumElements-1] measCnt is limited to ulMaxResponse within dominantElement function position += (measCnt[0]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; if(position > (groupOfElements->ucPoints -1)) { position = position - (unsigned long)groupOfElements->ucPoints; } } else { position += (measCnt[index+1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; position -= (measCnt[index-1]*(groupOfElements->ucPoints/groupOfElements->ucNumElements))/100; } if((position > groupOfElements->ucPoints) || position < 0) { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } else { position = ILLEGAL_SLIDER_WHEEL_POSITION; } } #ifndef RAM_FOR_FLASH free(measCnt); #endif return position; }
[ "unsigned", "long", "TI_CAPT_Wheel", "(", "const", "tSensor", "*", "groupOfElements", ")", "{", "unsigned", "char", "index", ";", "signed", "long", "position", ";", "#ifndef", "RAM_FOR_FLASH", "unsigned", "long", "*", "measCnt", ";", "measCnt", "=", "(", "unsigned", "long", "*", ")", "malloc", "(", "groupOfElements", "->", "ucNumElements", "*", "sizeof", "(", "unsigned", "long", ")", ")", ";", "if", "(", "measCnt", "==", "0", ")", "{", "while", "(", "1", ")", ";", "}", "#endif", "position", "=", "ILLEGAL_SLIDER_WHEEL_POSITION", ";", "TI_CAPT_Custom", "(", "groupOfElements", ",", "measCnt", ")", ";", "if", "(", "ctsStatusReg", "&", "EVNT", ")", "{", "index", "=", "Dominant_Element", "(", "groupOfElements", ",", "&", "measCnt", "[", "0", "]", ")", ";", "if", "(", "index", "==", "0", ")", "{", "position", "=", "measCnt", "[", "0", "]", "+", "measCnt", "[", "groupOfElements", "->", "ucNumElements", "-", "1", "]", "+", "measCnt", "[", "1", "]", ";", "}", "else", "if", "(", "index", "==", "(", "groupOfElements", "->", "ucNumElements", "-", "1", ")", ")", "{", "position", "=", "measCnt", "[", "index", "]", "+", "measCnt", "[", "0", "]", "+", "measCnt", "[", "index", "-", "1", "]", ";", "}", "else", "{", "position", "=", "measCnt", "[", "index", "]", "+", "measCnt", "[", "index", "+", "1", "]", "+", "measCnt", "[", "index", "-", "1", "]", ";", "}", "if", "(", "position", ">", "groupOfElements", "->", "ulSensorThreshold", ")", "{", "position", "=", "index", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ";", "position", "+=", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", "/", "2", ";", "if", "(", "index", "==", "0", ")", "{", "position", "+=", "(", "measCnt", "[", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "position", "-=", "(", "measCnt", "[", "groupOfElements", "->", "ucNumElements", "-", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "if", "(", "position", "<", "0", ")", "{", "position", "=", "position", "+", "(", "unsigned", "long", ")", "groupOfElements", "->", "ucPoints", ";", "}", "}", "else", "if", "(", "index", "==", "(", "groupOfElements", "->", "ucNumElements", "-", "1", ")", ")", "{", "position", "+=", "(", "measCnt", "[", "0", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "position", "-=", "(", "measCnt", "[", "index", "-", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "if", "(", "position", ">", "(", "groupOfElements", "->", "ucPoints", "-", "1", ")", ")", "{", "position", "=", "position", "-", "(", "unsigned", "long", ")", "groupOfElements", "->", "ucPoints", ";", "}", "}", "else", "{", "position", "+=", "(", "measCnt", "[", "index", "+", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "position", "-=", "(", "measCnt", "[", "index", "-", "1", "]", "*", "(", "groupOfElements", "->", "ucPoints", "/", "groupOfElements", "->", "ucNumElements", ")", ")", "/", "100", ";", "}", "if", "(", "(", "position", ">", "groupOfElements", "->", "ucPoints", ")", "||", "position", "<", "0", ")", "{", "position", "=", "ILLEGAL_SLIDER_WHEEL_POSITION", ";", "}", "}", "else", "{", "position", "=", "ILLEGAL_SLIDER_WHEEL_POSITION", ";", "}", "}", "#ifndef", "RAM_FOR_FLASH", "free", "(", "measCnt", ")", ";", "#endif", "return", "position", ";", "}" ]
Determine the position on a wheel \param groupOfElements Pointer to wheel
[ "Determine", "the", "position", "on", "a", "wheel", "\\", "param", "groupOfElements", "Pointer", "to", "wheel" ]
[ "// allocate memory for measurement", "//make measurement", "// Translate the EVNT flag from an element level EVNT to a sensor level EVNT.", "// The sensor must read at least 75% cumulative response before indicating a ", "// touch.", "// The index represents the element within the array with the highest return.", "// ", "// Special case of 1st element in slider, add 1st, last, and 2nd", "// Special case of Last element in slider, add last, 1st, and 2nd to last", "//index = Dominant_Element(groupOfElements, &measCnt[0]);", "// The index represents the element within the array with the highest return.", "// ", "// Special case of 1st element in slider, which only has one neighbor, measCnt[1]", "// measCnt is limited to ulMaxResponse within dominantElement function", "// Special case of Last element in slider, which only has one neighbor, measCnt[x-1] or measCnt[ucNumElements-1]", "// measCnt is limited to ulMaxResponse within dominantElement function" ]
[ { "param": "groupOfElements", "type": "tSensor" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "groupOfElements", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2557df0bb8255440d15abfdd778f190b6a5ad5d0
junyanl-code/Luminary-Micro-Library
grlib/radiobutton.c
[ "BSD-3-Clause" ]
C
RadioButtonPaint
void
static void RadioButtonPaint(tWidget *pWidget, unsigned long bClick) { tRadioButtonWidget *pRadio; tContext sCtx; long lX, lY; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a radio button widget pointer. // pRadio = (tRadioButtonWidget *)pWidget; // // Initialize a drawing context. // GrContextInit(&sCtx, pWidget->pDisplay); // // Initialize the clipping region based on the extents of this radio // button. // GrContextClipRegionSet(&sCtx, &(pWidget->sPosition)); // // See if the radio button fill style is selected. // if((pRadio->usStyle & RB_STYLE_FILL) && !bClick) { // // Fill the radio button with the fill color. // GrContextForegroundSet(&sCtx, pRadio->ulFillColor); GrRectFill(&sCtx, &(pWidget->sPosition)); } // // See if the radio button outline style is selected. // if((pRadio->usStyle & RB_STYLE_OUTLINE) && !bClick) { // // Outline the radio button with the outline color. // GrContextForegroundSet(&sCtx, pRadio->ulOutlineColor); GrRectDraw(&sCtx, &(pWidget->sPosition)); } // // Draw the radio button. // lX = pWidget->sPosition.sXMin + (pRadio->usCircleSize / 2) + 2; lY = (pWidget->sPosition.sYMin + ((pWidget->sPosition.sYMax - pWidget->sPosition.sYMin) / 2)); if(!bClick) { GrContextForegroundSet(&sCtx, pRadio->ulOutlineColor); GrCircleDraw(&sCtx, lX, lY, pRadio->usCircleSize / 2); } // // Select the foreground color based on whether or not the radio button is // selected. // if(pRadio->usStyle & RB_STYLE_SELECTED) { GrContextForegroundSet(&sCtx, pRadio->ulOutlineColor); } else { GrContextForegroundSet(&sCtx, pRadio->ulFillColor); } // // Fill in the radio button. // GrCircleFill(&sCtx, lX, lY, (pRadio->usCircleSize / 2) - 2); // // See if the radio button text or image style is selected. // if((pRadio->usStyle & (RB_STYLE_TEXT | RB_STYLE_IMG)) && !bClick) { // // Shrink the clipping region by the size of the radio button so that // it is not overwritten by further "decorative" portions of the // widget. // sCtx.sClipRegion.sXMin += pRadio->usCircleSize + 4; // // If the radio button outline style is selected then shrink the // clipping region by one pixel on each side so that the outline is not // overwritten by the text or image. // if(pRadio->usStyle & RB_STYLE_OUTLINE) { sCtx.sClipRegion.sYMin++; sCtx.sClipRegion.sXMax--; sCtx.sClipRegion.sYMax--; } // // See if the radio button image style is selected. // if(pRadio->usStyle & RB_STYLE_IMG) { // // Determine where along the Y extent of the widget to draw the // image. It is drawn at the top if it takes all (or more than // all) of the Y extent of the widget, and it is drawn centered if // it takes less than the Y extent. // if(GrImageHeightGet(pRadio->pucImage) > (sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin)) { lY = sCtx.sClipRegion.sYMin; } else { lY = (sCtx.sClipRegion.sYMin + ((sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin - GrImageHeightGet(pRadio->pucImage) + 1) / 2)); } // // Set the foreground and background colors to use for 1 BPP // images. // GrContextForegroundSet(&sCtx, pRadio->ulTextColor); GrContextBackgroundSet(&sCtx, pRadio->ulFillColor); // // Draw the image next to the radio button. // GrImageDraw(&sCtx, pRadio->pucImage, sCtx.sClipRegion.sXMin, lY); } // // See if the radio button text style is selected. // if(pRadio->usStyle & RB_STYLE_TEXT) { // // Determine where along the Y extent of the widget to draw the // string. It is drawn at the top if it takes all (or more than // all) of the Y extent of the widget, and it is drawn centered if // it takes less than the Y extent. // if(GrFontHeightGet(pRadio->pFont) > (sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin)) { lY = sCtx.sClipRegion.sYMin; } else { lY = (sCtx.sClipRegion.sYMin + ((sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin - GrFontHeightGet(pRadio->pFont) + 1) / 2)); } // // Draw the text next to the radio button. // GrContextFontSet(&sCtx, pRadio->pFont); GrContextForegroundSet(&sCtx, pRadio->ulTextColor); GrContextBackgroundSet(&sCtx, pRadio->ulFillColor); GrStringDraw(&sCtx, pRadio->pcText, -1, sCtx.sClipRegion.sXMin, lY, pRadio->usStyle & RB_STYLE_TEXT_OPAQUE); } } }
//***************************************************************************** // //! Draws a radio button widget. //! //! \param pWidget is a pointer to the radio button widget to be drawn. //! \param bClick is a boolean that is \b true if the paint request is a result //! of a pointer click and \b false if not. //! //! This function draws a radio button widget on the display. This is called //! in response to a \b #WIDGET_MSG_PAINT message. //! //! \return None. // //*****************************************************************************
Draws a radio button widget. \param pWidget is a pointer to the radio button widget to be drawn. \param bClick is a boolean that is \b true if the paint request is a result of a pointer click and \b false if not. This function draws a radio button widget on the display. This is called in response to a \b #WIDGET_MSG_PAINT message. \return None.
[ "Draws", "a", "radio", "button", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "radio", "button", "widget", "to", "be", "drawn", ".", "\\", "param", "bClick", "is", "a", "boolean", "that", "is", "\\", "b", "true", "if", "the", "paint", "request", "is", "a", "result", "of", "a", "pointer", "click", "and", "\\", "b", "false", "if", "not", ".", "This", "function", "draws", "a", "radio", "button", "widget", "on", "the", "display", ".", "This", "is", "called", "in", "response", "to", "a", "\\", "b", "#WIDGET_MSG_PAINT", "message", ".", "\\", "return", "None", "." ]
static void RadioButtonPaint(tWidget *pWidget, unsigned long bClick) { tRadioButtonWidget *pRadio; tContext sCtx; long lX, lY; ASSERT(pWidget); pRadio = (tRadioButtonWidget *)pWidget; GrContextInit(&sCtx, pWidget->pDisplay); GrContextClipRegionSet(&sCtx, &(pWidget->sPosition)); if((pRadio->usStyle & RB_STYLE_FILL) && !bClick) { GrContextForegroundSet(&sCtx, pRadio->ulFillColor); GrRectFill(&sCtx, &(pWidget->sPosition)); } if((pRadio->usStyle & RB_STYLE_OUTLINE) && !bClick) { GrContextForegroundSet(&sCtx, pRadio->ulOutlineColor); GrRectDraw(&sCtx, &(pWidget->sPosition)); } lX = pWidget->sPosition.sXMin + (pRadio->usCircleSize / 2) + 2; lY = (pWidget->sPosition.sYMin + ((pWidget->sPosition.sYMax - pWidget->sPosition.sYMin) / 2)); if(!bClick) { GrContextForegroundSet(&sCtx, pRadio->ulOutlineColor); GrCircleDraw(&sCtx, lX, lY, pRadio->usCircleSize / 2); } if(pRadio->usStyle & RB_STYLE_SELECTED) { GrContextForegroundSet(&sCtx, pRadio->ulOutlineColor); } else { GrContextForegroundSet(&sCtx, pRadio->ulFillColor); } GrCircleFill(&sCtx, lX, lY, (pRadio->usCircleSize / 2) - 2); if((pRadio->usStyle & (RB_STYLE_TEXT | RB_STYLE_IMG)) && !bClick) { sCtx.sClipRegion.sXMin += pRadio->usCircleSize + 4; if(pRadio->usStyle & RB_STYLE_OUTLINE) { sCtx.sClipRegion.sYMin++; sCtx.sClipRegion.sXMax--; sCtx.sClipRegion.sYMax--; } if(pRadio->usStyle & RB_STYLE_IMG) { if(GrImageHeightGet(pRadio->pucImage) > (sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin)) { lY = sCtx.sClipRegion.sYMin; } else { lY = (sCtx.sClipRegion.sYMin + ((sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin - GrImageHeightGet(pRadio->pucImage) + 1) / 2)); } GrContextForegroundSet(&sCtx, pRadio->ulTextColor); GrContextBackgroundSet(&sCtx, pRadio->ulFillColor); GrImageDraw(&sCtx, pRadio->pucImage, sCtx.sClipRegion.sXMin, lY); } if(pRadio->usStyle & RB_STYLE_TEXT) { if(GrFontHeightGet(pRadio->pFont) > (sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin)) { lY = sCtx.sClipRegion.sYMin; } else { lY = (sCtx.sClipRegion.sYMin + ((sCtx.sClipRegion.sYMax - sCtx.sClipRegion.sYMin - GrFontHeightGet(pRadio->pFont) + 1) / 2)); } GrContextFontSet(&sCtx, pRadio->pFont); GrContextForegroundSet(&sCtx, pRadio->ulTextColor); GrContextBackgroundSet(&sCtx, pRadio->ulFillColor); GrStringDraw(&sCtx, pRadio->pcText, -1, sCtx.sClipRegion.sXMin, lY, pRadio->usStyle & RB_STYLE_TEXT_OPAQUE); } } }
[ "static", "void", "RadioButtonPaint", "(", "tWidget", "*", "pWidget", ",", "unsigned", "long", "bClick", ")", "{", "tRadioButtonWidget", "*", "pRadio", ";", "tContext", "sCtx", ";", "long", "lX", ",", "lY", ";", "ASSERT", "(", "pWidget", ")", ";", "pRadio", "=", "(", "tRadioButtonWidget", "*", ")", "pWidget", ";", "GrContextInit", "(", "&", "sCtx", ",", "pWidget", "->", "pDisplay", ")", ";", "GrContextClipRegionSet", "(", "&", "sCtx", ",", "&", "(", "pWidget", "->", "sPosition", ")", ")", ";", "if", "(", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_FILL", ")", "&&", "!", "bClick", ")", "{", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulFillColor", ")", ";", "GrRectFill", "(", "&", "sCtx", ",", "&", "(", "pWidget", "->", "sPosition", ")", ")", ";", "}", "if", "(", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_OUTLINE", ")", "&&", "!", "bClick", ")", "{", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulOutlineColor", ")", ";", "GrRectDraw", "(", "&", "sCtx", ",", "&", "(", "pWidget", "->", "sPosition", ")", ")", ";", "}", "lX", "=", "pWidget", "->", "sPosition", ".", "sXMin", "+", "(", "pRadio", "->", "usCircleSize", "/", "2", ")", "+", "2", ";", "lY", "=", "(", "pWidget", "->", "sPosition", ".", "sYMin", "+", "(", "(", "pWidget", "->", "sPosition", ".", "sYMax", "-", "pWidget", "->", "sPosition", ".", "sYMin", ")", "/", "2", ")", ")", ";", "if", "(", "!", "bClick", ")", "{", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulOutlineColor", ")", ";", "GrCircleDraw", "(", "&", "sCtx", ",", "lX", ",", "lY", ",", "pRadio", "->", "usCircleSize", "/", "2", ")", ";", "}", "if", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_SELECTED", ")", "{", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulOutlineColor", ")", ";", "}", "else", "{", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulFillColor", ")", ";", "}", "GrCircleFill", "(", "&", "sCtx", ",", "lX", ",", "lY", ",", "(", "pRadio", "->", "usCircleSize", "/", "2", ")", "-", "2", ")", ";", "if", "(", "(", "pRadio", "->", "usStyle", "&", "(", "RB_STYLE_TEXT", "|", "RB_STYLE_IMG", ")", ")", "&&", "!", "bClick", ")", "{", "sCtx", ".", "sClipRegion", ".", "sXMin", "+=", "pRadio", "->", "usCircleSize", "+", "4", ";", "if", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_OUTLINE", ")", "{", "sCtx", ".", "sClipRegion", ".", "sYMin", "++", ";", "sCtx", ".", "sClipRegion", ".", "sXMax", "--", ";", "sCtx", ".", "sClipRegion", ".", "sYMax", "--", ";", "}", "if", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_IMG", ")", "{", "if", "(", "GrImageHeightGet", "(", "pRadio", "->", "pucImage", ")", ">", "(", "sCtx", ".", "sClipRegion", ".", "sYMax", "-", "sCtx", ".", "sClipRegion", ".", "sYMin", ")", ")", "{", "lY", "=", "sCtx", ".", "sClipRegion", ".", "sYMin", ";", "}", "else", "{", "lY", "=", "(", "sCtx", ".", "sClipRegion", ".", "sYMin", "+", "(", "(", "sCtx", ".", "sClipRegion", ".", "sYMax", "-", "sCtx", ".", "sClipRegion", ".", "sYMin", "-", "GrImageHeightGet", "(", "pRadio", "->", "pucImage", ")", "+", "1", ")", "/", "2", ")", ")", ";", "}", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulTextColor", ")", ";", "GrContextBackgroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulFillColor", ")", ";", "GrImageDraw", "(", "&", "sCtx", ",", "pRadio", "->", "pucImage", ",", "sCtx", ".", "sClipRegion", ".", "sXMin", ",", "lY", ")", ";", "}", "if", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_TEXT", ")", "{", "if", "(", "GrFontHeightGet", "(", "pRadio", "->", "pFont", ")", ">", "(", "sCtx", ".", "sClipRegion", ".", "sYMax", "-", "sCtx", ".", "sClipRegion", ".", "sYMin", ")", ")", "{", "lY", "=", "sCtx", ".", "sClipRegion", ".", "sYMin", ";", "}", "else", "{", "lY", "=", "(", "sCtx", ".", "sClipRegion", ".", "sYMin", "+", "(", "(", "sCtx", ".", "sClipRegion", ".", "sYMax", "-", "sCtx", ".", "sClipRegion", ".", "sYMin", "-", "GrFontHeightGet", "(", "pRadio", "->", "pFont", ")", "+", "1", ")", "/", "2", ")", ")", ";", "}", "GrContextFontSet", "(", "&", "sCtx", ",", "pRadio", "->", "pFont", ")", ";", "GrContextForegroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulTextColor", ")", ";", "GrContextBackgroundSet", "(", "&", "sCtx", ",", "pRadio", "->", "ulFillColor", ")", ";", "GrStringDraw", "(", "&", "sCtx", ",", "pRadio", "->", "pcText", ",", "-1", ",", "sCtx", ".", "sClipRegion", ".", "sXMin", ",", "lY", ",", "pRadio", "->", "usStyle", "&", "RB_STYLE_TEXT_OPAQUE", ")", ";", "}", "}", "}" ]
Draws a radio button widget.
[ "Draws", "a", "radio", "button", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a radio button widget pointer.\r", "//\r", "//\r", "// Initialize a drawing context.\r", "//\r", "//\r", "// Initialize the clipping region based on the extents of this radio\r", "// button.\r", "//\r", "//\r", "// See if the radio button fill style is selected.\r", "//\r", "//\r", "// Fill the radio button with the fill color.\r", "//\r", "//\r", "// See if the radio button outline style is selected.\r", "//\r", "//\r", "// Outline the radio button with the outline color.\r", "//\r", "//\r", "// Draw the radio button.\r", "//\r", "//\r", "// Select the foreground color based on whether or not the radio button is\r", "// selected.\r", "//\r", "//\r", "// Fill in the radio button.\r", "//\r", "//\r", "// See if the radio button text or image style is selected.\r", "//\r", "//\r", "// Shrink the clipping region by the size of the radio button so that\r", "// it is not overwritten by further \"decorative\" portions of the\r", "// widget.\r", "//\r", "//\r", "// If the radio button outline style is selected then shrink the\r", "// clipping region by one pixel on each side so that the outline is not\r", "// overwritten by the text or image.\r", "//\r", "//\r", "// See if the radio button image style is selected.\r", "//\r", "//\r", "// Determine where along the Y extent of the widget to draw the\r", "// image. It is drawn at the top if it takes all (or more than\r", "// all) of the Y extent of the widget, and it is drawn centered if\r", "// it takes less than the Y extent.\r", "//\r", "//\r", "// Set the foreground and background colors to use for 1 BPP\r", "// images.\r", "//\r", "//\r", "// Draw the image next to the radio button.\r", "//\r", "//\r", "// See if the radio button text style is selected.\r", "//\r", "//\r", "// Determine where along the Y extent of the widget to draw the\r", "// string. It is drawn at the top if it takes all (or more than\r", "// all) of the Y extent of the widget, and it is drawn centered if\r", "// it takes less than the Y extent.\r", "//\r", "//\r", "// Draw the text next to the radio button.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "bClick", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "bClick", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2557df0bb8255440d15abfdd778f190b6a5ad5d0
junyanl-code/Luminary-Micro-Library
grlib/radiobutton.c
[ "BSD-3-Clause" ]
C
RadioButtonClick
null
static long RadioButtonClick(tWidget *pWidget, unsigned long ulMsg, long lX, long lY) { tRadioButtonWidget *pRadio, *pRadio2; tWidget *pSibling; // // Check the arguments. // ASSERT(pWidget); // // Convert the generic widget pointer into a radio button widget pointer. // pRadio = (tRadioButtonWidget *)pWidget; // // See if the given coordinates are within the extents of the radio button. // if((lX >= pWidget->sPosition.sXMin) && (lX <= pWidget->sPosition.sXMax) && (lY >= pWidget->sPosition.sYMin) && (lY <= pWidget->sPosition.sYMax)) { // // See if the pointer was just raised and this radio button is not // selected. // if((ulMsg == WIDGET_MSG_PTR_UP) && !(pRadio->usStyle & RB_STYLE_SELECTED)) { // // Loop through the siblings of this radio button widget. // for(pSibling = pWidget->pParent->pChild; pSibling; pSibling = pSibling->pNext) { // // Skip this widget if it is not a radio button widget, or if // it is the original radio button widget. // if((pSibling == pWidget) || (pSibling->pfnMsgProc != RadioButtonMsgProc)) { continue; } // // Convert the generic widget pointer into a radio button // widget pointer. // pRadio2 = (tRadioButtonWidget *)pSibling; // // See if the sibling radio button is selected. // if(pRadio2->usStyle & RB_STYLE_SELECTED) { // // Clear the selected state of the sibling radio button. // pRadio2->usStyle &= ~(RB_STYLE_SELECTED); // // Redraw the sibling radio button. // RadioButtonPaint(pSibling, 1); // // If there is an OnChange callback for the sibling radio // button then call the callback. // if(pRadio2->pfnOnChange) { pRadio2->pfnOnChange(pSibling, 0); } } } // // Set the selected state of this radio button. // pRadio->usStyle |= RB_STYLE_SELECTED; // // Redraw the radio button. // RadioButtonPaint(pWidget, 1); // // If there is an OnChange callback for this widget then call the // callback. // if(pRadio->pfnOnChange) { pRadio->pfnOnChange(pWidget, 1); } } // // These coordinates are within the extents of the radio button widget. // return(1); } // // These coordinates are not within the extents of the radio button widget. // return(0); }
//***************************************************************************** // //! Handles pointer events for a radio button. //! //! \param pWidget is a pointer to the radio button widget. //! \param ulMsg is the pointer event message. //! \param lX is the X coordinate of the pointer event. //! \param lY is the Y coordiante of the pointer event. //! //! This function processes pointer event messages for a radio button. This is //! called in response to a \b #WIDGET_MSG_PTR_DOWN, \b #WIDGET_MSG_PTR_MOVE, //! and \b #WIDGET_MSG_PTR_UP messages. //! //! If the \b #WIDGET_MSG_PTR_UP message is received with a position within the //! extents of the radio button, the radio button's selected state will be //! unchanged if it is already selected. If it is not selected, it will be //! selected, its OnChange function will be called, and the peer radio button //! widget that is selected will be unselected, causing its OnChange to be //! called as well. //! //! \return Returns 1 if the coordinates are within the extents of the radio //! button and 0 otherwise. // //*****************************************************************************
Handles pointer events for a radio button. \param pWidget is a pointer to the radio button widget. \param ulMsg is the pointer event message. \param lX is the X coordinate of the pointer event. \param lY is the Y coordiante of the pointer event. This function processes pointer event messages for a radio button. This is called in response to a \b #WIDGET_MSG_PTR_DOWN, \b #WIDGET_MSG_PTR_MOVE, and \b #WIDGET_MSG_PTR_UP messages. If the \b #WIDGET_MSG_PTR_UP message is received with a position within the extents of the radio button, the radio button's selected state will be unchanged if it is already selected. If it is not selected, it will be selected, its OnChange function will be called, and the peer radio button widget that is selected will be unselected, causing its OnChange to be called as well. \return Returns 1 if the coordinates are within the extents of the radio button and 0 otherwise.
[ "Handles", "pointer", "events", "for", "a", "radio", "button", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "radio", "button", "widget", ".", "\\", "param", "ulMsg", "is", "the", "pointer", "event", "message", ".", "\\", "param", "lX", "is", "the", "X", "coordinate", "of", "the", "pointer", "event", ".", "\\", "param", "lY", "is", "the", "Y", "coordiante", "of", "the", "pointer", "event", ".", "This", "function", "processes", "pointer", "event", "messages", "for", "a", "radio", "button", ".", "This", "is", "called", "in", "response", "to", "a", "\\", "b", "#WIDGET_MSG_PTR_DOWN", "\\", "b", "#WIDGET_MSG_PTR_MOVE", "and", "\\", "b", "#WIDGET_MSG_PTR_UP", "messages", ".", "If", "the", "\\", "b", "#WIDGET_MSG_PTR_UP", "message", "is", "received", "with", "a", "position", "within", "the", "extents", "of", "the", "radio", "button", "the", "radio", "button", "'", "s", "selected", "state", "will", "be", "unchanged", "if", "it", "is", "already", "selected", ".", "If", "it", "is", "not", "selected", "it", "will", "be", "selected", "its", "OnChange", "function", "will", "be", "called", "and", "the", "peer", "radio", "button", "widget", "that", "is", "selected", "will", "be", "unselected", "causing", "its", "OnChange", "to", "be", "called", "as", "well", ".", "\\", "return", "Returns", "1", "if", "the", "coordinates", "are", "within", "the", "extents", "of", "the", "radio", "button", "and", "0", "otherwise", "." ]
static long RadioButtonClick(tWidget *pWidget, unsigned long ulMsg, long lX, long lY) { tRadioButtonWidget *pRadio, *pRadio2; tWidget *pSibling; ASSERT(pWidget); pRadio = (tRadioButtonWidget *)pWidget; if((lX >= pWidget->sPosition.sXMin) && (lX <= pWidget->sPosition.sXMax) && (lY >= pWidget->sPosition.sYMin) && (lY <= pWidget->sPosition.sYMax)) { if((ulMsg == WIDGET_MSG_PTR_UP) && !(pRadio->usStyle & RB_STYLE_SELECTED)) { for(pSibling = pWidget->pParent->pChild; pSibling; pSibling = pSibling->pNext) { if((pSibling == pWidget) || (pSibling->pfnMsgProc != RadioButtonMsgProc)) { continue; } pRadio2 = (tRadioButtonWidget *)pSibling; if(pRadio2->usStyle & RB_STYLE_SELECTED) { pRadio2->usStyle &= ~(RB_STYLE_SELECTED); RadioButtonPaint(pSibling, 1); if(pRadio2->pfnOnChange) { pRadio2->pfnOnChange(pSibling, 0); } } } pRadio->usStyle |= RB_STYLE_SELECTED; RadioButtonPaint(pWidget, 1); if(pRadio->pfnOnChange) { pRadio->pfnOnChange(pWidget, 1); } } return(1); } return(0); }
[ "static", "long", "RadioButtonClick", "(", "tWidget", "*", "pWidget", ",", "unsigned", "long", "ulMsg", ",", "long", "lX", ",", "long", "lY", ")", "{", "tRadioButtonWidget", "*", "pRadio", ",", "*", "pRadio2", ";", "tWidget", "*", "pSibling", ";", "ASSERT", "(", "pWidget", ")", ";", "pRadio", "=", "(", "tRadioButtonWidget", "*", ")", "pWidget", ";", "if", "(", "(", "lX", ">=", "pWidget", "->", "sPosition", ".", "sXMin", ")", "&&", "(", "lX", "<=", "pWidget", "->", "sPosition", ".", "sXMax", ")", "&&", "(", "lY", ">=", "pWidget", "->", "sPosition", ".", "sYMin", ")", "&&", "(", "lY", "<=", "pWidget", "->", "sPosition", ".", "sYMax", ")", ")", "{", "if", "(", "(", "ulMsg", "==", "WIDGET_MSG_PTR_UP", ")", "&&", "!", "(", "pRadio", "->", "usStyle", "&", "RB_STYLE_SELECTED", ")", ")", "{", "for", "(", "pSibling", "=", "pWidget", "->", "pParent", "->", "pChild", ";", "pSibling", ";", "pSibling", "=", "pSibling", "->", "pNext", ")", "{", "if", "(", "(", "pSibling", "==", "pWidget", ")", "||", "(", "pSibling", "->", "pfnMsgProc", "!=", "RadioButtonMsgProc", ")", ")", "{", "continue", ";", "}", "pRadio2", "=", "(", "tRadioButtonWidget", "*", ")", "pSibling", ";", "if", "(", "pRadio2", "->", "usStyle", "&", "RB_STYLE_SELECTED", ")", "{", "pRadio2", "->", "usStyle", "&=", "~", "(", "RB_STYLE_SELECTED", ")", ";", "RadioButtonPaint", "(", "pSibling", ",", "1", ")", ";", "if", "(", "pRadio2", "->", "pfnOnChange", ")", "{", "pRadio2", "->", "pfnOnChange", "(", "pSibling", ",", "0", ")", ";", "}", "}", "}", "pRadio", "->", "usStyle", "|=", "RB_STYLE_SELECTED", ";", "RadioButtonPaint", "(", "pWidget", ",", "1", ")", ";", "if", "(", "pRadio", "->", "pfnOnChange", ")", "{", "pRadio", "->", "pfnOnChange", "(", "pWidget", ",", "1", ")", ";", "}", "}", "return", "(", "1", ")", ";", "}", "return", "(", "0", ")", ";", "}" ]
Handles pointer events for a radio button.
[ "Handles", "pointer", "events", "for", "a", "radio", "button", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Convert the generic widget pointer into a radio button widget pointer.\r", "//\r", "//\r", "// See if the given coordinates are within the extents of the radio button.\r", "//\r", "//\r", "// See if the pointer was just raised and this radio button is not\r", "// selected.\r", "//\r", "//\r", "// Loop through the siblings of this radio button widget.\r", "//\r", "//\r", "// Skip this widget if it is not a radio button widget, or if\r", "// it is the original radio button widget.\r", "//\r", "//\r", "// Convert the generic widget pointer into a radio button\r", "// widget pointer.\r", "//\r", "//\r", "// See if the sibling radio button is selected.\r", "//\r", "//\r", "// Clear the selected state of the sibling radio button.\r", "//\r", "//\r", "// Redraw the sibling radio button.\r", "//\r", "//\r", "// If there is an OnChange callback for the sibling radio\r", "// button then call the callback.\r", "//\r", "//\r", "// Set the selected state of this radio button.\r", "//\r", "//\r", "// Redraw the radio button.\r", "//\r", "//\r", "// If there is an OnChange callback for this widget then call the\r", "// callback.\r", "//\r", "//\r", "// These coordinates are within the extents of the radio button widget.\r", "//\r", "//\r", "// These coordinates are not within the extents of the radio button widget.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "ulMsg", "type": "unsigned long" }, { "param": "lX", "type": "long" }, { "param": "lY", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsg", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lX", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lY", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2557df0bb8255440d15abfdd778f190b6a5ad5d0
junyanl-code/Luminary-Micro-Library
grlib/radiobutton.c
[ "BSD-3-Clause" ]
C
RadioButtonMsgProc
null
long RadioButtonMsgProc(tWidget *pWidget, unsigned long ulMsg, unsigned long ulParam1, unsigned long ulParam2) { // // Check the arguments. // ASSERT(pWidget); // // Determine which message is being sent. // switch(ulMsg) { // // The widget paint request has been sent. // case WIDGET_MSG_PAINT: { // // Handle the widget paint request. // RadioButtonPaint(pWidget, 0); // // Return one to indicate that the message was successfully // processed. // return(1); } // // One of the pointer requests has been sent. // case WIDGET_MSG_PTR_DOWN: case WIDGET_MSG_PTR_MOVE: case WIDGET_MSG_PTR_UP: { // // Handle the pointer request, returning the appropriate value. // return(RadioButtonClick(pWidget, ulMsg, ulParam1, ulParam2)); } // // An unknown request has been sent. // default: { // // Let the default message handler process this message. // return(WidgetDefaultMsgProc(pWidget, ulMsg, ulParam1, ulParam2)); } } }
//***************************************************************************** // //! Handles messages for a radio button widget. //! //! \param pWidget is a pointer to the radio button widget. //! \param ulMsg is the message. //! \param ulParam1 is the first parameter to the message. //! \param ulParam2 is the second parameter to the message. //! //! This function receives messages intended for this radio button widget and //! processes them accordingly. The processing of the message varies based on //! the message in question. //! //! Unrecognized messages are handled by calling WidgetDefaultMsgProc(). //! //! \return Returns a value appropriate to the supplied message. // //*****************************************************************************
Handles messages for a radio button widget. \param pWidget is a pointer to the radio button widget. \param ulMsg is the message. \param ulParam1 is the first parameter to the message. \param ulParam2 is the second parameter to the message. This function receives messages intended for this radio button widget and processes them accordingly. The processing of the message varies based on the message in question. Unrecognized messages are handled by calling WidgetDefaultMsgProc(). \return Returns a value appropriate to the supplied message.
[ "Handles", "messages", "for", "a", "radio", "button", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "radio", "button", "widget", ".", "\\", "param", "ulMsg", "is", "the", "message", ".", "\\", "param", "ulParam1", "is", "the", "first", "parameter", "to", "the", "message", ".", "\\", "param", "ulParam2", "is", "the", "second", "parameter", "to", "the", "message", ".", "This", "function", "receives", "messages", "intended", "for", "this", "radio", "button", "widget", "and", "processes", "them", "accordingly", ".", "The", "processing", "of", "the", "message", "varies", "based", "on", "the", "message", "in", "question", ".", "Unrecognized", "messages", "are", "handled", "by", "calling", "WidgetDefaultMsgProc", "()", ".", "\\", "return", "Returns", "a", "value", "appropriate", "to", "the", "supplied", "message", "." ]
long RadioButtonMsgProc(tWidget *pWidget, unsigned long ulMsg, unsigned long ulParam1, unsigned long ulParam2) { ASSERT(pWidget); switch(ulMsg) { case WIDGET_MSG_PAINT: { RadioButtonPaint(pWidget, 0); return(1); } case WIDGET_MSG_PTR_DOWN: case WIDGET_MSG_PTR_MOVE: case WIDGET_MSG_PTR_UP: { return(RadioButtonClick(pWidget, ulMsg, ulParam1, ulParam2)); } default: { return(WidgetDefaultMsgProc(pWidget, ulMsg, ulParam1, ulParam2)); } } }
[ "long", "RadioButtonMsgProc", "(", "tWidget", "*", "pWidget", ",", "unsigned", "long", "ulMsg", ",", "unsigned", "long", "ulParam1", ",", "unsigned", "long", "ulParam2", ")", "{", "ASSERT", "(", "pWidget", ")", ";", "switch", "(", "ulMsg", ")", "{", "case", "WIDGET_MSG_PAINT", ":", "{", "RadioButtonPaint", "(", "pWidget", ",", "0", ")", ";", "return", "(", "1", ")", ";", "}", "case", "WIDGET_MSG_PTR_DOWN", ":", "case", "WIDGET_MSG_PTR_MOVE", ":", "case", "WIDGET_MSG_PTR_UP", ":", "{", "return", "(", "RadioButtonClick", "(", "pWidget", ",", "ulMsg", ",", "ulParam1", ",", "ulParam2", ")", ")", ";", "}", "default", ":", "{", "return", "(", "WidgetDefaultMsgProc", "(", "pWidget", ",", "ulMsg", ",", "ulParam1", ",", "ulParam2", ")", ")", ";", "}", "}", "}" ]
Handles messages for a radio button widget.
[ "Handles", "messages", "for", "a", "radio", "button", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Determine which message is being sent.\r", "//\r", "//\r", "// The widget paint request has been sent.\r", "//\r", "//\r", "// Handle the widget paint request.\r", "//\r", "//\r", "// Return one to indicate that the message was successfully\r", "// processed.\r", "//\r", "//\r", "// One of the pointer requests has been sent.\r", "//\r", "//\r", "// Handle the pointer request, returning the appropriate value.\r", "//\r", "//\r", "// An unknown request has been sent.\r", "//\r", "//\r", "// Let the default message handler process this message.\r", "//\r" ]
[ { "param": "pWidget", "type": "tWidget" }, { "param": "ulMsg", "type": "unsigned long" }, { "param": "ulParam1", "type": "unsigned long" }, { "param": "ulParam2", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsg", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulParam1", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulParam2", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
2557df0bb8255440d15abfdd778f190b6a5ad5d0
junyanl-code/Luminary-Micro-Library
grlib/radiobutton.c
[ "BSD-3-Clause" ]
C
RadioButtonInit
void
void RadioButtonInit(tRadioButtonWidget *pWidget, const tDisplay *pDisplay, long lX, long lY, long lWidth, long lHeight) { unsigned long ulIdx; // // Check the arguments. // ASSERT(pWidget); ASSERT(pDisplay); // // Clear out the widget structure. // for(ulIdx = 0; ulIdx < sizeof(tRadioButtonWidget); ulIdx += 4) { ((unsigned long *)pWidget)[ulIdx / 4] = 0; } // // Set the size of the radio button widget structure. // pWidget->sBase.lSize = sizeof(tRadioButtonWidget); // // Mark this widget as fully disconnected. // pWidget->sBase.pParent = 0; pWidget->sBase.pNext = 0; pWidget->sBase.pChild = 0; // // Save the display pointer. // pWidget->sBase.pDisplay = pDisplay; // // Set the extents of this radio button. // pWidget->sBase.sPosition.sXMin = lX; pWidget->sBase.sPosition.sYMin = lY; pWidget->sBase.sPosition.sXMax = lX + lWidth - 1; pWidget->sBase.sPosition.sYMax = lY + lHeight - 1; // // Use the radio button message handler to processage messages to this // radio button. // pWidget->sBase.pfnMsgProc = RadioButtonMsgProc; }
//***************************************************************************** // //! Initializes a radio button widget. //! //! \param pWidget is a pointer to the radio button widget to initialize. //! \param pDisplay is a pointer to the display on which to draw the push //! button. //! \param lX is the X coordinate of the upper left corner of the radio button. //! \param lY is the Y coordinate of the upper left corner of the radio button. //! \param lWidth is the width of the radio button. //! \param lHeight is the height of the radio button. //! //! This function initializes the provided radio button widget. //! //! \return None. // //*****************************************************************************
Initializes a radio button widget. \param pWidget is a pointer to the radio button widget to initialize. \param pDisplay is a pointer to the display on which to draw the push button. \param lX is the X coordinate of the upper left corner of the radio button. \param lY is the Y coordinate of the upper left corner of the radio button. \param lWidth is the width of the radio button. \param lHeight is the height of the radio button. This function initializes the provided radio button widget. \return None.
[ "Initializes", "a", "radio", "button", "widget", ".", "\\", "param", "pWidget", "is", "a", "pointer", "to", "the", "radio", "button", "widget", "to", "initialize", ".", "\\", "param", "pDisplay", "is", "a", "pointer", "to", "the", "display", "on", "which", "to", "draw", "the", "push", "button", ".", "\\", "param", "lX", "is", "the", "X", "coordinate", "of", "the", "upper", "left", "corner", "of", "the", "radio", "button", ".", "\\", "param", "lY", "is", "the", "Y", "coordinate", "of", "the", "upper", "left", "corner", "of", "the", "radio", "button", ".", "\\", "param", "lWidth", "is", "the", "width", "of", "the", "radio", "button", ".", "\\", "param", "lHeight", "is", "the", "height", "of", "the", "radio", "button", ".", "This", "function", "initializes", "the", "provided", "radio", "button", "widget", ".", "\\", "return", "None", "." ]
void RadioButtonInit(tRadioButtonWidget *pWidget, const tDisplay *pDisplay, long lX, long lY, long lWidth, long lHeight) { unsigned long ulIdx; ASSERT(pWidget); ASSERT(pDisplay); for(ulIdx = 0; ulIdx < sizeof(tRadioButtonWidget); ulIdx += 4) { ((unsigned long *)pWidget)[ulIdx / 4] = 0; } pWidget->sBase.lSize = sizeof(tRadioButtonWidget); pWidget->sBase.pParent = 0; pWidget->sBase.pNext = 0; pWidget->sBase.pChild = 0; pWidget->sBase.pDisplay = pDisplay; pWidget->sBase.sPosition.sXMin = lX; pWidget->sBase.sPosition.sYMin = lY; pWidget->sBase.sPosition.sXMax = lX + lWidth - 1; pWidget->sBase.sPosition.sYMax = lY + lHeight - 1; pWidget->sBase.pfnMsgProc = RadioButtonMsgProc; }
[ "void", "RadioButtonInit", "(", "tRadioButtonWidget", "*", "pWidget", ",", "const", "tDisplay", "*", "pDisplay", ",", "long", "lX", ",", "long", "lY", ",", "long", "lWidth", ",", "long", "lHeight", ")", "{", "unsigned", "long", "ulIdx", ";", "ASSERT", "(", "pWidget", ")", ";", "ASSERT", "(", "pDisplay", ")", ";", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "sizeof", "(", "tRadioButtonWidget", ")", ";", "ulIdx", "+=", "4", ")", "{", "(", "(", "unsigned", "long", "*", ")", "pWidget", ")", "[", "ulIdx", "/", "4", "]", "=", "0", ";", "}", "pWidget", "->", "sBase", ".", "lSize", "=", "sizeof", "(", "tRadioButtonWidget", ")", ";", "pWidget", "->", "sBase", ".", "pParent", "=", "0", ";", "pWidget", "->", "sBase", ".", "pNext", "=", "0", ";", "pWidget", "->", "sBase", ".", "pChild", "=", "0", ";", "pWidget", "->", "sBase", ".", "pDisplay", "=", "pDisplay", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sXMin", "=", "lX", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sYMin", "=", "lY", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sXMax", "=", "lX", "+", "lWidth", "-", "1", ";", "pWidget", "->", "sBase", ".", "sPosition", ".", "sYMax", "=", "lY", "+", "lHeight", "-", "1", ";", "pWidget", "->", "sBase", ".", "pfnMsgProc", "=", "RadioButtonMsgProc", ";", "}" ]
Initializes a radio button widget.
[ "Initializes", "a", "radio", "button", "widget", "." ]
[ "//\r", "// Check the arguments.\r", "//\r", "//\r", "// Clear out the widget structure.\r", "//\r", "//\r", "// Set the size of the radio button widget structure.\r", "//\r", "//\r", "// Mark this widget as fully disconnected.\r", "//\r", "//\r", "// Save the display pointer.\r", "//\r", "//\r", "// Set the extents of this radio button.\r", "//\r", "//\r", "// Use the radio button message handler to processage messages to this\r", "// radio button.\r", "//\r" ]
[ { "param": "pWidget", "type": "tRadioButtonWidget" }, { "param": "pDisplay", "type": "tDisplay" }, { "param": "lX", "type": "long" }, { "param": "lY", "type": "long" }, { "param": "lWidth", "type": "long" }, { "param": "lHeight", "type": "long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pWidget", "type": "tRadioButtonWidget", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pDisplay", "type": "tDisplay", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lX", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lY", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lWidth", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "lHeight", "type": "long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
bfb8ab3300c616a24b6975b587caa2d18ccfce05
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f120xl-boost-capsense/drivers/CTS_HAL.c
[ "BSD-3-Clause" ]
C
CapSenseSystickRC
void
void CapSenseSystickRC(const tSensor *group, unsigned long *counts) { unsigned char ucIndex; // // Run an RC based capacitance measurement routine on each element in the // sensor array. // for(ucIndex = 0; ucIndex < (group->ucNumElements); ucIndex++) { // // Reset Systick to zero (probably not necessary for most cases, but we // want to make sure that Systick doesn't roll over.) // HWREG(NVIC_ST_CURRENT) = 0x0; // // Grab a count number from the capacitive sensor element. // counts[ucIndex] = CapSenseElementSystickRC(group->Element[ucIndex]->ulGPIOPort, group->Element[ucIndex]->ulGPIOPin, group->ulNumSamples); } }
//***************************************************************************** // // Function to get a capacitance reading from a single-pin RC-based capacitive // sensor. This function assumes that the capacitive sensor is charged by a // GPIO, and then discharged through a resistor to GND. The same GPIO used to // perform the charging will be used as an input during discharge to sense when // the capacitor's voltage has decreased to at least VIL. The function will // execute several cycles of this, and report how long the process took in // units of SysTick counts. This count should be proportional to the current // capacitance of the sensor, and the resistance of the discharge resistor. // //*****************************************************************************
Function to get a capacitance reading from a single-pin RC-based capacitive sensor. This function assumes that the capacitive sensor is charged by a GPIO, and then discharged through a resistor to GND. The same GPIO used to perform the charging will be used as an input during discharge to sense when the capacitor's voltage has decreased to at least VIL. The function will execute several cycles of this, and report how long the process took in units of SysTick counts. This count should be proportional to the current capacitance of the sensor, and the resistance of the discharge resistor.
[ "Function", "to", "get", "a", "capacitance", "reading", "from", "a", "single", "-", "pin", "RC", "-", "based", "capacitive", "sensor", ".", "This", "function", "assumes", "that", "the", "capacitive", "sensor", "is", "charged", "by", "a", "GPIO", "and", "then", "discharged", "through", "a", "resistor", "to", "GND", ".", "The", "same", "GPIO", "used", "to", "perform", "the", "charging", "will", "be", "used", "as", "an", "input", "during", "discharge", "to", "sense", "when", "the", "capacitor", "'", "s", "voltage", "has", "decreased", "to", "at", "least", "VIL", ".", "The", "function", "will", "execute", "several", "cycles", "of", "this", "and", "report", "how", "long", "the", "process", "took", "in", "units", "of", "SysTick", "counts", ".", "This", "count", "should", "be", "proportional", "to", "the", "current", "capacitance", "of", "the", "sensor", "and", "the", "resistance", "of", "the", "discharge", "resistor", "." ]
void CapSenseSystickRC(const tSensor *group, unsigned long *counts) { unsigned char ucIndex; Run an RC based capacitance measurement routine on each element in the sensor array. for(ucIndex = 0; ucIndex < (group->ucNumElements); ucIndex++) { Reset Systick to zero (probably not necessary for most cases, but we want to make sure that Systick doesn't roll over.) HWREG(NVIC_ST_CURRENT) = 0x0; Grab a count number from the capacitive sensor element. counts[ucIndex] = CapSenseElementSystickRC(group->Element[ucIndex]->ulGPIOPort, group->Element[ucIndex]->ulGPIOPin, group->ulNumSamples); } }
[ "void", "CapSenseSystickRC", "(", "const", "tSensor", "*", "group", ",", "unsigned", "long", "*", "counts", ")", "{", "unsigned", "char", "ucIndex", ";", "for", "(", "ucIndex", "=", "0", ";", "ucIndex", "<", "(", "group", "->", "ucNumElements", ")", ";", "ucIndex", "++", ")", "{", "HWREG", "(", "NVIC_ST_CURRENT", ")", "=", "0x0", ";", "counts", "[", "ucIndex", "]", "=", "CapSenseElementSystickRC", "(", "group", "->", "Element", "[", "ucIndex", "]", "->", "ulGPIOPort", ",", "group", "->", "Element", "[", "ucIndex", "]", "->", "ulGPIOPin", ",", "group", "->", "ulNumSamples", ")", ";", "}", "}" ]
Function to get a capacitance reading from a single-pin RC-based capacitive sensor.
[ "Function", "to", "get", "a", "capacitance", "reading", "from", "a", "single", "-", "pin", "RC", "-", "based", "capacitive", "sensor", "." ]
[ "//", "// Run an RC based capacitance measurement routine on each element in the", "// sensor array.", "//", "//", "// Reset Systick to zero (probably not necessary for most cases, but we", "// want to make sure that Systick doesn't roll over.)", "//", "//", "// Grab a count number from the capacitive sensor element.", "//" ]
[ { "param": "group", "type": "tSensor" }, { "param": "counts", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "group", "type": "tSensor", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "counts", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
574d210494b75371df024b7780fa77e032a55ff6
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/bitband/bitband.c
[ "BSD-3-Clause" ]
C
PrintValue
void
void PrintValue(unsigned long ulValue) { char pcBuffer[9]; pcBuffer[0] = pcHex[(ulValue >> 28) & 15]; pcBuffer[1] = pcHex[(ulValue >> 24) & 15]; pcBuffer[2] = pcHex[(ulValue >> 20) & 15]; pcBuffer[3] = pcHex[(ulValue >> 16) & 15]; pcBuffer[4] = pcHex[(ulValue >> 12) & 15]; pcBuffer[5] = pcHex[(ulValue >> 8) & 15]; pcBuffer[6] = pcHex[(ulValue >> 4) & 15]; pcBuffer[7] = pcHex[(ulValue >> 0) & 15]; pcBuffer[8] = '\0'; GrStringDrawCentered(&g_sContext, pcBuffer, -1, GrContextDpyWidthGet(&g_sContext) / 2, 28, 1); }
//***************************************************************************** // // Print the given value as a hexadecimal string on the CSTN. // //*****************************************************************************
Print the given value as a hexadecimal string on the CSTN.
[ "Print", "the", "given", "value", "as", "a", "hexadecimal", "string", "on", "the", "CSTN", "." ]
void PrintValue(unsigned long ulValue) { char pcBuffer[9]; pcBuffer[0] = pcHex[(ulValue >> 28) & 15]; pcBuffer[1] = pcHex[(ulValue >> 24) & 15]; pcBuffer[2] = pcHex[(ulValue >> 20) & 15]; pcBuffer[3] = pcHex[(ulValue >> 16) & 15]; pcBuffer[4] = pcHex[(ulValue >> 12) & 15]; pcBuffer[5] = pcHex[(ulValue >> 8) & 15]; pcBuffer[6] = pcHex[(ulValue >> 4) & 15]; pcBuffer[7] = pcHex[(ulValue >> 0) & 15]; pcBuffer[8] = '\0'; GrStringDrawCentered(&g_sContext, pcBuffer, -1, GrContextDpyWidthGet(&g_sContext) / 2, 28, 1); }
[ "void", "PrintValue", "(", "unsigned", "long", "ulValue", ")", "{", "char", "pcBuffer", "[", "9", "]", ";", "pcBuffer", "[", "0", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "28", ")", "&", "15", "]", ";", "pcBuffer", "[", "1", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "24", ")", "&", "15", "]", ";", "pcBuffer", "[", "2", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "20", ")", "&", "15", "]", ";", "pcBuffer", "[", "3", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "16", ")", "&", "15", "]", ";", "pcBuffer", "[", "4", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "12", ")", "&", "15", "]", ";", "pcBuffer", "[", "5", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "8", ")", "&", "15", "]", ";", "pcBuffer", "[", "6", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "4", ")", "&", "15", "]", ";", "pcBuffer", "[", "7", "]", "=", "pcHex", "[", "(", "ulValue", ">>", "0", ")", "&", "15", "]", ";", "pcBuffer", "[", "8", "]", "=", "'", "\\0", "'", ";", "GrStringDrawCentered", "(", "&", "g_sContext", ",", "pcBuffer", ",", "-1", ",", "GrContextDpyWidthGet", "(", "&", "g_sContext", ")", "/", "2", ",", "28", ",", "1", ")", ";", "}" ]
Print the given value as a hexadecimal string on the CSTN.
[ "Print", "the", "given", "value", "as", "a", "hexadecimal", "string", "on", "the", "CSTN", "." ]
[]
[ { "param": "ulValue", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "ulValue", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
6af97cb5aab7cea779cb7e2578416167cc5f9991
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/boot_demo1/boot_demo1.c
[ "BSD-3-Clause" ]
C
JumpToBootLoader
void
void JumpToBootLoader(void) { // // Disable all processor interrupts. Instead of disabling them // one at a time, a direct write to NVIC is done to disable all // peripheral interrupts. // HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; // // Return control to the boot loader. This is a call to the SVC // handler in the boot loader. // (*((void (*)(void))(*(unsigned long *)0x2c)))(); }
//***************************************************************************** // // Passes control to the bootloader and initiates a remote software update. // // This function passes control to the bootloader and initiates an update of // the main application firmware image via UART0 or USB depending // upon the specific boot loader binary in use. // // \return Never returns. // //*****************************************************************************
Passes control to the bootloader and initiates a remote software update. This function passes control to the bootloader and initiates an update of the main application firmware image via UART0 or USB depending upon the specific boot loader binary in use. \return Never returns.
[ "Passes", "control", "to", "the", "bootloader", "and", "initiates", "a", "remote", "software", "update", ".", "This", "function", "passes", "control", "to", "the", "bootloader", "and", "initiates", "an", "update", "of", "the", "main", "application", "firmware", "image", "via", "UART0", "or", "USB", "depending", "upon", "the", "specific", "boot", "loader", "binary", "in", "use", ".", "\\", "return", "Never", "returns", "." ]
void JumpToBootLoader(void) { Disable all processor interrupts. Instead of disabling them one at a time, a direct write to NVIC is done to disable all peripheral interrupts. HWREG(NVIC_DIS0) = 0xffffffff; HWREG(NVIC_DIS1) = 0xffffffff; Return control to the boot loader. This is a call to the SVC handler in the boot loader. (*((void (*)(void))(*(unsigned long *)0x2c)))(); }
[ "void", "JumpToBootLoader", "(", "void", ")", "{", "HWREG", "(", "NVIC_DIS0", ")", "=", "0xffffffff", ";", "HWREG", "(", "NVIC_DIS1", ")", "=", "0xffffffff", ";", "(", "*", "(", "(", "void", "(", "*", ")", "(", "void", ")", ")", "(", "*", "(", "unsigned", "long", "*", ")", "0x2c", ")", ")", ")", "(", ")", ";", "}" ]
Passes control to the bootloader and initiates a remote software update.
[ "Passes", "control", "to", "the", "bootloader", "and", "initiates", "a", "remote", "software", "update", "." ]
[ "//", "// Disable all processor interrupts. Instead of disabling them", "// one at a time, a direct write to NVIC is done to disable all", "// peripheral interrupts.", "//", "//", "// Return control to the boot loader. This is a call to the SVC", "// handler in the boot loader.", "//" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
6af97cb5aab7cea779cb7e2578416167cc5f9991
junyanl-code/Luminary-Micro-Library
boards/ek-lm4f232/boot_demo1/boot_demo1.c
[ "BSD-3-Clause" ]
C
SetupForUART
void
void SetupForUART(void) { // // We need to make sure that UART0 and its associated GPIO port are // enabled before we pass control to the boot loader. The serial boot // loader does not enable or configure these peripherals for us if we // enter it via its SVC vector. // ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); // // Set GPIO A0 and A1 as UART. // ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); // // Configure the UART for 115200, n, 8, 1 // ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8)); // // Enable the UART operation. // ROM_UARTEnable(UART0_BASE); }
//***************************************************************************** // // Initialize UART0 and set the appropriate communication parameters. // //*****************************************************************************
Initialize UART0 and set the appropriate communication parameters.
[ "Initialize", "UART0", "and", "set", "the", "appropriate", "communication", "parameters", "." ]
void SetupForUART(void) { We need to make sure that UART0 and its associated GPIO port are enabled before we pass control to the boot loader. The serial boot loader does not enable or configure these peripherals for us if we enter it via its SVC vector. ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_UART0); ROM_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOA); Set GPIO A0 and A1 as UART. ROM_GPIOPinTypeUART(GPIO_PORTA_BASE, GPIO_PIN_0 | GPIO_PIN_1); Configure the UART for 115200, n, 8, 1 ROM_UARTConfigSetExpClk(UART0_BASE, SysCtlClockGet(), 115200, (UART_CONFIG_PAR_NONE | UART_CONFIG_STOP_ONE | UART_CONFIG_WLEN_8)); Enable the UART operation. ROM_UARTEnable(UART0_BASE); }
[ "void", "SetupForUART", "(", "void", ")", "{", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_UART0", ")", ";", "ROM_SysCtlPeripheralEnable", "(", "SYSCTL_PERIPH_GPIOA", ")", ";", "ROM_GPIOPinTypeUART", "(", "GPIO_PORTA_BASE", ",", "GPIO_PIN_0", "|", "GPIO_PIN_1", ")", ";", "ROM_UARTConfigSetExpClk", "(", "UART0_BASE", ",", "SysCtlClockGet", "(", ")", ",", "115200", ",", "(", "UART_CONFIG_PAR_NONE", "|", "UART_CONFIG_STOP_ONE", "|", "UART_CONFIG_WLEN_8", ")", ")", ";", "ROM_UARTEnable", "(", "UART0_BASE", ")", ";", "}" ]
Initialize UART0 and set the appropriate communication parameters.
[ "Initialize", "UART0", "and", "set", "the", "appropriate", "communication", "parameters", "." ]
[ "//", "// We need to make sure that UART0 and its associated GPIO port are", "// enabled before we pass control to the boot loader. The serial boot", "// loader does not enable or configure these peripherals for us if we", "// enter it via its SVC vector.", "//", "//", "// Set GPIO A0 and A1 as UART.", "//", "//", "// Configure the UART for 115200, n, 8, 1", "//", "//", "// Enable the UART operation.", "//" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
c05d26ac71335444b8982c6f0bf667ccf07f76f0
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9b90/aes_expanded_key/aes_expanded_key.c
[ "BSD-3-Clause" ]
C
PrintBuffer
void
void PrintBuffer(unsigned char *pucBuffer, unsigned long ulLength) { unsigned long ulIdx; // // Loop through the characters in the buffer, printing out the hex value. // for(ulIdx = 0; ulIdx < ulLength; ulIdx++) { UARTprintf(" %02x", pucBuffer[ulIdx]); } // // Provide a separator between the hex and ASCII version of the buffer. // UARTprintf(" "); // // Loop through the characters in the buffer, printing out the ASCII value // (replacing non-printable characters with a period). // for(ulIdx = 0; ulIdx < ulLength; ulIdx++) { UARTprintf("%c", ((pucBuffer[ulIdx] >= ' ') && (pucBuffer[ulIdx] <= '~')) ? pucBuffer[ulIdx] : '.'); } // // Finish with a newline. // UARTprintf("\n"); }
//***************************************************************************** // // Prints out the contents of a buffer. First, the buffer bytes are printed // out in hex, and then in ASCII with non-printable characters replaced with a // period. // //*****************************************************************************
Prints out the contents of a buffer. First, the buffer bytes are printed out in hex, and then in ASCII with non-printable characters replaced with a period.
[ "Prints", "out", "the", "contents", "of", "a", "buffer", ".", "First", "the", "buffer", "bytes", "are", "printed", "out", "in", "hex", "and", "then", "in", "ASCII", "with", "non", "-", "printable", "characters", "replaced", "with", "a", "period", "." ]
void PrintBuffer(unsigned char *pucBuffer, unsigned long ulLength) { unsigned long ulIdx; for(ulIdx = 0; ulIdx < ulLength; ulIdx++) { UARTprintf(" %02x", pucBuffer[ulIdx]); } UARTprintf(" "); for(ulIdx = 0; ulIdx < ulLength; ulIdx++) { UARTprintf("%c", ((pucBuffer[ulIdx] >= ' ') && (pucBuffer[ulIdx] <= '~')) ? pucBuffer[ulIdx] : '.'); } UARTprintf("\n"); }
[ "void", "PrintBuffer", "(", "unsigned", "char", "*", "pucBuffer", ",", "unsigned", "long", "ulLength", ")", "{", "unsigned", "long", "ulIdx", ";", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "ulLength", ";", "ulIdx", "++", ")", "{", "UARTprintf", "(", "\"", "\"", ",", "pucBuffer", "[", "ulIdx", "]", ")", ";", "}", "UARTprintf", "(", "\"", "\"", ")", ";", "for", "(", "ulIdx", "=", "0", ";", "ulIdx", "<", "ulLength", ";", "ulIdx", "++", ")", "{", "UARTprintf", "(", "\"", "\"", ",", "(", "(", "pucBuffer", "[", "ulIdx", "]", ">=", "'", "'", ")", "&&", "(", "pucBuffer", "[", "ulIdx", "]", "<=", "'", "'", ")", ")", "?", "pucBuffer", "[", "ulIdx", "]", ":", "'", "'", ")", ";", "}", "UARTprintf", "(", "\"", "\\n", "\"", ")", ";", "}" ]
Prints out the contents of a buffer.
[ "Prints", "out", "the", "contents", "of", "a", "buffer", "." ]
[ "//\r", "// Loop through the characters in the buffer, printing out the hex value.\r", "//\r", "//\r", "// Provide a separator between the hex and ASCII version of the buffer.\r", "//\r", "//\r", "// Loop through the characters in the buffer, printing out the ASCII value\r", "// (replacing non-printable characters with a period).\r", "//\r", "//\r", "// Finish with a newline.\r", "//\r" ]
[ { "param": "pucBuffer", "type": "unsigned char" }, { "param": "ulLength", "type": "unsigned long" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pucBuffer", "type": "unsigned char", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulLength", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }
46a760c2aaebba7ddea37191700da8939405d5d2
junyanl-code/Luminary-Micro-Library
examples/project/startup_gcc.c
[ "BSD-3-Clause" ]
C
ResetISR
void
void ResetISR(void) { unsigned long *pulSrc, *pulDest; // // Copy the data segment initializers from flash to SRAM. // pulSrc = &_etext; for(pulDest = &_data; pulDest < &_edata; ) { *pulDest++ = *pulSrc++; } // // Zero fill the bss segment. // __asm(" ldr r0, =_bss\n" " ldr r1, =_ebss\n" " mov r2, #0\n" " .thumb_func\n" "zero_loop:\n" " cmp r0, r1\n" " it lt\n" " strlt r2, [r0], #4\n" " blt zero_loop"); // // Call the application's entry point. // main(); }
//***************************************************************************** // // This is the code that gets called when the processor first starts execution // following a reset event. Only the absolutely necessary set is performed, // after which the application supplied entry() routine is called. Any fancy // actions (such as making decisions based on the reset cause register, and // resetting the bits in that register) are left solely in the hands of the // application. // //*****************************************************************************
This is the code that gets called when the processor first starts execution following a reset event. Only the absolutely necessary set is performed, after which the application supplied entry() routine is called. Any fancy actions (such as making decisions based on the reset cause register, and resetting the bits in that register) are left solely in the hands of the application.
[ "This", "is", "the", "code", "that", "gets", "called", "when", "the", "processor", "first", "starts", "execution", "following", "a", "reset", "event", ".", "Only", "the", "absolutely", "necessary", "set", "is", "performed", "after", "which", "the", "application", "supplied", "entry", "()", "routine", "is", "called", ".", "Any", "fancy", "actions", "(", "such", "as", "making", "decisions", "based", "on", "the", "reset", "cause", "register", "and", "resetting", "the", "bits", "in", "that", "register", ")", "are", "left", "solely", "in", "the", "hands", "of", "the", "application", "." ]
void ResetISR(void) { unsigned long *pulSrc, *pulDest; Copy the data segment initializers from flash to SRAM. pulSrc = &_etext; for(pulDest = &_data; pulDest < &_edata; ) { *pulDest++ = *pulSrc++; } Zero fill the bss segment. __asm(" ldr r0, =_bss\n" " ldr r1, =_ebss\n" " mov r2, #0\n" " .thumb_func\n" "zero_loop:\n" " cmp r0, r1\n" " it lt\n" " strlt r2, [r0], #4\n" " blt zero_loop"); Call the application's entry point. main(); }
[ "void", "ResetISR", "(", "void", ")", "{", "unsigned", "long", "*", "pulSrc", ",", "*", "pulDest", ";", "pulSrc", "=", "&", "_etext", ";", "for", "(", "pulDest", "=", "&", "_data", ";", "pulDest", "<", "&", "_edata", ";", ")", "{", "*", "pulDest", "++", "=", "*", "pulSrc", "++", ";", "}", "__asm", "(", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\\n", "\"", "\"", "\"", ")", ";", "main", "(", ")", ";", "}" ]
This is the code that gets called when the processor first starts execution following a reset event.
[ "This", "is", "the", "code", "that", "gets", "called", "when", "the", "processor", "first", "starts", "execution", "following", "a", "reset", "event", "." ]
[ "//", "// Copy the data segment initializers from flash to SRAM.", "//", "//", "// Zero fill the bss segment.", "//", "//", "// Call the application's entry point.", "//" ]
[]
{ "returns": [], "raises": [], "params": [], "outlier_params": [], "others": [] }
bfb0e6a0625230a798938cf478711909f5aeabda
junyanl-code/Luminary-Micro-Library
boards/ek-lm3s9b90/usb_dev_keyboard/usb_dev_keyboard.c
[ "BSD-3-Clause" ]
C
KeyboardHandler
null
unsigned long KeyboardHandler(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgData, void *pvMsgData) { switch (ulEvent) { // // The host has connected to us and configured the device. // case USB_EVENT_CONNECTED: { g_bConnected = true; g_bSuspended = false; break; } // // The host has disconnected from us. // case USB_EVENT_DISCONNECTED: { g_bConnected = false; break; } // // We receive this event every time the host acknowledges transmission // of a report. It is used here purely as a way of determining whether // the host is still talking to us or not. // case USB_EVENT_TX_COMPLETE: { // // Enter the idle state since we finished sending something. // g_eKeyboardState = STATE_IDLE; break; } // // This event indicates that the host has suspended the USB bus. // case USB_EVENT_SUSPEND: { g_bSuspended = true; break; } // // This event signals that the host has resumed signalling on the bus. // case USB_EVENT_RESUME: { g_bSuspended = false; break; } // // This event indicates that the host has sent us an Output or // Feature report and that the report is now in the buffer we provided // on the previous USBD_HID_EVENT_GET_REPORT_BUFFER callback. // case USBD_HID_KEYB_EVENT_SET_LEDS: { // // Set the LED to match the current state of the caps lock LED. // ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, (ulMsgData & HID_KEYB_CAPS_LOCK) ? GPIO_PIN_0 : 0); break; } // // We ignore all other events. // default: { break; } } return(0); }
//***************************************************************************** // // Handles asynchronous events from the HID keyboard driver. // // \param pvCBData is the event callback pointer provided during // USBDHIDKeyboardInit(). This is a pointer to our keyboard device structure // (&g_sKeyboardDevice). // \param ulEvent identifies the event we are being called back for. // \param ulMsgData is an event-specific value. // \param pvMsgData is an event-specific pointer. // // This function is called by the HID keyboard driver to inform the application // of particular asynchronous events related to operation of the keyboard HID // device. // // \return Returns 0 in all cases. // //*****************************************************************************
Handles asynchronous events from the HID keyboard driver. \param pvCBData is the event callback pointer provided during USBDHIDKeyboardInit(). This is a pointer to our keyboard device structure (&g_sKeyboardDevice). \param ulEvent identifies the event we are being called back for. \param ulMsgData is an event-specific value. \param pvMsgData is an event-specific pointer. This function is called by the HID keyboard driver to inform the application of particular asynchronous events related to operation of the keyboard HID device. \return Returns 0 in all cases.
[ "Handles", "asynchronous", "events", "from", "the", "HID", "keyboard", "driver", ".", "\\", "param", "pvCBData", "is", "the", "event", "callback", "pointer", "provided", "during", "USBDHIDKeyboardInit", "()", ".", "This", "is", "a", "pointer", "to", "our", "keyboard", "device", "structure", "(", "&g_sKeyboardDevice", ")", ".", "\\", "param", "ulEvent", "identifies", "the", "event", "we", "are", "being", "called", "back", "for", ".", "\\", "param", "ulMsgData", "is", "an", "event", "-", "specific", "value", ".", "\\", "param", "pvMsgData", "is", "an", "event", "-", "specific", "pointer", ".", "This", "function", "is", "called", "by", "the", "HID", "keyboard", "driver", "to", "inform", "the", "application", "of", "particular", "asynchronous", "events", "related", "to", "operation", "of", "the", "keyboard", "HID", "device", ".", "\\", "return", "Returns", "0", "in", "all", "cases", "." ]
unsigned long KeyboardHandler(void *pvCBData, unsigned long ulEvent, unsigned long ulMsgData, void *pvMsgData) { switch (ulEvent) { case USB_EVENT_CONNECTED: { g_bConnected = true; g_bSuspended = false; break; } case USB_EVENT_DISCONNECTED: { g_bConnected = false; break; } case USB_EVENT_TX_COMPLETE: { g_eKeyboardState = STATE_IDLE; break; } case USB_EVENT_SUSPEND: { g_bSuspended = true; break; } case USB_EVENT_RESUME: { g_bSuspended = false; break; } case USBD_HID_KEYB_EVENT_SET_LEDS: { ROM_GPIOPinWrite(GPIO_PORTD_BASE, GPIO_PIN_0, (ulMsgData & HID_KEYB_CAPS_LOCK) ? GPIO_PIN_0 : 0); break; } default: { break; } } return(0); }
[ "unsigned", "long", "KeyboardHandler", "(", "void", "*", "pvCBData", ",", "unsigned", "long", "ulEvent", ",", "unsigned", "long", "ulMsgData", ",", "void", "*", "pvMsgData", ")", "{", "switch", "(", "ulEvent", ")", "{", "case", "USB_EVENT_CONNECTED", ":", "{", "g_bConnected", "=", "true", ";", "g_bSuspended", "=", "false", ";", "break", ";", "}", "case", "USB_EVENT_DISCONNECTED", ":", "{", "g_bConnected", "=", "false", ";", "break", ";", "}", "case", "USB_EVENT_TX_COMPLETE", ":", "{", "g_eKeyboardState", "=", "STATE_IDLE", ";", "break", ";", "}", "case", "USB_EVENT_SUSPEND", ":", "{", "g_bSuspended", "=", "true", ";", "break", ";", "}", "case", "USB_EVENT_RESUME", ":", "{", "g_bSuspended", "=", "false", ";", "break", ";", "}", "case", "USBD_HID_KEYB_EVENT_SET_LEDS", ":", "{", "ROM_GPIOPinWrite", "(", "GPIO_PORTD_BASE", ",", "GPIO_PIN_0", ",", "(", "ulMsgData", "&", "HID_KEYB_CAPS_LOCK", ")", "?", "GPIO_PIN_0", ":", "0", ")", ";", "break", ";", "}", "default", ":", "{", "break", ";", "}", "}", "return", "(", "0", ")", ";", "}" ]
Handles asynchronous events from the HID keyboard driver.
[ "Handles", "asynchronous", "events", "from", "the", "HID", "keyboard", "driver", "." ]
[ "//\r", "// The host has connected to us and configured the device.\r", "//\r", "//\r", "// The host has disconnected from us.\r", "//\r", "//\r", "// We receive this event every time the host acknowledges transmission\r", "// of a report. It is used here purely as a way of determining whether\r", "// the host is still talking to us or not.\r", "//\r", "//\r", "// Enter the idle state since we finished sending something.\r", "//\r", "//\r", "// This event indicates that the host has suspended the USB bus.\r", "//\r", "//\r", "// This event signals that the host has resumed signalling on the bus.\r", "//\r", "//\r", "// This event indicates that the host has sent us an Output or\r", "// Feature report and that the report is now in the buffer we provided\r", "// on the previous USBD_HID_EVENT_GET_REPORT_BUFFER callback.\r", "//\r", "//\r", "// Set the LED to match the current state of the caps lock LED.\r", "//\r", "//\r", "// We ignore all other events.\r", "//\r" ]
[ { "param": "pvCBData", "type": "void" }, { "param": "ulEvent", "type": "unsigned long" }, { "param": "ulMsgData", "type": "unsigned long" }, { "param": "pvMsgData", "type": "void" } ]
{ "returns": [], "raises": [], "params": [ { "identifier": "pvCBData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulEvent", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "ulMsgData", "type": "unsigned long", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null }, { "identifier": "pvMsgData", "type": "void", "docstring": null, "docstring_tokens": [], "default": null, "is_optional": null } ], "outlier_params": [], "others": [] }