3 years, 3 months ago.

BusOut.h

/media/uploads/ljiask/butout.jpg

HI all,

According to the note, can I ask anyone of you that the p5-p30 are not connected in BusOut.h? right?

For example, If I would like to assign 10 pins, can I write BusOut (PinName p0, ......, PinName p10); or BusOut (PinName p0, PinName p10, ...., PinName p11 = NC, PinName p15 = NC);

Regards, Daniel L

1 Answer

3 years, 3 months ago.

Hi Daniel,

Hopefully i can give you some help.

For the BusOut declaration you need only to specify which outputs you will be actually using all others will just default to 0/NC so there is no need to declare them, if declare them they will output 1. So your first definition is correct not the second.

p5-p30 are NC until you declare. That is just the range of pins from 5 through 30.

I hope that clears things up, if you need anything else please let me know :).

Regards,

Andrea, team mbed.

Accepted Answer

Hi Andrew,

Thanks again for your reply. For the BusOut declaration, I saw a previous example (BusOut), an LED light bar example, on this forum: BusOut Bar(p20, p19, p18, p17, p16, p15, p14, p13, p12, p11); It looks like the format of BusOut declaration in the example is different from in the BusOut.h file. BusOut (PinName p0, .....) Could you please let me know which format is correct? Thank you.

posted by Daniel Liu 15 Aug 2016

Hi Daniel,

BusOut Bar(p20, p19, p18, p17, p16, p15, p14, p13, p12, p11) is the correct declaration when called inside your main program. You need to obviously set p20,p19.... to whatever the pin definitions are for your board.

The prefix "PinName" is used in the header file is part of the class of BusOut, no need to worry about that :).

As such as shown here: http://www.tutorialspoint.com/cplusplus/cpp_classes_objects.htm

Regards,

Andrea

posted by Andrea Corrado 15 Aug 2016