Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions Documentation/applications/audioutils/morsey/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
=========================
``morsey`` Morsey library
=========================

``morsey`` is a simple library for parsing ASCII text into Morse code marks, and
playing Morse using a user-defined interface.

To use the ``morsey`` library, include it like so:

.. code:: c

#include <audioutils/morsey.h>

See the `Morsey repository <https://github.com/linguini1/morsey>`_ for
documentation on how to use the library. Note that there is also an included
``example.c`` file where Morse code is printed to the console.
44 changes: 44 additions & 0 deletions Documentation/applications/examples/txmorse/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
==================================
``txmorse`` Morse code transmitter
==================================

This application is an example which transmits Morse code messages using the
:doc:`Morsey library </applications/audioutils/morsey/index>`.

You can run ``txmorse -h`` to display help information.

Supported Devices
-----------------

.. note::

This application does not currently support all possible Morse code
transmission devices available on NuttX NuttX. Currently, only GPIO devices
are supported.

In order to add support for a new output device, you must submit a patch
modifying the program to define the interface for the Morsey library for each
type of output device. Take a look at the current application code to see
examples for console devices and GPIO devices.

The ``txfunc`` function is used by the ``morsey`` library to transmit a mark.
You can implement the appropriate driver operations (i.e. ``ioctl`` calls) in
this function. See the GPIO implementation for an example.

The ``cleanupfunc`` function is used to cleanup the implementation. For most
NuttX devices, this involves closing the file descriptor.

In the ``main`` function, the path to the output device is used to identify the
implementation to use. For instance, GPIO devices are under ``/dev/gpio<n>``, so
device paths containing "gpio" cause the GPIO driver to be selected. If no
player can be associated with the device, the default player is selected which
just prints the Morse code to the console.

Usage
-----

The following will output "SOS" over a GPIO device (i.e. buzzer or LED):

.. code:: console

nsh> txmorse "sos" /dev/gpio0
Comment thread
xiaoxiang781216 marked this conversation as resolved.
13 changes: 13 additions & 0 deletions Documentation/platforms/sim/sim/boards/sim/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1459,6 +1459,19 @@ An example usage:
hello
nsh>
txmorse
-------

This is a configuration with :doc:`the Morse transmitter example
</applications/examples/txmorse/index>` using the :doc:`Morsey library
</applications/audioutils/morsey/index>`.

.. code:: console
nsh> txmorse "sos sos sos"
... --- .../... --- .../... --- ...
nsh>
udgram
------

Expand Down
79 changes: 79 additions & 0 deletions boards/sim/sim/sim/configs/txmorse/defconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
#
# This file is autogenerated: PLEASE DO NOT EDIT IT.
#
# You can use "make menuconfig" to make any modifications to the installed .config file.
# You can then do "make savedefconfig" to generate a new defconfig file that includes your
# modifications.
#
# CONFIG_NSH_CMDOPT_HEXDUMP is not set
CONFIG_ARCH="sim"
CONFIG_ARCH_BOARD="sim"
CONFIG_ARCH_BOARD_SIM=y
CONFIG_ARCH_CHIP="sim"
CONFIG_ARCH_SIM=y
CONFIG_AUDIOUTILS_MORSEY=y
CONFIG_BOARDCTL_APP_SYMTAB=y
CONFIG_BOARDCTL_POWEROFF=y
CONFIG_BOARD_LOOPSPERMSEC=0
CONFIG_BOOT_RUNFROMEXTSRAM=y
CONFIG_BUILTIN=y
CONFIG_COVERAGE_ALL=y
CONFIG_COVERAGE_TOOLCHAIN=y
CONFIG_DEBUG_ASSERTIONS=y
CONFIG_DEBUG_ASSERTIONS_EXPRESSION=y
CONFIG_DEBUG_FEATURES=y
CONFIG_DEBUG_SYMBOLS=y
CONFIG_DEV_GPIO=y
CONFIG_DEV_LOOP=y
CONFIG_ETC_FATDEVNO=2
CONFIG_ETC_ROMFS=y
CONFIG_ETC_ROMFSDEVNO=1
CONFIG_EXAMPLES_GPIO=y
CONFIG_EXAMPLES_HELLO=y
CONFIG_EXAMPLES_TXMORSE=y
CONFIG_FAT_LCNAMES=y
CONFIG_FAT_LFN=y
CONFIG_FS_BINFS=y
CONFIG_FS_FAT=y
CONFIG_FS_HOSTFS=y
CONFIG_FS_PROCFS=y
CONFIG_FS_RAMMAP=y
CONFIG_FS_ROMFS=y
CONFIG_GPIO_LOWER_HALF=y
CONFIG_HAVE_CXXINITIALIZE=y
CONFIG_IDLETHREAD_STACKSIZE=4096
CONFIG_INIT_ENTRYPOINT="nsh_main"
CONFIG_IOEXPANDER=y
CONFIG_IOEXPANDER_DUMMY=y
CONFIG_LIBC_ENVPATH=y
CONFIG_LIBC_EXECFUNCS=y
CONFIG_LIBC_LOCALE=y
CONFIG_LIBC_LOCALE_CATALOG=y
CONFIG_LIBC_LOCALE_GETTEXT=y
CONFIG_LIBC_MAX_EXITFUNS=1
CONFIG_LIBC_NUMBERED_ARGS=y
CONFIG_NDEBUG=y
CONFIG_NSH_BUILTIN_APPS=y
CONFIG_NSH_FILE_APPS=y
CONFIG_NSH_READLINE=y
CONFIG_PATH_INITIAL="/bin"
CONFIG_PIPES=y
CONFIG_PSEUDOFS_ATTRIBUTES=y
CONFIG_PSEUDOFS_FILE=y
CONFIG_PSEUDOFS_SOFTLINKS=y
CONFIG_READLINE_TABCOMPLETION=y
CONFIG_RTC=y
CONFIG_RTC_ARCH=y
CONFIG_RTC_DRIVER=y
CONFIG_SCHED_BACKTRACE=y
CONFIG_SCHED_EVENTS=y
CONFIG_SCHED_HAVE_PARENT=y
CONFIG_SCHED_WAITPID=y
CONFIG_SIM_HOSTFS=y
CONFIG_SIM_WALLTIME_SIGNAL=y
CONFIG_START_MONTH=6
CONFIG_START_YEAR=2008
CONFIG_SYSTEM_DUMPSTACK=y
CONFIG_SYSTEM_GCOV=y
CONFIG_SYSTEM_NSH=y
CONFIG_TESTING_OSTEST=y
Loading