Several issues inherting beans

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Several issues inherting beans

Jump to solution
1,817 Views
ozillator
Contributor I

Hey,

I'm experiencing several issues while inheriting beans:

-Depending on application, I want to use one or two quadratur decoders. If I want to use both, must I create two interfaces and two templates, one for each decoder or is there a way to use one interface with two templates? In this case, what is the best way to ex/include the bean according to settings in descendant bean? Encapsulate in boolean group?

-If I create local templates and afterwards an local interface (same location), I'm not able to assign created template to interface. With gloabl template, that doesn't happen...

-How do I specify a name for the inherited bean in order to avoid the Inhr* names given by PE.

-Sometimes I experience that PE doesn't list the inherited method in the component tree? Although I follow same inheritance scheme as with other beans where they show.

 

Sorry to take up your time with such basic questions... As we only got license for CW8.2.3 and the old "Bean Wizard" I feel that I'm hassling here and there with usablity issues that might in the mean time - especially since the transition to CW10.1 - have resolved itself.

 

Thanks again!

Steffen

0 Kudos
1 Solution
1,448 Views
BlackNight
NXP Employee
NXP Employee

Hello,

many good questions, which I had to answer myself too (with some reverse engineering).

 

>>-Depending on application, I want to use one or two quadratur decoders. If I want to use both, must I create two interfaces and two templates, one for each decoder or is there a way to use one interface with two templates? In this case, what is the best way to ex/include the bean according to settings in descendant bean? Encapsulate in boolean group?

 

A boolean group is good just for enable/disable something. Simple, but for multiple things that might not be a good choice.

The solutions is to use a 'list of components': I have attached you an example I had created to implement an LED matrix (for a larger project): the matrix consists of a variable row of lines and columns. The rows are implemented with a variable number of 'LED' components, and the columns are 2 times a 8bit LEDbyte (see attached screenshots).

 

Now how to create this in the component is unfortunately a lot of 'magic sauce' and some try and error on my side. One thing is that you have to set up the properties correctly (see as well the screenshot I have attached).

Notice the 'ItemsSymb' with name 'Row': this is actually what you can use in your driver:

void %'ModuleName'%.%On(void)
{
%:maxRow=%RowSymbolNumItems
%:maxRow-=1
%:maxCol=%ColumnSymbolNumItems
%:maxCol-=1
  /* revert back to previous state */
  %for i from [0..%maxRow]
  inherited.Row%i.On();  /* anode row %i status */
  %endfor
  %for i from [0..%maxCol]
  inherited.Column%i.PutVal(0x00); /* cathode column %i status */
  %endfor
}

 

Notice as well %RowSymbolNumItems: this gives you the number of elements in the list.

When you generate code for it, you will get something like this:

void LEDM1_On(void)
{
  /* revert back to previous state */
  Inhr1_On();  /* anode row 0 status */
  Inhr2_On();  /* anode row 1 status */
  Inhr3_On();  /* anode row 2 status */
  Inhr4_On();  /* anode row 3 status */
  Inhr5_On();  /* anode row 4 status */
  Inhr6_PutVal(0x00); /* cathode column 0 status */
  Inhr7_PutVal(0x00); /* cathode column 1 status */
}

 

Best thing is if you inspect my component (learning from that example).

 

 

>>-If I create local templates and afterwards an local interface (same location), I'm not able to assign created template to interface. With gloabl template, that doesn't happen...

 

Not sure what you mean here?

 

>>-How do I specify a name for the inherited bean in order to avoid the Inhr* names given by PE.

 

Good one :smileyhappy:. That was one of the first things I did for most of my components. Go to your 'Beans' folder and open the *.bean file in a text editor. Then search for

<InhrBeanBaseName>......</InhrBeanBaseName>

And change the name there.

 

>>-Sometimes I experience that PE doesn't list the inherited method in the component tree? Although I follow same inheritance scheme as with other beans where they show.

 

Yes, I was wondering too, and I believe this is the setting in the .bean file which affects this:

<ShowInheritedMethodsEventsInPrjTree>true</ShowInheritedMethodsEventsInPrjTree>

Check if this is set to false in your case.

 

>>Sorry to take up your time with such basic questions... As we only got license for CW8.2.3 and the old "Bean Wizard" I feel that I'm hassling here and there with usablity issues that might in the mean time - especially since the transition to CW10.1 - have resolved itself.

 

No need to feel sorry about this, and these are in fact some advanced questions anyway. I know that the Processor Expert team is monitoring that list, and they know that many things especially in the documentation need to be improved. MCU10.2 comes with a new "Bean Wizard" (well, it is named "Component Wizard") within eclipse. But if you are used to the 'classic' Bean Wizard, it is still there under

<installation>\MCU\ProcessorExpert\BeanWizard.exe

 

As the forum only allows me to attach 3 files, I'll post the example in a follow-up.

 

Hope that helps,

BK

View solution in original post

0 Kudos
8 Replies
1,449 Views
BlackNight
NXP Employee
NXP Employee

Hello,

many good questions, which I had to answer myself too (with some reverse engineering).

 

>>-Depending on application, I want to use one or two quadratur decoders. If I want to use both, must I create two interfaces and two templates, one for each decoder or is there a way to use one interface with two templates? In this case, what is the best way to ex/include the bean according to settings in descendant bean? Encapsulate in boolean group?

 

A boolean group is good just for enable/disable something. Simple, but for multiple things that might not be a good choice.

The solutions is to use a 'list of components': I have attached you an example I had created to implement an LED matrix (for a larger project): the matrix consists of a variable row of lines and columns. The rows are implemented with a variable number of 'LED' components, and the columns are 2 times a 8bit LEDbyte (see attached screenshots).

 

Now how to create this in the component is unfortunately a lot of 'magic sauce' and some try and error on my side. One thing is that you have to set up the properties correctly (see as well the screenshot I have attached).

Notice the 'ItemsSymb' with name 'Row': this is actually what you can use in your driver:

void %'ModuleName'%.%On(void)
{
%:maxRow=%RowSymbolNumItems
%:maxRow-=1
%:maxCol=%ColumnSymbolNumItems
%:maxCol-=1
  /* revert back to previous state */
  %for i from [0..%maxRow]
  inherited.Row%i.On();  /* anode row %i status */
  %endfor
  %for i from [0..%maxCol]
  inherited.Column%i.PutVal(0x00); /* cathode column %i status */
  %endfor
}

 

Notice as well %RowSymbolNumItems: this gives you the number of elements in the list.

When you generate code for it, you will get something like this:

void LEDM1_On(void)
{
  /* revert back to previous state */
  Inhr1_On();  /* anode row 0 status */
  Inhr2_On();  /* anode row 1 status */
  Inhr3_On();  /* anode row 2 status */
  Inhr4_On();  /* anode row 3 status */
  Inhr5_On();  /* anode row 4 status */
  Inhr6_PutVal(0x00); /* cathode column 0 status */
  Inhr7_PutVal(0x00); /* cathode column 1 status */
}

 

Best thing is if you inspect my component (learning from that example).

 

 

>>-If I create local templates and afterwards an local interface (same location), I'm not able to assign created template to interface. With gloabl template, that doesn't happen...

 

Not sure what you mean here?

 

>>-How do I specify a name for the inherited bean in order to avoid the Inhr* names given by PE.

 

Good one :smileyhappy:. That was one of the first things I did for most of my components. Go to your 'Beans' folder and open the *.bean file in a text editor. Then search for

<InhrBeanBaseName>......</InhrBeanBaseName>

And change the name there.

 

>>-Sometimes I experience that PE doesn't list the inherited method in the component tree? Although I follow same inheritance scheme as with other beans where they show.

 

Yes, I was wondering too, and I believe this is the setting in the .bean file which affects this:

<ShowInheritedMethodsEventsInPrjTree>true</ShowInheritedMethodsEventsInPrjTree>

Check if this is set to false in your case.

 

>>Sorry to take up your time with such basic questions... As we only got license for CW8.2.3 and the old "Bean Wizard" I feel that I'm hassling here and there with usablity issues that might in the mean time - especially since the transition to CW10.1 - have resolved itself.

 

No need to feel sorry about this, and these are in fact some advanced questions anyway. I know that the Processor Expert team is monitoring that list, and they know that many things especially in the documentation need to be improved. MCU10.2 comes with a new "Bean Wizard" (well, it is named "Component Wizard") within eclipse. But if you are used to the 'classic' Bean Wizard, it is still there under

<installation>\MCU\ProcessorExpert\BeanWizard.exe

 

As the forum only allows me to attach 3 files, I'll post the example in a follow-up.

 

Hope that helps,

BK

0 Kudos
1,448 Views
BlackNight
NXP Employee
NXP Employee

... and here as promised the example project with the used components.

The project is an MCU10.2 one, and the components too.

But I believe you should be able to load these components into your classic CodeWarrior as well.

 

BK

0 Kudos
1,448 Views
ozillator
Contributor I

Hey BK,

thanks a million for that input! The *.bean file for example is completely new for me! I will take a look at it as soon as I get back to work tomorrow!

One question has already occured to me though. If you use a list of items with Items Type being Inherited Interface, you use the same interface for each LED. Do you make the specific PIN assignment by assigning different templates? In the example of the decoder, one item would have to use decoder0 and the other decoder1.

I guess some more questions to come by tomorrow...

Once again, thanks a lot!

Steffen

0 Kudos
1,448 Views
BlackNight
NXP Employee
NXP Employee

Hi Steffen,

you are welcome :smileyhappy: !

 

Yes, for the list of items, they all have the same interface. But the properites (e.g. pin assignment) can be different.

So not sure about your decoders, but I assume they will have the same interface too, but each decoder can point to a different hardware pin/etc).

If the interface is different, then you have to use another solution: I have this scenario e.g. using a hardware or a software SPI: here the interface is not exactly the same, so I'm using a 'boolean group' to either use the hardware or software interface.

 

About decoder: I have not posted this, but I have created a quadrature decoder as component too, maybe this is useful for you? I might need to do some cleanup first.

 

Best regards,

BK

0 Kudos
1,448 Views
ozillator
Contributor I

Hi BK,

the QuadDecoder itself is not the issue. Trying to follow you scheme, I once again stumbled over some points...

I created a list of items ( see attached picture). So far so good. With the ItemsTypeSpecName I entered the name of an existing interface, correct? It wasn't one of the options to choose from. Now come the questions:

-according to underlying CPU the list should contain one or two items. so how do I set the QDListNumItems property in the CHG file?? %set QDListNumItems Value %{other property} fails

-How do I assign the template or configuration to the interfaces. I tried it wit

 

%if %QDListNumItems >= 1
     %set inherited.QD1 Value QD_Kl
%endif

%if %QDListNumItems == 2
     %set inherited.QD2 Value QD2_TUKL
%endif

 

Without success...

-And another very basic question: If I make changes in the property of a bean in bean wizard, how do I get the CW IDE to reload the beans without restarting it?

 

Your help to get me started is more than appreciated! Thanks!

Steffen

0 Kudos
1,448 Views
BlackNight
NXP Employee
NXP Employee

Hi Steffen,

you have to have a template and an interface for your list (if they do not already exist) .

Inside your 'Beans' folder they have the extension .int (for the interface) and .dev for the template (see as well my LEDMatrix example component).

 

If you do not have the interface and template, you need to create them.

For this, open your quadrature component, then use File > Convert to > Template (or interface). Change the settings as needed, then do File > Save. This will ask you where to store the interface/template. Select 'local template' and browse in the dialog on the right hand side to your component  (Hardware) and give it a name (this will end up into what you have in your screenshot: Hardware\QuadDecoder).

 

>>-And another very basic question: If I make changes in the property of a bean in bean wizard, how do I get the CW IDE to reload the beans without restarting it?

 

Two way:

- do Project > Close and then Project > Open

  this should re-load your components

- the other way is: in the component library view there is a context menu 'Refresh': use this one and it will reload your components and settings.

 

If you just made changes in the code to be generated (in the driver), this (in my view) does not require a re-load.

 

Hope that helps,

BK

1,448 Views
ozillator
Contributor I

Hi BK,

I got it! Thanks a lot! A very elegant solution and works like a charm! Also your hint concerning the open and close project, saves a lot of time... Although I couldn't find the component or bean library view in the old IDE.

One more question that came up along the way: now, that the inheritance is realized through the list, how to I prevent the Inhr* name? Looked through the .bean, dev and int files - without success.

Anyway, once again thanks a lot!

Steffen

0 Kudos
1,448 Views
BlackNight
NXP Employee
NXP Employee

Hi Steffen,

The 'refresh' thing is something in MCU10.1 and beyond, and not in classic. So you have to use the 'reopen project' way there. You only need to restart the IDE in classic if you have added/created a new component. Otherwise the close/open thing should work there.

As for the Inhr for the list of interfaces: I have not found a solution for myself on this one, but I'll ask the engineering team if there is something to configure this.

 

BK

0 Kudos