no-OS
Loading...
Searching...
No Matches
basic_example.c File Reference

Hello World example for no-OS. More...

#include <inttypes.h>
#include "parameters.h"
#include "no_os_uart.h"
#include "no_os_gpio.h"
#include "no_os_delay.h"
#include "no_os_error.h"
#include "no_os_print_log.h"
#include "basic_example.h"
Include dependency graph for basic_example.c:

Macros

#define POLL_PERIOD_MS   100
 
#define POLLS_PER_MESSAGE   (1000 / POLL_PERIOD_MS)
 

Functions

int basic_example_main (void)
 Hello World application entry point.
 

Detailed Description

Hello World example for no-OS.

    This project is a minimal starting point for learning how to build
    and run a bare-metal no-OS application.  It demonstrates:

      1. Initialising a UART peripheral using the no-OS HAL
      2. Printing messages with the no-OS logging macros
      3. Reading from the UART without blocking the main loop
      4. Driving a GPIO to blink an LED, on the boards that have one
      5. Using the no-OS delay API
      6. Proper error handling and resource cleanup

    See the README.rst of the project for the build instructions.

    EXPECTED OUTPUT (115200 8N1 on the USB-UART port)
    --------------------------------------------------
      *** no-OS Hello World ***
      Hello World #1
      Hello World #2
      ...
Author
Analog Devices, Inc.

Copyright 2026(c) Analog Devices, Inc.

SPDX-License-Identifier: BSD-3-Clause

Macro Definition Documentation

◆ POLL_PERIOD_MS

#define POLL_PERIOD_MS   100

◆ POLLS_PER_MESSAGE

#define POLLS_PER_MESSAGE   (1000 / POLL_PERIOD_MS)

Function Documentation

◆ basic_example_main()

int basic_example_main ( void )

Hello World application entry point.

basic example main execution.

Initialises the UART peripheral, prints a banner, then loops forever printing a counter message once per second. Any character received on the UART is echoed back. On the boards that define LED_GPIO_PIN, an LED is toggled with every message.

Returns
0 on success, negative error code on failure.