Thread: How can I implement this bool function?

  1. #1
    Registered User
    Join Date
    Nov 2017
    Posts
    4

    How can I implement this bool function?

    bool uart_getchar_available (char * c) - this routine returns a Boolean value determining if a buffer character could be read, in which case the value is found in parameter c. If there is no character in the buffer, the routine returns immediately and the result of the call is false.

    The buffer gets data from UART reception.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    Find out which UART you're using.
    Universal asynchronous receiver-transmitter - Wikipedia

    When you know that, locate it's data sheet (google "nameofmyuart data sheet").
    Eg. http://www.ti.com/lit/ds/symlink/pc16550d.pdf
    Locate the "register map" or programmer reference information.
    Your're basically looking for
    - the register that tells you characters are available
    - the register where characters will be read from.

    Find out how your UART is wired to your processor. Typically, your UART will appear at some hard-wired memory address.

    Do you have an operating system on your processor?

    Which compiler are you using?
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Nov 2017
    Posts
    4
    Quote Originally Posted by Salem View Post
    Find out which UART you're using.
    Universal asynchronous receiver-transmitter - Wikipedia

    When you know that, locate it's data sheet (google "nameofmyuart data sheet").
    Eg. http://www.ti.com/lit/ds/symlink/pc16550d.pdf
    Locate the "register map" or programmer reference information.
    Your're basically looking for
    - the register that tells you characters are available
    - the register where characters will be read from.

    Find out how your UART is wired to your processor. Typically, your UART will appear at some hard-wired memory address.

    Do you have an operating system on your processor?

    Which compiler are you using?
    I'm using STM32F767 Nucleo. Yes, I have FreeRTOS in my CPU. I'm using SW4STM32 as my IDE. By the way, that bool function needs to be a task with normal priority in my operating system (FreeRTOS).

    I am using STM32 Cube Mx, which uses HAL Library.



  4. #4
    Registered User
    Join Date
    Nov 2017
    Posts
    4
    I'm using STM32F767 Nucleo and its operating system which is FreeRTOS. The bool function that I need to create needs to be used by a task with normal priority. The IDE that I'm using is SW4STM32 AC6 Eclipse.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    STM32F7x7 - STMicroelectronics
    An application note may contain a ready example.
    The reference manual definitely tells you all you need to know, assuming you actually know how to program a UART once you've found it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. control reaches end of non void function in bool function
    By Giwrgows x in forum C Programming
    Replies: 26
    Last Post: 12-19-2015, 02:58 PM
  2. Help with Bool function
    By jaimeribg in forum C++ Programming
    Replies: 6
    Last Post: 03-12-2014, 01:38 PM
  3. how to implement a function
    By BMWE in forum C Programming
    Replies: 8
    Last Post: 03-25-2012, 02:25 PM
  4. Damned bool function
    By Welshy in forum C++ Programming
    Replies: 7
    Last Post: 04-27-2005, 01:28 AM
  5. bool function
    By MB1 in forum C++ Programming
    Replies: 10
    Last Post: 04-22-2005, 05:31 PM

Tags for this Thread