UG-1828 Preliminary Technical Data
Rev. PrC | Page 40 of 338
delay(1);
bcm2835_gpio_write(CE_PIN, HIGH);
return 0;
}
int32_t customer_adi_adrv9001_hal_resetbPin_set(void *devHalCfg, uint8_t pinLevel)
{
/* Customer code goes here */
if (pinLevel == 1){
bcm2835_gpio_write(RESET_PIN, HIGH);
}else{
bcm2835_gpio_write(RESET_PIN, LOW);
}
return 0;
}
In this example of the Raspberry Pi platform the Makefile must also be altered to suit. As this example uses the bcm2835 library, an
additional link must be made in the Makefile, as shown here:
-lm -lbcm2835 -lpthread
This link will allow the compiler to access the bcm2835 library, provided it is installed correctly on the Raspberry Pi. Similar measures will
need to be taken on a customer platform if additional libraries are needed for control of their platform.
Once the auto-generated code has been verified as operational, and then modified to suit the customer’s platform, it is safe to remove all
files, folders and function calls (including print statements that are not needed) containing code that does not pertain to the customer’s
platform. Doing so requires that the customer is certain that all calls to the removed functions have been replaced by their bespoke code or
removed altogether. Once finished, again review the Makefile and remove any unnecessary links and includes from the compilation process.
API Error Handling and Debug
Logging Functions
The API provides a simple logging feature function that may be enabled for debugging purposes. Available logging levels are given by
adi_common_LogLevel_e as shown in Table 11.
Table 11. Logging Level
Function Name Purpose
ADI_LOGLEVEL_TRACE Log everything in exhaustive detail. Used only for development
ADI_LOGLEVEL_DEBUG Log diagnostic information
ADI_LOGLEVEL_INFO Log state changes in the application
ADI_LOGLEVEL_WARN Log bad, but recoverable events
ADI_LOGLEVEL_ERROR Log events that cannot be recovered from
ADI_LOGLEVEL_FATAL Log events that are likely to be fatal
ADI_LOGLEVEL_NONE Disable all logging
When logging is enabled, the APIs log various messages to the system via the HAL. This feature requires an implementation for the
customer_LogWrite function. To enable logging, set #define ADI_COMPILED_LOGLEVEL to one of the defined log levels other than
ADI_LOGLEVEL_NONE. Any log initialization (e.g., opening files) must be done by the application before calling any APIs, or messages
will not be logged properly. Log levels increase in severity numerically. When a given level is used, messages logged with a log level at least
as severe (greater than or equal to) as the set level will be published. Less severe logging calls will be compiled out of the API. By default,
ADI_COMPILED_LOGLEVEL is set to ADI_LOGLEVEL_WARN, which means that only messages with severities of
ADI_LOGLEVEL_WARN, ADI_LOGLEVEL_ERROR, and ADI_LOGLEVEL_FATAL will be included. Log levels are passed to