function_name
stringlengths 1
80
| function
stringlengths 14
10.6k
| comment
stringlengths 12
8.02k
| normalized_comment
stringlengths 6
6.55k
|
|---|---|---|---|
IoTHubClient_Auth_Get_TrustBundle
|
char* IoTHubClient_Auth_Get_TrustBundle(IOTHUB_AUTHORIZATION_HANDLE handle, const char* certificate_file_name)
{
char* result;
if (handle == NULL)
{
LogError("Security Handle is NULL");
result = NULL;
}
else if (certificate_file_name != NULL)
{
result = read_ca_certificate_from_file(certificate_file_name);
}
else
{
result = iothub_device_auth_get_trust_bundle(handle->device_auth_handle);
}
return result;
}
|
/* HSM to retrieve this.*/
|
HSM to retrieve this.
|
CodeFirst_Init
|
CODEFIRST_RESULT CodeFirst_Init(const char* overrideSchemaNamespace)
{
return CodeFirst_Init_impl(overrideSchemaNamespace, true);
}
|
/*Codes_SRS_CODEFIRST_99_002:[ CodeFirst_Init shall initialize the CodeFirst module. If initialization is successful, it shall return CODEFIRST_OK.]*/
|
Codes_SRS_CODEFIRST_99_002:[ CodeFirst_Init shall initialize the CodeFirst module. If initialization is successful, it shall return CODEFIRST_OK.]
|
findDeviceHandle
|
static bool findDeviceHandle(const void* element, const void* value)
{
bool result;
/* data stored at element is device handle */
const IOTHUB_DEVICE_HANDLE * guess = (const IOTHUB_DEVICE_HANDLE *)element;
IOTHUB_DEVICE_HANDLE match = (IOTHUB_DEVICE_HANDLE)value;
result = (*guess == match) ? true : false;
return result;
}
|
/*Codes_SRS_TRANSPORTMULTITHTTP_17_137: [ IoTHubTransportHttp_Register shall search the devices list for any device matching name deviceId. If deviceId is found it shall return NULL. ]*/
|
Codes_SRS_TRANSPORTMULTITHTTP_17_137: [ IoTHubTransportHttp_Register shall search the devices list for any device matching name deviceId. If deviceId is found it shall return NULL. ]
|
destroy_hostName
|
static void destroy_hostName(HTTPTRANSPORT_HANDLE_DATA* handleData)
{
STRING_delete(handleData->hostName);
handleData->hostName = NULL;
}
|
/*Codes_SRS_TRANSPORTMULTITHTTP_20_001: [If config->upperConfig->protocolGatewayHostName is not NULL, IoTHubTransportHttp_Create shall use it as hostname] */
|
Codes_SRS_TRANSPORTMULTITHTTP_20_001: [If config->upperConfig->protocolGatewayHostName is not NULL, IoTHubTransportHttp_Create shall use it as hostname]
|
create_perDeviceList
|
static bool create_perDeviceList(HTTPTRANSPORT_HANDLE_DATA* handleData)
{
bool result;
handleData->perDeviceList = VECTOR_create(sizeof(IOTHUB_DEVICE_HANDLE));
if (handleData == NULL || handleData->perDeviceList == NULL)
{
/*Codes_SRS_TRANSPORTMULTITHTTP_17_010: [ If creating the list fails, then IoTHubTransportHttp_Create shall fail and return NULL. ]*/
result = false;
}
else
{
result = true;
}
return result;
}
|
/*Codes_SRS_TRANSPORTMULTITHTTP_17_009: [ IoTHubTransportHttp_Create shall call singlylinkedlist_create to create a list of registered devices. ]*/
|
Codes_SRS_TRANSPORTMULTITHTTP_17_009: [ IoTHubTransportHttp_Create shall call singlylinkedlist_create to create a list of registered devices. ]
|
Device_Destroy
|
void Device_Destroy(DEVICE_HANDLE deviceHandle)
{
/* Codes_SRS_DEVICE_03_007: [Device_Destroy will not do anything if deviceHandle is NULL.] */
if (deviceHandle != NULL)
{
DEVICE_HANDLE_DATA* device = (DEVICE_HANDLE_DATA*)deviceHandle;
DataPublisher_Destroy(device->dataPublisherHandle);
CommandDecoder_Destroy(device->commandDecoderHandle);
free(device);
}
}
|
/* Codes_SRS_DEVICE_03_006: [Device_Destroy shall free all resources associated with a device.] */
|
Codes_SRS_DEVICE_03_006: [Device_Destroy shall free all resources associated with a device.]
|
NoFreeFunction
|
static void NoFreeFunction(void* value)
{
(void)value;
}
|
/* Codes_SRS_JSON_DECODER_99_049:[ JSONDecoder shall not allocate new string values for the leafs, but rather point to strings in the original JSON.] */
|
Codes_SRS_JSON_DECODER_99_049:[ JSONDecoder shall not allocate new string values for the leafs, but rather point to strings in the original JSON.]
|
ParseObjectOrArray
|
static JSON_DECODER_RESULT ParseObjectOrArray(PARSER_STATE* parserState, MULTITREE_HANDLE currentNode)
{
JSON_DECODER_RESULT result = JSON_DECODER_PARSE_ERROR;
SkipWhiteSpaces(parserState);
if (*(parserState->json) == '{')
{
result = ParseObject(parserState, currentNode);
SkipWhiteSpaces(parserState);
}
else if (*(parserState->json) == '[')
{
result = ParseArray(parserState, currentNode);
SkipWhiteSpaces(parserState);
}
else
{
/* Codes_SRS_JSON_DECODER_99_007:[ If parsing the JSON fails due to the JSON string being malformed, JSONDecoder_JSON_To_MultiTree shall return JSON_DECODER_PARSE_ERROR.] */
result = JSON_DECODER_PARSE_ERROR;
}
if ((result == JSON_DECODER_OK) &&
(*(parserState->json) != '\0'))
{
/* Codes_SRS_JSON_DECODER_99_007:[ If parsing the JSON fails due to the JSON string being malformed, JSONDecoder_JSON_To_MultiTree shall return JSON_DECODER_PARSE_ERROR.] */
result = JSON_DECODER_PARSE_ERROR;
}
return result;
}
|
/* Codes_SRS_JSON_DECODER_99_012:[ A JSON text is a serialized object or array.] */
|
Codes_SRS_JSON_DECODER_99_012:[ A JSON text is a serialized object or array.]
|
Create_EDM_BOOLEAN_from_int
|
AGENT_DATA_TYPES_RESULT Create_EDM_BOOLEAN_from_int(AGENT_DATA_TYPE* agentData, int v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[All the Create_... functions shall check their parameters for validity.When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned]*/
if(agentData==NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_031:[ Creates a AGENT_DATA_TYPE representing an EDM_BOOLEAN.]*/
agentData->type = EDM_BOOLEAN_TYPE;
agentData->value.edmBoolean.value = (v)?(EDM_TRUE):(EDM_FALSE);
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*creates an AGENT_DATA_TYPE containing a EDM_BOOLEAN from a int*/
|
creates an AGENT_DATA_TYPE containing a EDM_BOOLEAN from a int
|
Create_AGENT_DATA_TYPE_from_UINT8
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_UINT8(AGENT_DATA_TYPE* agentData, uint8_t v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[ All the Create_... functions shall check their parameters for validity. When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned ].*/
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_BYTE_TYPE;
agentData->value.edmByte.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*creates an AGENT_DATA_TYPE containing a UINT8*/
|
creates an AGENT_DATA_TYPE containing a UINT8
|
Create_AGENT_DATA_TYPE_from_EDM_GUID
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_EDM_GUID(AGENT_DATA_TYPE* agentData, EDM_GUID v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[ All the functions shall check their parameters for validity. When an invalid parameter is detected, the value AGENT_DATA_TYPES_INVALID_ARG shall be returned ].*/
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("result = %s ", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_094:[ Creates and AGENT_DATA_TYPE containing a EDM_GUID from an EDM_GUID]*/
agentData->type = EDM_GUID_TYPE;
memmove(agentData->value.edmGuid.GUID, v.GUID, 16);
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_094:[ Creates and AGENT_DATA_TYPE containing a EDM_GUID from an EDM_GUID]*/
|
Codes_SRS_AGENT_TYPE_SYSTEM_99_094:[ Creates and AGENT_DATA_TYPE containing a EDM_GUID from an EDM_GUID]
|
scanOptionalSign
|
static void scanOptionalSign(const char* source, size_t sourceSize, size_t* position, int* sign)
{
if (*position < sourceSize)
{
if (source[*position] == '-')
{
*sign = -1;
(*position)++;
}
else if (source[*position] == '+')
{
*sign = +1;
(*position)++;
}
else
{
*sign = +1;
}
}
}
|
/*if sign, then it will set *sign to = +/-1*/
|
if sign, then it will set *sign to = +/-1
|
scanOptionalMinusSign
|
static void scanOptionalMinusSign(const char* source, size_t sourceSize, size_t* position, int* sign)
{
if (*position < sourceSize)
{
if (source[*position] == '-')
{
*sign = -1;
(*position)++;
}
else
{
*sign = +1;
}
}
}
|
/*if sign, then it will set *sign to = +/-1*/
|
if sign, then it will set *sign to = +/-1
|
scanMandatoryOneDigit
|
static int scanMandatoryOneDigit(const char* source, size_t sourceSize, size_t* position)
{
int result;
if (*position < sourceSize)
{
if (IS_DIGIT(source[*position]))
{
(*position)++;
result = 0;
}
else
{
result = 1;
}
}
else
{
result = 1;
}
return result;
}
|
/*return 1 when error (such as wrong parameters)*/
|
return 1 when error (such as wrong parameters)
|
scanOptionalNDigits
|
static void scanOptionalNDigits(const char* source, size_t sourceSize, size_t* position)
{
while (*position < sourceSize)
{
if (IS_DIGIT(source[*position]))
{
(*position)++;
}
else
{
break;
}
}
}
|
/*scans digits, if any*/
|
scans digits, if any
|
scanAndReadNDigitsInt
|
static int scanAndReadNDigitsInt(const char* source, size_t* position, int *value, size_t N)
{
N++;
*value = 0;
while ((IS_DIGIT(source[*position])) &&
(N > 0))
{
*value *= 10;
*value += (source[*position] - '0');
(*position)++;
N--;
}
return N != 1;
}
|
/*will update position parameter to reflect the first character not belonging to the number*/
|
will update position parameter to reflect the first character not belonging to the number
|
scanOptionalDotAndDigits
|
static int scanOptionalDotAndDigits(const char* source, size_t sourceSize, size_t* position)
{
int result = 0;
if (*position < sourceSize)
{
if (source[*position] == '.')
{
(*position)++;
if (scanMandatoryOneDigit(source, sourceSize, position) != 0)
{
/* not a digit following the dot... */
result = 1;
}
else
{
scanOptionalNDigits(source, sourceSize, position);
}
}
else
{
/*not a dot, don't care*/
}
}
return result;
}
|
/*return 1 when error (such as wrong parameters)*/
|
return 1 when error (such as wrong parameters)
|
scanMandatory2CapitalHexDigits
|
static int scanMandatory2CapitalHexDigits(const char* source, uint8_t* value)
{
int result;
uint8_t temp;
if (scanMandatory1CapitalHexDigit(source, &temp) == 0)
{
*value = temp*16;
if (scanMandatory1CapitalHexDigit(source + 1, &temp) == 0)
{
*value += temp;
result = 0;
}
else
{
result = 1;
}
}
else
{
result = 2;
}
return result;
}
|
/*return 1 when error (such as wrong parameters)*/
|
return 1 when error (such as wrong parameters)
|
base64b8toValue
|
static int base64b8toValue(unsigned char source, unsigned char* destination)
{
unsigned char i;
for (i = 0; i <= 3; i++)
{
if (base64b8(i) == source)
{
*destination = i;
return 0;
}
}
return 1;
}
|
/*return 0 if the character is one of ( 'A' / 'Q' / 'g' / 'w' )*/
|
return 0 if the character is one of ( 'A' / 'Q' / 'g' / 'w' )
|
Create_AGENT_DATA_TYPE_from_DOUBLE
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_DOUBLE(AGENT_DATA_TYPE* agentData, double v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[All the Create_... functions shall check their parameters for validity.When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned]*/
if(agentData==NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_041:[Creates an AGENT_DATA_TYPE containing an EDM_DOUBLE from double]*/
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_042:[Values of NaN, -INF, +INF are accepted]*/
agentData->type = EDM_DOUBLE_TYPE;
agentData->value.edmDouble.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*create an AGENT_DATA_TYPE containing an EDM_DOUBLE from a double*/
|
create an AGENT_DATA_TYPE containing an EDM_DOUBLE from a double
|
Create_AGENT_DATA_TYPE_from_SINT16
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_SINT16(AGENT_DATA_TYPE* agentData, int16_t v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[ All the Create_... functions shall check their parameters for validity. When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned ].*/
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_INT16_TYPE;
agentData->value.edmInt16.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_043:[ Creates an AGENT_DATA_TYPE containing an EDM_INT16 from int16_t]*/
|
Codes_SRS_AGENT_TYPE_SYSTEM_99_043:[ Creates an AGENT_DATA_TYPE containing an EDM_INT16 from int16_t]
|
Create_AGENT_DATA_TYPE_from_SINT32
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_SINT32(AGENT_DATA_TYPE* agentData, int32_t v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[ All the Create_... functions shall check their parameters for validity. When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned ].*/
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_INT32_TYPE;
agentData->value.edmInt32.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*create an AGENT_DATA_TYPE from INT32_T*/
|
create an AGENT_DATA_TYPE from INT32_T
|
Create_AGENT_DATA_TYPE_from_SINT64
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_SINT64(AGENT_DATA_TYPE* agentData, int64_t v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[ All the Create_... functions shall check their parameters for validity. When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned ].*/
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_INT64_TYPE;
agentData->value.edmInt64.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_045:[ Creates an AGENT_DATA_TYPE containing an EDM_INT64 from int64_t]*/
|
Codes_SRS_AGENT_TYPE_SYSTEM_99_045:[ Creates an AGENT_DATA_TYPE containing an EDM_INT64 from int64_t]
|
Create_AGENT_DATA_TYPE_from_SINT8
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_SINT8(AGENT_DATA_TYPE* agentData, int8_t v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[ All the Create_... functions shall check their parameters for validity. When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned ].*/
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_SBYTE_TYPE;
agentData->value.edmSbyte.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*create an AGENT_DATA_TYPE from int8_t*/
|
create an AGENT_DATA_TYPE from int8_t
|
Create_AGENT_DATA_TYPE_from_FLOAT
|
AGENT_DATA_TYPES_RESULT Create_AGENT_DATA_TYPE_from_FLOAT(AGENT_DATA_TYPE* agentData, float v)
{
AGENT_DATA_TYPES_RESULT result;
/*Codes_SRS_AGENT_TYPE_SYSTEM_99_013:[All the Create_... functions shall check their parameters for validity.When an invalid parameter is detected, a code of AGENT_DATA_TYPES_INVALID_ARG shall be returned]*/
if(agentData==NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_SINGLE_TYPE;
agentData->value.edmSingle.value = v;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/*create an AGENT_DATA_TYPE from SINGLE*/
|
create an AGENT_DATA_TYPE from SINGLE
|
isOneNameNULL
|
static int isOneNameNULL(size_t nMemberNames, const char* const * memberNames)
{
size_t i;
int result = 0;
for (i = 0; i < nMemberNames; i++)
{
if (memberNames[i] == NULL)
{
result = 1;
break;
}
}
return result;
}
|
/*return 0 if all names are different than NULL*/
|
return 0 if all names are different than NULL
|
areThereTwoSameNames
|
static int areThereTwoSameNames(size_t nMemberNames, const char* const * memberNames)
{
size_t i, j;
int result = 0;
for (i = 0; i < nMemberNames-1; i++)
{
for (j = i + 1; j < nMemberNames; j++)
{
if (strcmp(memberNames[i], memberNames[j]) == 0)
{
result = 1;
goto out;
}
}
}
out:
return result;
}
|
/*return 0 if all names are different than NULL*/
|
return 0 if all names are different than NULL
|
Create_NULL_AGENT_DATA_TYPE
|
AGENT_DATA_TYPES_RESULT Create_NULL_AGENT_DATA_TYPE(AGENT_DATA_TYPE* agentData)
{
AGENT_DATA_TYPES_RESULT result;
if (agentData == NULL)
{
result = AGENT_DATA_TYPES_INVALID_ARG;
LogError("(result = %s)", MU_ENUM_TO_STRING(AGENT_DATA_TYPES_RESULT, result));
}
else
{
agentData->type = EDM_NULL_TYPE;
result = AGENT_DATA_TYPES_OK;
}
return result;
}
|
/* Creates an object of AGENT_DATA_TYPE_TYPE EDM_NULL_TYPE*/
|
Creates an object of AGENT_DATA_TYPE_TYPE EDM_NULL_TYPE
|
fill_tm_yday_and_tm_wday
|
static void fill_tm_yday_and_tm_wday(struct tm* source)
{
/*to fill in tm_yday the function shall add the number of days in every month, not including the current one*/
/*and then it will add the number of days in the current month*/
/*1st of Jan is day "0" in a year*/
int year = source->tm_year + 1900 + 10000;
int nLeapYearsSinceYearMinus9999 = ((year - 1) / 4) - ((year - 1) / 100) + ((year - 1) / 400);
source->tm_yday = (daysInAllPreviousMonths(source->tm_mon)) + (source->tm_mday - 1) + ((source->tm_mon > 1 /*1 is Feb*/) && isLeapYear(year));
source->tm_wday = ((365 * year + nLeapYearsSinceYearMinus9999) + source->tm_yday) % 7;
/*day "0" is 1st jan -9999 (this is how much odata can span*/
/*the function shall count days */
}
|
/*this function assumes a correctly filled in tm_year, tm_mon and tm_mday and will fill in tm_yday and tm_wday*/
|
this function assumes a correctly filled in tm_year, tm_mon and tm_mday and will fill in tm_yday and tm_wday
|
sscanf2d
|
static int sscanf2d(const char *pos2, int* sec)
{
int result;
size_t position = 1;
if (
(pos2[0] == ':') &&
(scanAndReadNDigitsInt(pos2, &position, sec, 2) == 0)
)
{
result = 1;
}
else
{
result = EOF;
}
return result;
}
|
/*this function only exists because of optimizing valgrind time, otherwise sscanf would be just as good*/
|
this function only exists because of optimizing valgrind time, otherwise sscanf would be just as good
|
sscanfd
|
static int sscanfd(const char *src, int* dst)
{
int result;
char* next;
long int temp = strtol(src, &next, 10);
if ((src == next) || (((temp == LONG_MAX) || (temp == LONG_MIN)) && (errno != 0)))
{
result = EOF;
}
else
{
(*dst) = (int)temp;
result = 1;
}
return result;
}
|
/*this function only exists because of optimizing valgrind time, otherwise sscanf would be just as good*/
|
this function only exists because of optimizing valgrind time, otherwise sscanf would be just as good
|
sscanfllu
|
static int sscanfllu(const char** src, unsigned long long* dst)
{
int result = 1;
char* next;
(*dst) = strtoull((*src), &next, 10);
if (((*src) == (const char*)next) || (((*dst) == ULLONG_MAX) && (errno != 0)))
{
result = EOF;
}
(*src) = (const char*)next;
return result;
}
|
/*the following function does the same as sscanf(src, "%llu", &dst), but, it changes the src pointer.*/
|
the following function does the same as sscanf(src, "%llu", &dst), but, it changes the src pointer.
|
sscanfdotllu
|
static int sscanfdotllu(const char*src, unsigned long long* dst)
{
int result;
if ((*src) != '.')
{
/*doesn't start with '.' error out*/
result = EOF;
}
else
{
src++;
result = sscanfllu(&src, dst);
}
return result;
}
|
/*the following function does the same as sscanf(src, ".%llu", &dst)*/
|
the following function does the same as sscanf(src, ".%llu", &dst)
|
sscanfu
|
static int sscanfu(const char* src, uint32_t* dst)
{
int result;
char* next;
unsigned long int temp = strtoul(src, &next, 10);
if ((src == next) || ((temp == ULONG_MAX) && (errno != 0)))
{
result = EOF;
}
else
{
result = 1;
(*dst) = (uint32_t)temp;
}
return result;
}
|
/*the following function does the same as sscanf(src, "%u", &dst)*/
|
the following function does the same as sscanf(src, "%u", &dst)
|
sscanff
|
static int sscanff(const char*src, float* dst)
{
int result = 1;
char* next;
(*dst) = strtof(src, &next);
if ((src == next) || (((*dst) == HUGE_VALF) && (errno != 0)))
{
result = EOF;
}
return result;
}
|
/*the following function does the same as sscanf(src, "%f", &dst)*/
|
the following function does the same as sscanf(src, "%f", &dst)
|
sscanflf
|
static int sscanflf(const char*src, double* dst)
{
int result = 1;
char* next;
(*dst) = strtod(src, &next);
if ((src == next) || (((*dst) == HUGE_VALL) && (errno != 0)))
{
result = EOF;
}
return result;
}
|
/*the following function does the same as sscanf(src, "%lf", &dst)*/
|
the following function does the same as sscanf(src, "%lf", &dst)
|
DestroyXioTransport
|
static void DestroyXioTransport(PMQTTTRANSPORT_HANDLE_DATA transport_data)
{
xio_destroy(transport_data->xioTransport);
transport_data->xioTransport = NULL;
}
|
/* Destroys xio transport associated with MQTT handle and resets appropriate state*/
|
Destroys xio transport associated with MQTT handle and resets appropriate state
|
ResetConnectionIfNecessary
|
static void ResetConnectionIfNecessary(PMQTTTRANSPORT_HANDLE_DATA transport_data)
{
if (transport_data->xioTransport != NULL && transport_data->conn_attempted)
{
OPTIONHANDLER_HANDLE options = xio_retrieveoptions(transport_data->xioTransport);
set_saved_tls_options(transport_data, options);
DestroyXioTransport(transport_data);
}
}
|
/* will break reconnection attempt.*/
|
will break reconnection attempt.
|
IoTHubTransportMqtt_Subscribe_DeviceMethod
|
static int IoTHubTransportMqtt_Subscribe_DeviceMethod(IOTHUB_DEVICE_HANDLE handle)
{
return IoTHubTransport_MQTT_Common_Subscribe_DeviceMethod(handle);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_026: [ IoTHubTransportMqtt_Subscribe_DeviceMethod shall subscribe the TRANSPORT_LL_HANDLE by calling into the IoTHubMqttAbstract_Subscribe_DeviceMethod function. ] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_026: [ IoTHubTransportMqtt_Subscribe_DeviceMethod shall subscribe the TRANSPORT_LL_HANDLE by calling into the IoTHubMqttAbstract_Subscribe_DeviceMethod function. ]
|
IoTHubTransportMqtt_Unsubscribe_DeviceMethod
|
static void IoTHubTransportMqtt_Unsubscribe_DeviceMethod(IOTHUB_DEVICE_HANDLE handle)
{
IoTHubTransport_MQTT_Common_Unsubscribe_DeviceMethod(handle);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_027: [ IoTHubTransportMqtt_Unsubscribe_DeviceMethod shall call into the IoTHubMqttAbstract_Unsubscribe_DeviceMethod function. ] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_027: [ IoTHubTransportMqtt_Unsubscribe_DeviceMethod shall call into the IoTHubMqttAbstract_Unsubscribe_DeviceMethod function. ]
|
IoTHubTransportMqtt_Subscribe_DeviceTwin
|
static int IoTHubTransportMqtt_Subscribe_DeviceTwin(IOTHUB_DEVICE_HANDLE handle)
{
return IoTHubTransport_MQTT_Common_Subscribe_DeviceTwin(handle);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_025: [ IoTHubTransportMqtt_Subscribe_DeviceTwin shall call into the IoTHubMqttAbstract_Subscribe_DeviceTwin function. ] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_025: [ IoTHubTransportMqtt_Subscribe_DeviceTwin shall call into the IoTHubMqttAbstract_Subscribe_DeviceTwin function. ]
|
IoTHubTransportMqtt_Unsubscribe_DeviceTwin
|
static void IoTHubTransportMqtt_Unsubscribe_DeviceTwin(IOTHUB_DEVICE_HANDLE handle)
{
IoTHubTransport_MQTT_Common_Unsubscribe_DeviceTwin(handle);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_024: [ IoTHubTransportMqtt_Unsubscribe_DeviceTwin shall shall call into the IoTHubMqttAbstract_Unsubscribe_DeviceTwin function. ] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_024: [ IoTHubTransportMqtt_Unsubscribe_DeviceTwin shall shall call into the IoTHubMqttAbstract_Unsubscribe_DeviceTwin function. ]
|
IoTHubTransportMqtt_DeviceMethod_Response
|
static int IoTHubTransportMqtt_DeviceMethod_Response(IOTHUB_DEVICE_HANDLE handle, METHOD_HANDLE methodId, const unsigned char* response, size_t response_size, int status_response)
{
return IoTHubTransport_MQTT_Common_DeviceMethod_Response(handle, methodId, response, response_size, status_response);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_023: [ IoTHubTransportMqtt_DeviceMethod_Response shall call into the IoTHubMqttAbstract_DeviceMethod_Response function. ] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_023: [ IoTHubTransportMqtt_DeviceMethod_Response shall call into the IoTHubMqttAbstract_DeviceMethod_Response function. ]
|
IoTHubTransportMqtt_SendMessageDisposition
|
static IOTHUB_CLIENT_RESULT IoTHubTransportMqtt_SendMessageDisposition(MESSAGE_CALLBACK_INFO* message_data, IOTHUBMESSAGE_DISPOSITION_RESULT disposition)
{
return IoTHubTransport_MQTT_Common_SendMessageDisposition(message_data, disposition);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_10_001: [IoTHubTransportMqtt_SendMessageDisposition shall send the message disposition by calling into the IoTHubMqttAbstract_SendMessageDisposition function.] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_10_001: [IoTHubTransportMqtt_SendMessageDisposition shall send the message disposition by calling into the IoTHubMqttAbstract_SendMessageDisposition function.]
|
IoTHubTransportMqtt_DoWork
|
static void IoTHubTransportMqtt_DoWork(TRANSPORT_LL_HANDLE handle)
{
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_007: [ IoTHubTransportMqtt_DoWork shall call into the IoTHubMqttAbstract_DoWork function. ] */
IoTHubTransport_MQTT_Common_DoWork(handle);
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_054: [ IoTHubTransportMqtt_DoWork shall subscribe to the Notification and get_state Topics if they are defined. ] */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_054: [ IoTHubTransportMqtt_DoWork shall subscribe to the Notification and get_state Topics if they are defined. ]
|
MQTT_Protocol
|
extern const TRANSPORT_PROVIDER* MQTT_Protocol(void)
{
return &myfunc;
}
|
/* Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_022: [This function shall return a pointer to a structure of type TRANSPORT_PROVIDER */
|
Codes_SRS_IOTHUB_MQTT_TRANSPORT_07_022: [This function shall return a pointer to a structure of type TRANSPORT_PROVIDER
|
attach_ms_timesOutAfter
|
static int attach_ms_timesOutAfter(IOTHUB_CLIENT_CORE_LL_HANDLE_DATA* handleData, IOTHUB_MESSAGE_LIST *newEntry)
{
int result;
/*Codes_SRS_IOTHUBCLIENT_LL_02_043: [ Calling IoTHubClientCore_LL_SetOption with value set to "0" shall disable the timeout mechanism for all new messages. ]*/
if (handleData->currentMessageTimeout == 0)
{
newEntry->ms_timesOutAfter = 0; /*do not timeout*/
newEntry->message_timeout_value = 0;
result = 0;
}
else
{
/*Codes_SRS_IOTHUBCLIENT_LL_02_039: [ "messageTimeout" - once IoTHubClientCore_LL_SendEventAsync is called the message shall timeout after value miliseconds. Value is a pointer to a tickcounter_ms_t. ]*/
if (tickcounter_get_current_ms(handleData->tickCounter, &newEntry->ms_timesOutAfter) != 0)
{
result = MU_FAILURE;
LogError("unable to get the current relative tickcount");
}
else
{
newEntry->message_timeout_value = handleData->currentMessageTimeout;
result = 0;
}
}
return result;
}
|
/*returns 0 on success, any other value is error*/
|
returns 0 on success, any other value is error
|
IoTHubClientCore_LL_GenericMethodInvoke
|
IOTHUB_CLIENT_RESULT IoTHubClientCore_LL_GenericMethodInvoke(IOTHUB_CLIENT_CORE_LL_HANDLE iotHubClientHandle, const char* deviceId, const char* moduleId, const char* methodName, const char* methodPayload, unsigned int timeout, int* responseStatus, unsigned char** responsePayload, size_t* responsePayloadSize)
{
IOTHUB_CLIENT_RESULT result;
if (iotHubClientHandle != NULL)
{
if (moduleId != NULL)
{
result = IoTHubClient_Edge_ModuleMethodInvoke(iotHubClientHandle->methodHandle, deviceId, moduleId, methodName, methodPayload, timeout, responseStatus, responsePayload, responsePayloadSize);
}
else
{
result = IoTHubClient_Edge_DeviceMethodInvoke(iotHubClientHandle->methodHandle, deviceId, methodName, methodPayload, timeout, responseStatus, responsePayload, responsePayloadSize);
}
}
else
{
result = IOTHUB_CLIENT_INVALID_ARG;
}
return result;
}
|
/* These should be replaced during iothub_client refactor */
|
These should be replaced during iothub_client refactor
|
DataPublisher_GetMaxBufferSize
|
size_t DataPublisher_GetMaxBufferSize(void)
{
return maxBufferSize_;
}
|
/* Codes_SRS_DATA_PUBLISHER_99_069:[ DataMarshaller_GetMaxBufferSize shall return the current max buffer size value used by any new instance of DataMarshaller.] */
|
Codes_SRS_DATA_PUBLISHER_99_069:[ DataMarshaller_GetMaxBufferSize shall return the current max buffer size value used by any new instance of DataMarshaller.]
|
getChildByName
|
static MULTITREE_HANDLE_DATA* getChildByName(MULTITREE_HANDLE_DATA* node, const char* name)
{
MULTITREE_HANDLE_DATA* result = NULL;
size_t i;
for (i = 0; i < node->nChildren; i++)
{
if (strcmp(node->children[i]->name, name) == 0)
{
result = node->children[i];
break;
}
}
return result;
}
|
/*returns a pointer to the existing child (if any)*/
|
returns a pointer to the existing child (if any)
|
snprintf
|
int snprintf(char * s, size_t n, const char * format, ...)
{
int result;
va_list args;
va_start(args, format);
result = vsnprintf(s, n, format, args);
va_end(args);
return result;
}
|
/* Returns number of characters copied.*/
|
Returns number of characters copied.
|
json_object_get_value
|
JSON_Value * json_object_get_value(const JSON_Object *object, const char *name) {
if (object == NULL || name == NULL) {
return NULL;
}
return json_object_getn_value(object, name, strlen(name));
}
|
/* JSON Object API */
|
JSON Object API
|
u8g2_draw_ellipse_section
|
static void u8g2_draw_ellipse_section(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t x0, u8g2_uint_t y0, uint8_t option)
{
/* upper right */
if ( option & U8G2_DRAW_UPPER_RIGHT )
{
u8g2_DrawPixel(u8g2, x0 + x, y0 - y);
}
/* upper left */
if ( option & U8G2_DRAW_UPPER_LEFT )
{
u8g2_DrawPixel(u8g2, x0 - x, y0 - y);
}
/* lower right */
if ( option & U8G2_DRAW_LOWER_RIGHT )
{
u8g2_DrawPixel(u8g2, x0 + x, y0 + y);
}
/* lower left */
if ( option & U8G2_DRAW_LOWER_LEFT )
{
u8g2_DrawPixel(u8g2, x0 - x, y0 + y);
}
}
|
/*
Source:
Foley, Computer Graphics, p 90
*/
|
Source: Foley, Computer Graphics, p 90
|
u8g2_DrawBox
|
void u8g2_DrawBox(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t h)
{
#ifdef U8G2_WITH_INTERSECTION
if ( u8g2_IsIntersection(u8g2, x, y, x+w, y+h) == 0 )
return;
#endif /* U8G2_WITH_INTERSECTION */
while( h != 0 )
{
u8g2_DrawHVLine(u8g2, x, y, w, 0);
y++;
h--;
}
}
|
/*
draw a filled box
restriction: does not work for w = 0 or h = 0
*/
|
draw a filled box restriction: does not work for w = 0 or h = 0
|
u8g2_SetDrawColor
|
void u8g2_SetDrawColor(u8g2_t *u8g2, uint8_t color)
{
u8g2->draw_color = color; /* u8g2_SetDrawColor: just assign the argument */
if ( color >= 3 )
u8g2->draw_color = 1; /* u8g2_SetDrawColor: make color as one if arg is invalid */
}
|
/*
Assign the draw color for all drawing functions.
color may be 0 or 1. The actual color is defined by the display.
With color = 1 the drawing function will set the display memory to 1.
For OLEDs this ususally means, that the pixel is enabled and the LED
at the pixel is turned on.
On an LCD it usually means that the LCD segment of the pixel is enabled,
which absorbs the light.
For eInk/ePaper it means black ink.
7 Jan 2017: Allow color value 2 for XOR operation.
*/
|
Assign the draw color for all drawing functions. color may be 0 or 1. The actual color is defined by the display. With color = 1 the drawing function will set the display memory to 1. For OLEDs this ususally means, that the pixel is enabled and the LED at the pixel is turned on. On an LCD it usually means that the LCD segment of the pixel is enabled, which absorbs the light. For eInk/ePaper it means black ink.
7 Jan 2017: Allow color value 2 for XOR operation.
|
u8x8_d_ssd1306_48x64_winstar
|
uint8_t u8x8_d_ssd1306_48x64_winstar(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int,
void *arg_ptr)
{
if (msg == U8X8_MSG_DISPLAY_SETUP_MEMORY)
{
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_48x64_display_info);
return 1;
}
else if (msg == U8X8_MSG_DISPLAY_INIT)
{
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_48x64_winstar_init_seq);
return 1;
}
return u8x8_d_ssd1306_48x64_generic(u8x8, msg, arg_int, arg_ptr);
}
|
/* Winstar 0.71" OLED */
|
Winstar 0.71" OLED
|
u8g2_send_buffer
|
static void u8g2_send_buffer(u8g2_t *u8g2)
{
uint8_t src_row;
uint8_t src_max;
uint8_t dest_row;
uint8_t dest_max;
src_row = 0;
src_max = u8g2->tile_buf_height;
dest_row = u8g2->tile_curr_row;
dest_max = u8g2_GetU8x8(u8g2)->display_info->tile_height;
do
{
u8g2_send_tile_row(u8g2, src_row, dest_row);
src_row++;
dest_row++;
} while( src_row < src_max && dest_row < dest_max );
}
|
/*
write the buffer to the display RAM.
For most displays, this will make the content visible to the user.
Some displays (like the SSD1606) require a u8x8_RefreshDisplay()
*/
|
write the buffer to the display RAM. For most displays, this will make the content visible to the user. Some displays (like the SSD1606) require a u8x8_RefreshDisplay()
|
u8g2_SendBuffer
|
void u8g2_SendBuffer(u8g2_t *u8g2)
{
u8g2_send_buffer(u8g2);
u8x8_RefreshDisplay( u8g2_GetU8x8(u8g2) );
}
|
/* same as u8g2_send_buffer but also send the DISPLAY_REFRESH message (used by SSD1606) */
|
same as u8g2_send_buffer but also send the DISPLAY_REFRESH message (used by SSD1606)
|
u8g2_UpdateDisplayArea
|
void u8g2_UpdateDisplayArea(u8g2_t *u8g2, uint8_t tx, uint8_t ty, uint8_t tw, uint8_t th)
{
uint16_t page_size;
uint8_t *ptr;
/* check, whether we are in full buffer mode */
if ( u8g2->tile_buf_height != u8g2_GetU8x8(u8g2)->display_info->tile_height )
return; /* not in full buffer mode, do nothing */
page_size = u8g2->pixel_buf_width; /* 8*u8g2->u8g2_GetU8x8(u8g2)->display_info->tile_width */
ptr = u8g2_GetBufferPtr(u8g2);
ptr += tx*8;
ptr += page_size*ty;
while( th > 0 )
{
u8x8_DrawTile( u8g2_GetU8x8(u8g2), tx, ty, tw, ptr );
ptr += page_size;
ty++;
th--;
}
}
|
/*
Description:
Update a sub area of the display, given by tile position, width and height.
The arguments are "tile" coordinates. Any u8g2 rotation is ignored.
This procedure only checks whether full buffer mode is active.
There is no error checking for the arguments: It is the responsibility of the
user to ensure, that the provided arguments are correct.
Limitations:
- Only available in full buffer mode (will not do anything in page mode)
- Tile positions and sizes (pixel position divided by 8)
- Any display rotation/mirror is ignored
- Only works with displays, which support U8x8 API
- Will not send the e-paper refresh message (will probably not work with e-paper devices)
*/
|
Description: Update a sub area of the display, given by tile position, width and height. The arguments are "tile" coordinates. Any u8g2 rotation is ignored. This procedure only checks whether full buffer mode is active. There is no error checking for the arguments: It is the responsibility of the user to ensure, that the provided arguments are correct.
Limitations: - Only available in full buffer mode (will not do anything in page mode) - Tile positions and sizes (pixel position divided by 8) - Any display rotation/mirror is ignored - Only works with displays, which support U8x8 API - Will not send the e-paper refresh message (will probably not work with e-paper devices)
|
u8g2_UpdateDisplay
|
void u8g2_UpdateDisplay(u8g2_t *u8g2)
{
u8g2_send_buffer(u8g2);
}
|
/* same as sendBuffer, but does not send the ePaper refresh message */
|
same as sendBuffer, but does not send the ePaper refresh message
|
u8g2_WriteBufferPBM
|
void u8g2_WriteBufferPBM(u8g2_t *u8g2, void (*out)(const char *s))
{
u8x8_capture_write_pbm_pre(u8g2_GetBufferTileWidth(u8g2), u8g2_GetBufferTileHeight(u8g2), out);
u8x8_capture_write_pbm_buffer(u8g2_GetBufferPtr(u8g2), u8g2_GetBufferTileWidth(u8g2), u8g2_GetBufferTileHeight(u8g2), u8x8_capture_get_pixel_1, out);
}
|
/* vertical_top memory architecture */
|
vertical_top memory architecture
|
u8g2_WriteBufferPBM2
|
void u8g2_WriteBufferPBM2(u8g2_t *u8g2, void (*out)(const char *s))
{
u8x8_capture_write_pbm_pre(u8g2_GetBufferTileWidth(u8g2), u8g2_GetBufferTileHeight(u8g2), out);
u8x8_capture_write_pbm_buffer(u8g2_GetBufferPtr(u8g2), u8g2_GetBufferTileWidth(u8g2), u8g2_GetBufferTileHeight(u8g2), u8x8_capture_get_pixel_2, out);
}
|
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
|
SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0
|
u8x8_d_ssd1306_96x16_er
|
uint8_t u8x8_d_ssd1306_96x16_er(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
{
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_ssd1306_96x16_display_info);
return 1;
}
else if ( msg == U8X8_MSG_DISPLAY_INIT )
{
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_ssd1306_96x16_er_init_seq);
return 1;
}
return u8x8_d_ssd1306_96x16_generic(u8x8, msg, arg_int, arg_ptr);
}
|
/* East Rising 0.69" OLED */
|
East Rising 0.69" OLED
|
u8g2_ClearDisplay
|
void u8g2_ClearDisplay(u8g2_t *u8g2)
{
u8g2_FirstPage(u8g2);
do {
} while ( u8g2_NextPage(u8g2) );
/*
This function is usually called during startup (u8g2.begin()).
However the user might want to use full buffer mode with clear and
send commands.
This will not work because the current tile row is modified by the picture
loop above. To fix this, reset the tile row to 0, issue #370
A workaround would be, that the user sets the current tile row to 0 manually.
*/
u8g2_SetBufferCurrTileRow(u8g2, 0);
}
|
/* This is done with u8g2 picture loop, because we can not use the u8x8 function in all cases */
|
This is done with u8g2 picture loop, because we can not use the u8x8 function in all cases
|
u8x8_capture_get_pixel_1
|
uint8_t u8x8_capture_get_pixel_1(uint16_t x, uint16_t y, uint8_t *dest_ptr, uint8_t tile_width)
{
//uint8_t *dest_ptr = capture->buffer;
//if ( dest_ptr == NULL )
//return 0;
//dest_ptr += (y/8)*capture->tile_width*8;
dest_ptr += (y/8)*tile_width*8;
y &= 7;
dest_ptr += x;
if ( (*dest_ptr & (1<<y)) == 0 )
return 0;
return 1;
}
|
/* vertical top lsb memory architecture */
|
vertical top lsb memory architecture
|
u8x8_capture_get_pixel_2
|
uint8_t u8x8_capture_get_pixel_2(uint16_t x, uint16_t y, uint8_t *dest_ptr, uint8_t tile_width)
{
//uint8_t *dest_ptr = capture->buffer;
//if ( dest_ptr == NULL )
// return 0;
//dest_ptr += y*capture->tile_width;
y *= tile_width;
dest_ptr += y;
dest_ptr += x>>3;
if ( (*dest_ptr & (128>>(x&7))) == 0 )
return 0;
return 1;
}
|
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
|
SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0
|
u8x8_ConnectCapture
|
void u8x8_ConnectCapture(u8x8_t *u8x8, uint8_t tile_width, uint8_t tile_height, uint8_t *memory)
{
if ( u8x8->display_cb == u8x8_d_capture )
return; /* do nothing, capture already installed */
u8x8_capture.buffer = memory; /* tile_width*tile_height*8 bytes */
u8x8_capture.tile_width = tile_width;
u8x8_capture.tile_height = tile_height;
u8x8_capture.old_cb = u8x8->display_cb;
u8x8->display_cb = u8x8_d_capture;
return;
}
|
/* memory: tile_width*tile_height*8 bytes */
|
memory: tile_width*tile_height*8 bytes
|
u8x8_d_sh1106_72x40_wise
|
uint8_t u8x8_d_sh1106_72x40_wise(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
if ( msg == U8X8_MSG_DISPLAY_SETUP_MEMORY )
{
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_sh1106_72x40_display_info);
return 1;
}
else if ( msg == U8X8_MSG_DISPLAY_INIT )
{
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_sh1106_72x40_init_seq);
return 1;
}
return u8x8_d_sh1106_72x40_generic(u8x8, msg, arg_int, arg_ptr);
}
|
/* WiseChip 0.42" OLED */
|
WiseChip 0.42" OLED
|
u8x8_find_first_diff
|
static uint8_t u8x8_find_first_diff(uint8_t a, uint8_t b)
{
uint8_t mask;
uint8_t i;
mask = 1;
i = U8X8_PIN_INPUT_CNT;
do
{
i--;
if ( (a & mask) != (b & mask) )
return i;
mask <<= 1;
} while( i > 0 );
return U8X8_PIN_INPUT_CNT;
}
|
/*
return 0 to U8X8_PIN_INPUT_CNT-1 if there is a difference
return U8X8_PIN_INPUT_CNT if there is no difference
*/
|
return 0 to U8X8_PIN_INPUT_CNT-1 if there is a difference return U8X8_PIN_INPUT_CNT if there is no difference
|
u8g2_DrawUTF8Lines
|
u8g2_uint_t u8g2_DrawUTF8Lines(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t w, u8g2_uint_t line_height, const char *s)
{
uint8_t i;
uint8_t cnt;
u8g2_uint_t yy = 0;
cnt = u8x8_GetStringLineCnt(s);
//printf("str=%s\n", s);
//printf("cnt=%d, y=%d, line_height=%d\n", cnt, y, line_height);
for( i = 0; i < cnt; i++ )
{
//printf(" i=%d, y=%d, line_height=%d\n", i, y, line_height);
u8g2_DrawUTF8Line(u8g2, x, y, w, u8x8_GetStringLineStart(i, s), 0, 0);
y+=line_height;
yy+=line_height;
}
return yy;
}
|
/*
draw several lines at position x,y.
lines are stored in s and must be separated with '\n'.
lines can be centered with respect to "w"
if s == NULL nothing is drawn and 0 is returned
returns the number of lines in s multiplied with line_height
*/
|
draw several lines at position x,y. lines are stored in s and must be separated with ' '. lines can be centered with respect to "w" if s == NULL nothing is drawn and 0 is returned returns the number of lines in s multiplied with line_height
|
u8g2_DrawBitmap
|
void u8g2_DrawBitmap(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t cnt, u8g2_uint_t h, const uint8_t *bitmap)
{
u8g2_uint_t w;
w = cnt;
w *= 8;
#ifdef U8G2_WITH_INTERSECTION
if ( u8g2_IsIntersection(u8g2, x, y, x+w, y+h) == 0 )
return;
#endif /* U8G2_WITH_INTERSECTION */
while( h > 0 )
{
u8g2_DrawHorizontalBitmap(u8g2, x, y, w, bitmap);
bitmap += cnt;
y++;
h--;
}
}
|
/* u8glib compatible bitmap draw function */
|
u8glib compatible bitmap draw function
|
u8x8_draw_1x2_subglyph
|
static void u8x8_draw_1x2_subglyph(u8x8_t *u8x8, uint8_t x, uint8_t y, uint8_t encoding, uint8_t tile)
{
uint8_t i;
uint16_t t;
uint8_t buf[8];
uint8_t buf1[8];
uint8_t buf2[8];
u8x8_get_glyph_data(u8x8, encoding, buf, tile);
for( i = 0; i < 8; i ++ )
{
t = u8x8_upscale_byte(buf[i]);
buf1[i] = t >> 8;
buf2[i] = t & 255;
}
u8x8_DrawTile(u8x8, x, y, 1, buf2);
u8x8_DrawTile(u8x8, x, y+1, 1, buf1);
}
|
/* https://github.com/olikraus/u8g2/issues/474 */
|
https://github.com/olikraus/u8g2/issues/474
|
u8x8_utf8_init
|
void u8x8_utf8_init(u8x8_t *u8x8)
{
u8x8->utf8_state = 0; /* also reset during u8x8_SetupDefaults() */
}
|
/* reset the internal state machine */
|
reset the internal state machine
|
u8x8_cad_110
|
uint8_t u8x8_cad_110(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_CAD_SEND_CMD:
u8x8_byte_SetDC(u8x8, 1);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_ARG:
u8x8_byte_SetDC(u8x8, 1);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_DATA:
u8x8_byte_SetDC(u8x8, 0);
//u8x8_byte_SendBytes(u8x8, arg_int, arg_ptr);
//break;
/* fall through */
case U8X8_MSG_CAD_INIT:
case U8X8_MSG_CAD_START_TRANSFER:
case U8X8_MSG_CAD_END_TRANSFER:
return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr);
default:
return 0;
}
return 1;
}
|
/*
convert to bytes by using
dc = 1 for commands and args and
dc = 0 for data
*/
|
convert to bytes by using dc = 1 for commands and args and dc = 0 for data
|
u8x8_cad_100
|
uint8_t u8x8_cad_100(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_CAD_SEND_CMD:
u8x8_byte_SetDC(u8x8, 1);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_ARG:
u8x8_byte_SetDC(u8x8, 0);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_DATA:
u8x8_byte_SetDC(u8x8, 0);
//u8x8_byte_SendBytes(u8x8, arg_int, arg_ptr);
//break;
/* fall through */
case U8X8_MSG_CAD_INIT:
case U8X8_MSG_CAD_START_TRANSFER:
case U8X8_MSG_CAD_END_TRANSFER:
return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr);
default:
return 0;
}
return 1;
}
|
/*
convert to bytes by using
dc = 1 for commands and args and
dc = 0 for data
t6963
*/
|
convert to bytes by using dc = 1 for commands and args and dc = 0 for data t6963
|
u8x8_cad_001
|
uint8_t u8x8_cad_001(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_CAD_SEND_CMD:
u8x8_byte_SetDC(u8x8, 0);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_ARG:
u8x8_byte_SetDC(u8x8, 0);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_DATA:
u8x8_byte_SetDC(u8x8, 1);
//u8x8_byte_SendBytes(u8x8, arg_int, arg_ptr);
//break;
/* fall through */
case U8X8_MSG_CAD_INIT:
case U8X8_MSG_CAD_START_TRANSFER:
case U8X8_MSG_CAD_END_TRANSFER:
return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr);
default:
return 0;
}
return 1;
}
|
/*
convert to bytes by using
dc = 0 for commands and args and
dc = 1 for data
*/
|
convert to bytes by using dc = 0 for commands and args and dc = 1 for data
|
u8x8_cad_011
|
uint8_t u8x8_cad_011(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_CAD_SEND_CMD:
u8x8_byte_SetDC(u8x8, 0);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_ARG:
u8x8_byte_SetDC(u8x8, 1);
u8x8_byte_SendByte(u8x8, arg_int);
break;
case U8X8_MSG_CAD_SEND_DATA:
u8x8_byte_SetDC(u8x8, 1);
//u8x8_byte_SendBytes(u8x8, arg_int, arg_ptr);
//break;
/* fall through */
case U8X8_MSG_CAD_INIT:
case U8X8_MSG_CAD_START_TRANSFER:
case U8X8_MSG_CAD_END_TRANSFER:
return u8x8->byte_cb(u8x8, msg, arg_int, arg_ptr);
default:
return 0;
}
return 1;
}
|
/*
convert to bytes by using
dc = 0 for commands
dc = 1 for args and data
*/
|
convert to bytes by using dc = 0 for commands dc = 1 for args and data
|
i2c_read_scl_and_delay
|
static void i2c_read_scl_and_delay(u8x8_t *u8x8)
{
/* set as input (line will be high) */
u8x8_gpio_SetI2CClock(u8x8, 1);
i2c_delay(u8x8);
}
|
/* actually, the scl line is not observed, so this procedure does not return a value */
|
actually, the scl line is not observed, so this procedure does not return a value
|
reverse_byte
|
static uint8_t reverse_byte(uint8_t v)
{
// if ( v != 0 && v != 255 ) does not help much
{
// swap odd and even bits
v = ((v >> 1) & 0x055) | ((v & 0x055) << 1);
// swap consecutive pairs
v = ((v >> 2) & 0x033) | ((v & 0x033) << 2);
// swap nibbles ...
v = ((v >> 4) & 0x00F) | ((v & 0x00F) << 4);
}
return v;
}
|
/* http://graphics.stanford.edu/~seander/bithacks.html */
|
http://graphics.stanford.edu/~seander/bithacks.html
|
u8sl_Next
|
void u8sl_Next(u8sl_t *u8sl)
{
u8sl->current_pos++;
if ( u8sl->current_pos >= u8sl->total )
{
u8sl->current_pos = 0;
u8sl->first_pos = 0;
}
else
{
if ( u8sl->first_pos + u8sl->visible <= u8sl->current_pos + 1 )
{
u8sl->first_pos = u8sl->current_pos - u8sl->visible + 1;
}
}
}
|
/*
increase the cursor position
*/
|
increase the cursor position
|
u8x8_sl_string_line_cb
|
void u8x8_sl_string_line_cb(u8x8_t *u8x8, u8sl_t *u8sl, uint8_t idx, const void *aux)
{
const char *s;
uint8_t row;
/* calculate offset from display upper border */
row = u8sl->y;
/* calculate target pos */
row += idx;
row -= u8sl->first_pos;
/* check whether this is the current cursor line */
if ( idx == u8sl->current_pos )
u8x8_SetInverseFont(u8x8, 1);
else
u8x8_SetInverseFont(u8x8, 0);
/* get the line from the array */
s = u8x8_GetStringLineStart(idx, (const char *)aux);
/* draw the line */
if ( s == NULL )
s = "";
u8x8_DrawUTF8Line(u8x8, u8sl->x, row, u8x8_GetCols(u8x8), s);
u8x8_SetInverseFont(u8x8, 0);
}
|
/* selection list with string line */
|
selection list with string line
|
u8g2_SetDisplayRotation
|
void u8g2_SetDisplayRotation(u8g2_t *u8g2, const u8g2_cb_t *u8g2_cb)
{
u8g2->cb = u8g2_cb;
u8g2->cb->update_dimension(u8g2);
u8g2->cb->update_page_win(u8g2);
}
|
/*
Usually the display rotation is set initially, but it could be done later also
u8g2_cb can be U8G2_R0..U8G2_R3
*/
|
Usually the display rotation is set initially, but it could be done later also u8g2_cb can be U8G2_R0..U8G2_R3
|
u8g2_draw_l90_r1
|
void u8g2_draw_l90_r1(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
u8g2_uint_t xx, yy;
#ifdef __unix
assert( dir <= 1 );
#endif
yy = x;
xx = u8g2->height;
xx -= y;
xx--;
dir ++;
if ( dir == 2 )
{
xx -= len;
xx++;
dir = 0;
}
u8g2_draw_hv_line_2dir(u8g2, xx, yy, len, dir);
}
|
/* dir = 0 or 1 */
|
dir = 0 or 1
|
u8g2_Setup_null
|
void u8g2_Setup_null(u8g2_t *u8g2, const u8g2_cb_t *rotation, u8x8_msg_cb byte_cb, u8x8_msg_cb gpio_and_delay_cb)
{
static uint8_t buf[8];
u8g2_SetupDisplay(u8g2, u8x8_d_null_cb, u8x8_cad_empty, byte_cb, gpio_and_delay_cb);
u8g2_SetupBuffer(u8g2, buf, 1, u8g2_ll_hvline_vertical_top_lsb, rotation);
}
|
/* setup for the null (empty) device */
|
setup for the null (empty) device
|
u8g2_draw_pixel_vertical_top_lsb
|
static void u8g2_draw_pixel_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y)
{
uint16_t offset;
uint8_t *ptr;
uint8_t bit_pos, mask;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = y; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 1;
mask <<= bit_pos;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset &= ~7;
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
ptr += x;
if ( u8g2->draw_color <= 1 )
*ptr |= mask;
if ( u8g2->draw_color != 1 )
*ptr ^= mask;
}
|
/*
x,y position within the buffer
*/
|
x,y position within the buffer
|
u8g2_ll_hvline_vertical_top_lsb
|
void u8g2_ll_hvline_vertical_top_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
if ( dir == 0 )
{
do
{
u8g2_draw_pixel_vertical_top_lsb(u8g2, x, y);
x++;
len--;
} while( len != 0 );
}
else
{
do
{
u8g2_draw_pixel_vertical_top_lsb(u8g2, x, y);
y++;
len--;
} while( len != 0 );
}
}
|
/*
x,y Upper left position of the line within the local buffer (not the display!)
len length of the line in pixel, len must not be 0
dir 0: horizontal line (left to right)
1: vertical line (top to bottom)
asumption:
all clipping done
*/
|
x,y Upper left position of the line within the local buffer (not the display!) len length of the line in pixel, len must not be 0 dir 0: horizontal line (left to right) 1: vertical line (top to bottom) asumption: all clipping done
|
u8g2_draw_pixel_horizontal_right_lsb
|
static void u8g2_draw_pixel_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y)
{
uint16_t offset;
uint8_t *ptr;
uint8_t bit_pos, mask;
//assert(x >= u8g2->buf_x0);
//assert(x < u8g2_GetU8x8(u8g2)->display_info->tile_width*8);
//assert(y >= u8g2->buf_y0);
//assert(y < u8g2_GetU8x8(u8g2)->display_info->tile_height*8);
/* bytes are vertical, lsb on top (y=0), msb at bottom (y=7) */
bit_pos = x; /* overflow truncate is ok here... */
bit_pos &= 7; /* ... because only the lowest 3 bits are needed */
mask = 128;
mask >>= bit_pos;
x >>= 3;
offset = y; /* y might be 8 or 16 bit, but we need 16 bit, so use a 16 bit variable */
offset *= u8g2_GetU8x8(u8g2)->display_info->tile_width;
offset += x;
ptr = u8g2->tile_buf_ptr;
ptr += offset;
if ( u8g2->draw_color <= 1 )
*ptr |= mask;
if ( u8g2->draw_color != 1 )
*ptr ^= mask;
}
|
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
|
SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0
|
u8g2_ll_hvline_horizontal_right_lsb
|
void u8g2_ll_hvline_horizontal_right_lsb(u8g2_t *u8g2, u8g2_uint_t x, u8g2_uint_t y, u8g2_uint_t len, uint8_t dir)
{
if ( dir == 0 )
{
do
{
u8g2_draw_pixel_horizontal_right_lsb(u8g2, x, y);
x++;
len--;
} while( len != 0 );
}
else
{
do
{
u8g2_draw_pixel_horizontal_right_lsb(u8g2, x, y);
y++;
len--;
} while( len != 0 );
}
}
|
/* SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0 */
|
SH1122, LD7032, ST7920, ST7986, LC7981, T6963, SED1330, RA8835, MAX7219, LS0
|
u8g2_font_get_byte
|
static uint8_t u8g2_font_get_byte(const uint8_t *font, uint8_t offset)
{
font += offset;
return u8x8_pgm_read( font );
}
|
/*static uint8_t u8g2_font_get_byte(const uint8_t *font, uint8_t offset) U8G2_NOINLINE;*/
|
static uint8_t u8g2_font_get_byte(const uint8_t *font, uint8_t offset) U8G2_NOINLINE;
|
u8g2_GetFontSize
|
size_t u8g2_GetFontSize(const uint8_t *font_arg)
{
uint16_t e;
const uint8_t *font = font_arg;
font += U8G2_FONT_DATA_STRUCT_SIZE;
for(;;)
{
if ( u8x8_pgm_read( font + 1 ) == 0 )
break;
font += u8x8_pgm_read( font + 1 );
}
/* continue with unicode section */
font += 2;
/* skip unicode lookup table */
font += u8g2_font_get_word(font, 0);
for(;;)
{
e = u8x8_pgm_read( font );
e <<= 8;
e |= u8x8_pgm_read( font + 1 );
if ( e == 0 )
break;
font += u8x8_pgm_read( font + 2 );
}
return (font - font_arg) + 2;
}
|
/* calculate the overall length of the font, only used to create the picture for the google wiki */
|
calculate the overall length of the font, only used to create the picture for the google wiki
|
u8g2_GetFontBBXWidth
|
uint8_t u8g2_GetFontBBXWidth(u8g2_t *u8g2)
{
return u8g2->font_info.max_char_width; /* new font info structure */
}
|
/* u8g2 interface, font access */
|
u8g2 interface, font access
|
u8g2_GetGlyphWidth
|
int8_t u8g2_GetGlyphWidth(u8g2_t *u8g2, uint16_t requested_encoding)
{
const uint8_t *glyph_data = u8g2_font_get_glyph_data(u8g2, requested_encoding);
if ( glyph_data == NULL )
return 0;
u8g2_font_setup_decode(u8g2, glyph_data);
u8g2->glyph_x_offset = u8g2_font_decode_get_signed_bits(&(u8g2->font_decode), u8g2->font_info.bits_per_char_x);
u8g2_font_decode_get_signed_bits(&(u8g2->font_decode), u8g2->font_info.bits_per_char_y);
/* glyph width is here: u8g2->font_decode.glyph_width */
return u8g2_font_decode_get_signed_bits(&(u8g2->font_decode), u8g2->font_info.bits_per_delta_x);
}
|
/* side effect: updates u8g2->font_decode and u8g2->glyph_x_offset */
|
side effect: updates u8g2->font_decode and u8g2->glyph_x_offset
|
u8g2_SetFontMode
|
void u8g2_SetFontMode(u8g2_t *u8g2, uint8_t is_transparent)
{
u8g2->font_decode.is_transparent = is_transparent; // new font procedures
}
|
/*
set one of:
U8G2_FONT_MODE_TRANSPARENT
U8G2_FONT_MODE_SOLID
U8G2_FONT_MODE_NONE
This has been changed for the new font procedures
*/
|
set one of: U8G2_FONT_MODE_TRANSPARENT U8G2_FONT_MODE_SOLID U8G2_FONT_MODE_NONE This has been changed for the new font procedures
|
u8g2_font_calc_vref_font
|
u8g2_uint_t u8g2_font_calc_vref_font(U8X8_UNUSED u8g2_t *u8g2)
{
return 0;
}
|
/* callback procedures to correct the y position */
|
callback procedures to correct the y position
|
u8g2_GetStrX
|
int8_t u8g2_GetStrX(u8g2_t *u8g2, const char *s)
{
uint8_t w;
int8_t ox, dx;
u8g2_GetGlyphHorizontalProperties(u8g2, *s, &w, &ox, &dx);
return ox;
}
|
/* u8g compatible GetStrX function */
|
u8g compatible GetStrX function
|
u8x8_u16toa
|
const char *u8x8_u16toa(uint16_t v, uint8_t d)
{
static char buf[6];
d = 5-d;
return u8x8_u16toap(buf, v) + d;
}
|
/* v = value, d = number of digits */
|
v = value, d = number of digits
|
u8x8_d_t6963_128x64_alt
|
uint8_t u8x8_d_t6963_128x64_alt(u8x8_t *u8x8, uint8_t msg, uint8_t arg_int, void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_t6963_128x64_display_info);
break;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
u8x8_cad_SendSequence(u8x8, u8x8_d_t6963_160x80_init_seq);
break;
default:
return u8x8_d_t6963_common(u8x8, msg, arg_int, arg_ptr);
}
return 1;
}
|
/* alternative version for the 128x64 t6963 display: use the 160x80 init sequence */
|
alternative version for the 128x64 t6963 display: use the 160x80 init sequence
|
u8x8_dummy_cb
|
uint8_t u8x8_dummy_cb(U8X8_UNUSED u8x8_t *u8x8, U8X8_UNUSED uint8_t msg, U8X8_UNUSED uint8_t arg_int, U8X8_UNUSED void *arg_ptr)
{
/* the dummy callback will not handle any message and will fail for all messages */
return 0;
}
|
/* universal dummy callback, which will be default for all callbacks */
|
universal dummy callback, which will be default for all callbacks
|
u8x8_d_null_cb
|
uint8_t u8x8_d_null_cb(u8x8_t *u8x8, uint8_t msg, U8X8_UNUSED uint8_t arg_int, U8X8_UNUSED void *arg_ptr)
{
switch(msg)
{
case U8X8_MSG_DISPLAY_SETUP_MEMORY:
u8x8_d_helper_display_setup_memory(u8x8, &u8x8_null_display_info);
break;
case U8X8_MSG_DISPLAY_INIT:
u8x8_d_helper_display_init(u8x8);
break;
}
/* the null device callback will succeed for all messages */
return 1;
}
|
/* a special null device */
|
a special null device
|
u8x8_SetupDefaults
|
void u8x8_SetupDefaults(u8x8_t *u8x8)
{
u8x8->display_info = NULL;
u8x8->display_cb = u8x8_dummy_cb;
u8x8->cad_cb = u8x8_dummy_cb;
u8x8->byte_cb = u8x8_dummy_cb;
u8x8->gpio_and_delay_cb = u8x8_dummy_cb;
u8x8->is_font_inverse_mode = 0;
//u8x8->device_address = 0;
u8x8->utf8_state = 0; /* also reset by u8x8_utf8_init */
u8x8->bus_clock = 0; /* issue 769 */
u8x8->i2c_address = 255;
u8x8->debounce_default_pin_state = 255; /* assume all low active buttons */
#ifdef U8X8_USE_PINS
{
uint8_t i;
for( i = 0; i < U8X8_PIN_CNT; i++ )
u8x8->pins[i] = U8X8_PIN_NONE;
}
#endif
}
|
/*
Description:
Setup u8x8
Args:
u8x8 An empty u8x8 structure
*/
|
Description: Setup u8x8 Args: u8x8 An empty u8x8 structure
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.