Tinyos naming convention

Source: Internet
Author: User
Tags sendmsg uppercase letter

 

Identifier type Naming rules Example
Interfaces Interfaces should be named by verb or noun. the first letters of the connected words are generally capitalized. ADC

Range

SendMsg

BombillaLocks

Components

Components should be named by a noun. the first letters of the connected words are generally capitalized ..

Here are two special examples: one is to end with an uppercase letter CT and the other is to end with an uppercase letter M. This is mainly used to distinguish the interface in the accessory from the configuration in the module.

C stands:Component. It is mainly used to distinguish between interfaces (such as timer) and interfaces (such as timerc) provided by component ).

Uppercase letter MModule. This naming convention is used when a single logical component has both a configuration and a module. an example of this is the timer in TOS/system. the timerc component, providing the timer interface, is a configuration that links its implementation (timerm) to clock and led providers. otherwise, any user of timerc wowould have to explicitly wire its subcomponents.

Counter

IntToRfm

IntToRfmM

TimerC

TimerM

UARTM

Files Filenames shocould be the name of the type contained within; All NESC files have ". nc" as a suffix. Counter.nc

IntToRfm.nc

IntToRfmM.nc

TimerC.nc

TimerM.nc

UARTM.nc

Applications Applications shoshould be the name of the top level component, with Trailing CS removed. if an application tests a piece of tinyos code, its first word shocould be "test. "If an application tests tinyos hardware, its first word shocould be" verify. "If an application was part of a demonstration, its first word shocould be" demo." CntToRfm

Chirp

DemoTracking

TestTinyAlloc

VerifyMicaHW

TestTimer

Commands, events and tasks Commands, events and tasks shoshould be verbs, in mixed case with the first letter of each internal word capitalized, with the first letter lowercase. if a command/event pair form a split-phased operation, the name of the event shocould be the command suffixed with "done" or "complete ". commands that directly access hardware shocould be prefixed with "Tosh _" and follow the constant naming conventions (described below ). sendMsg

output

outputComplete

put

putDone

fired

TOSH_SET_RED_LED_PIN();

Variables Variables shoshould be nouns, in mixed case with the first letter of each internal word capitalized, with the first letter lowercase. They shoshould be descriptive, although temporary and loop variables (e.g. The ubiquitousI) May be used. bool state

uint16_t lastCount

uint16_t counter

result_t writeResult

uint8_t noHeader

Constants Constants shoshould be in all caps, with underscores delimiting internal words. TOS_UART_ADDR

TOS_BCAST_ADDR

TOS_LOCAL_GROUP

TOSH_S1PS

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.