This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Code API Library for TM4C, Where to Start and OOP support

Other Parts Discussed in Thread: LM386

I have built my codes for TM4C123 with DRM (Direct Register Macro) style until now, and according to feedbacks  it is not a much preffered and safe way. Furthermore I realised that as the projects get bigger, the code gets harder to debug. So I was suggested to use and learn "code API library". (thanks to Amit and cb1)

The Question Is:

1) Does the code API library enable object oriented programming? If yes, could you please show a small code sniplet?

2)  

Is this a good place to start or do you know a better tutorial?

Edited: Second question was missing

  • Here a very quick, "run & gun" (sorta) answer.
    Could you not consider and/or treat the various API functions as individual objects - and have your OOP code design call & manipulate them - maintaining much/most of their essence?
    I offer this simply as a beginning - I believe this line of thinking may move you along....
  • Dear cb, nice to see you.

    I only have OOP experience in Python, not in C (Just started studying). Also I never tried the API before, just worked with registers. Anyway it is good to learn the possiblity of writing OOP codes for TM4C. A very short sniplet could be great to see the big picture, but not very crucial.

    By the way, what do you think about where to start?
  • Nice to note your return - as well.

    My belief is that C++ dominates w/in the OOP arena.    Multiple books - some even accessible on-line - should prove most helpful & instructive.   Dawns that your search may be greatly narrowed if you seek, "C++ for Embedded Systems."

    More MCU specific - perhaps the C2000 and/or motor-control forum here - show some examples (or at least the PC side of things) under C++.   Should that fail - the earlier book/info search combining C++ and Embedded Systems should succeed...

  • http://www.springer.com/us/book/9783642346873 looks like quite a nice first step with code sniplets. With some API study, all will be fine I hope. Thanks a lot.

  • emrah erden said:

    http://www.springer.com/us/book/9783642346873 looks like quite a nice first step with code sniplets. With some API study, all will be fine I hope. Thanks a lot.

     Happy see you appreciated my old post on dual can before leave forum.

     I don't know this book, title promise better but if you need learn C++ try the old bible I used when I was joung:

    www.stroustrup.com/bs_faq.html

     Have e good learning, I appreciate <EDX courses, I found sometimes not balanced in knowledge, I checked EE40LX for my pupils but somewhere I got difficult to understand what they asked and level is IMHO sometimes discouraging early student due to deep math knowledge required of differential equation theory is not so necessary on a similar course. Also Data sheet based question where of not simple solution. Clearly I tryed problem and I never seen more than 3 lesson to evaluate. I finished course but I never got graduation I don't need due to my position ;)

      In general I see them as a good teaching platform and good student motivated as I perceived about you can get a better graduation. I think do that for me only can say course is worst never recognizing ther limit.
     My best wishes, we need engineer like you promise to grow up not Arduino biased <<do it for me and urgently>><<provide solution><etc>.

     Clearly that course exclude "Arduino teacher" I encountered here saying it can do everithing with AVR but seems not understanding basic C.

  • I have a slightly curmudgeonly take on this.

    While C++ is indeed the OOP that is most encountered in embedded there is a lot of value in learning to properly use C (Not just the C subset of C++, but C).

    And whether you use C or C++ I would strongly recommend getting and using PC-Lint (with strong typing and MISRA support). Together, provided you don't take the shortcuts TI did in the API*, you get a lot stronger protection against introducing bugs.

    Robert

    * - Primarily, and the biggest design sin in the TIVA API, typing everything as uint32_t and thus throwing away many chances to catch and prevent errors.
  • Robert Adsett said:
    a slightly curmudgeonly take...

    My "oxymoron" needle leaped upscale reading that.     And - if "you" qualify as "curmudgeon" - there's little hope for the rest here...

    Strongly "Like" & agree w/your guidance - especially the inclusion of "C" and PC-Lint.

    I believe that the "uint32_t universal" you note was not so prominent in past, "Stellaris API."    Change proves not always - over all things - for the better...

  • Hi Roberto

    That was an interesting post, and thank you for the nice wishes.

    I'm agree with you in EE40LX, it needs some calculus; furthermore they don't give much detail about the theory. Course is a bit incomplete IMO. But it helped me to understand (at least basically) some circuit elements such as op amp, voltage regulator, and transistors etc. At least now I can modify and play with the circuits in my need, in a safer way. If anything I can help, share about the course nickname is SoajanII there. Feel free to message :)

    By the way a few years ago I had a big failure with procedural programming about plasma physics. A numerical analysis code took me months to debug. So now I'm trying to stay in the safe side in my slowly developing electronics career :)

    Thank you, and see you around
    Emrah
  • emrah erden said:
    If anything I can help, share about the course nickname is SoajanII there. Feel free to message :)

     If you wish point about where they used LM386 to boost audio speaker cannot be connected to output pin, this amplifier is for single ended power supply so speaker get subject to half the power voltage and broke draining battery too. Correct connection require an electrolytic in series and also a decoupling cap plus a filter on input too.

     About data sheet question, I don't remember but it took about 10 minutes to figure what they where asking for, I read data sheet all my life and  answer was not obvious nor really valid.

     Anyway, it is difficult I go again on that course, on september I need try start again convince pupils to learn basic math and electric theory and hope I can retire soonest due I feel tired of actual school and society too.

     Have a good time over your career and never give up.

  • "PC-Lint (with strong typing and MISRA support" was added into my notes against bugs. Thank you