DatasheetQ Logo
Electronic component search and free download site. Transistors,MosFET ,Diode,Integrated circuits

AN664 Ver la hoja de datos (PDF) - Silicon Laboratories

Número de pieza
componentes Descripción
Fabricante
AN664 Datasheet PDF : 18 Pages
First Prev 11 12 13 14 15 16 17 18
AN664
2.2. Type Header (Type.h) and Code (Type.c) Files
The *_Type.h file creates the interface definition of the module. This file includes function prototypes and macro
definitions for each of the HAL routines. Including this file in a source file means that file now has access to all of
the HAL routines for a module.
The *_Type.c file is the implementation of the module HAL functions. This file includes all of the function
declarations for the prototypes in the *_Type.h file.
Each of the routines starts with the SI32_ shield and the module name. The descriptive name of the function then
follows. For example, the routine to set the IPRDYI bit in the USBEP module is:
void _SI32_USBEP_A_set_in_packet_ready(SI32_USBEP_A_Type * basePointer);
2.2.1. Function Naming
The function names for the HAL follow a set of guidelines to make them consistent and predictable across
modules:
Names are in lower case, including acronyms: read_nss_pin.
Do not use abbreviations, with one exception being tx for transmit and rx for receive.
Separate words using underscores.
Use enable_module and disable_module for bits that control the whole module.
Use reset_module for bits that reset the whole module.
Use select for functions that are selecting an item that is mutually exclusive from other options. This is
common with settings that involve multiple bitfields.
Use enter_mode_description_mode and exit_mode_description_mode for non-mutually exclusive
items, and all enter_mode functions must have an exit_mode counterpart. For example, to enter the IrDA
mode in the USART module: enter_rx_irda_mode.
Use set, get, and clear for bits and registers. For example: set_parity_even, get_status,
clear_carry_flag.
Use numerical value for numbers. For example: set_fifo_threshold_1, set_fifo_threshold_2.
Use read and write when manipulating data or pins. For example: read_fifo, write_fifo, read_nss_pin.
Use start and stop for things that run, like oscillators and timers.
Use enable, disable, “is enabled”, “is pending”, and clear for interrupts. For example:
enable_overrun_interrupt, disable_overrun_interrupt, is_overrun_interrupt_pending, and
clear_overrun_interrupt.
Use has for events that have flags but do not cause interrupts. For example:
has_buffer_overflow_occurred.
For debug bits, use the enable_stall_in_debug_mode and disable_stall_in_debug_mode routine
names.
Functions referring to the peripheral should always use the module keyword.
Rev. 0.2
11

Share Link: 

datasheetq.com  [ Privacy Policy ]Request Datasheet ] [ Contact Us ]