MDK-ARM Keil, MDK-ARM Datasheet - Page 97

KIT REALVIEW MCU DEVELOPMENT

MDK-ARM

Manufacturer Part Number
MDK-ARM
Description
KIT REALVIEW MCU DEVELOPMENT
Manufacturer
Keil
Type
Compiler and IDEr
Datasheets

Specifications of MDK-ARM

For Use With/related Products
ARM MCUs
Lead Free Status / RoHS Status
Lead free / RoHS Compliant
Getting Started: Building Applications with RL-ARM
Next, expand the case 5 switch statement of the smtp_cbfunc() function, to
handle multiple data packets. Add another switch statement as shown in the code
below. The local buffer MYBUF(pvar)-->id counts how many data packets have
been sent, and MYBUF(pvar)-->id controls the flow of the code through the new
switch statement. The smtp_cbfunc returns the number of bytes that have been
written to the output buffer. Recurring calls to the smtp_cbfunc() function can be
enforced by setting the most significant bit of the return value to high.
U16 smtp_cbfunc (U8 code, U8 *buf, U16 buflen, U32 *pvar)
rep:
}
Therefore, to send an email with a large amount of data we add a new switch
statement with cases. The first case sends the initial packet of data and sets the
repeat flag, the second case sends the bulk of the data and sets the repeat flag.
The final case sends the final packet of data and does not set the repeat flag.
Exercise: Dynamic SMTP
This exercise demonstrates how to construct a long email message containing
dynamic data.
U32 len = 0;
switch (code)
case 5:
}
return ((U16) len);
switch (MYBUF(pvar)->id)
}
case 0:
case 1:
case 2:
len = str_copy (buf, "First Packet of Data\n");
MYBUF (pvar)->id = 1;
MYBUF (pvar)->idx = 1;
goto rep;
len = str_copy (buf,"Bulk of the data\n");
if (++MYBUF(pvar)->idx > 5)
}
/* Request a repeated call, bit 15 is a repeat flag. */
len |= 0x8000;
break;
/* Last one, add a footer text to this email. */
len = str_copy (buf,"Last Packet of data.\n");
break;
MYBUF(pvar)->id = 2;
{
{
{
{
97

Related parts for MDK-ARM