Skip to content

Commit

Permalink
Merge branch 'apache:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
sdc-g authored Aug 15, 2024
2 parents 0af2de4 + a409c42 commit 9a7f3a6
Show file tree
Hide file tree
Showing 211 changed files with 5,564 additions and 2,101 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ tools/gdb/__pycache__
/build
.ccls-cache
compile_commands.json
imx9-sdimage.img
imx9-sdimage.img
10 changes: 10 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.24.0")
cmake_policy(SET CMP0135 NEW)
endif()

if(POLICY CMP0169)
# allow to call FetchContent_Populate directly
cmake_policy(SET CMP0169 OLD)
endif()

# Basic CMake configuration ##################################################

set(CMAKE_CXX_EXTENSIONS OFF)
Expand Down Expand Up @@ -812,6 +817,11 @@ if(CONFIG_BUILD_PROTECTED)
$<$<BOOL:${CONFIG_HAVE_CXX}>:supc++>
$<$<NOT:$<BOOL:${APPLE}>>:-Wl,--end-group>)

target_include_directories(
nuttx_user SYSTEM
PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_BINARY_DIR}/include
${CMAKE_BINARY_DIR}/include_arch)

add_custom_command(
OUTPUT User.map
COMMAND ${CMAKE_NM} nuttx_user > User.map
Expand Down
6 changes: 6 additions & 0 deletions Documentation/applications/examples/leds_rust/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=================================
``leds_rust`` Toggle LEDs in Rust
=================================

This is a simple test in Rust of the board LED driver at
``nuttx/drivers/leds/userled_*.c``.
26 changes: 14 additions & 12 deletions Documentation/applications/system/spi/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
``spi`` SPI Tool
================

The I2C tool provides a way to debug SPI related problems. This README file will
The SPI Tool provides a way to debug SPI related problems. This README file will
provide usage information for the SPI tools.

Contents
Expand All @@ -29,10 +29,10 @@ Contents
* ``set``
* ``verf``

- I2C Build Configuration
- SPI Build Configuration

* NuttX Configuration Requirements
* I2C Tool Configuration Options
* SPI Tool Configuration Options

System Requirements
-------------------
Expand Down Expand Up @@ -71,7 +71,7 @@ or::

nsh> spi ?

Here is an example of the help output. I shows the general form of the command
Here is an example of the help output. It shows the general form of the command
line, the various SPI commands supported with their unique command line options,
and a more detailed summary of the command SPI command options::

Expand All @@ -95,8 +95,8 @@ and a more detailed summary of the command SPI command options::
**Notes**:

- An environment variable like $PATH may be used for any argument.
- Arguments are _sticky_. For example, once the SPI address is specified, that
address will be re-used until it is changed.
- Arguments are _sticky_. For example, once the SPI bus is specified, that
bus will be re-used until it is changed.

**Warning**:

Expand All @@ -117,7 +117,7 @@ SPI operation. Those arguments vary from command to command as described below.
However, there is also a core set of common ``OPTIONS`` supported by all commands.
So perhaps a better representation of the general SPI command would be::

i2c <cmd> [OPTIONS] [arguments]
spi <cmd> [OPTIONS] [arguments]

Where ``[OPTIONS]`` represents the common options and and arguments represent the
operation-specific arguments.
Expand Down Expand Up @@ -146,7 +146,7 @@ Environment Variables
variables. Environment variables must be preceded with the special character
``$``. For example, ``PWD`` is the variable that holds the current working directory
and so ``$PWD`` could be used as a command line argument. The use of environment
variables on the I2C tools command is really only useful if you wish to write
variables on the SPI tools command is really only useful if you wish to write
NSH scripts to execute a longer, more complex series of SPI commands.

Common Option Summary
Expand Down Expand Up @@ -187,7 +187,7 @@ Common Option Summary

Various SPI devices support different data widths. This option is untested.

- ``[-f freq]`` I2C frequency. Default: ``4000000`` Current: ``4000000``
- ``[-f freq]`` SPI frequency. Default: ``4000000`` Current: ``4000000``

The ``[-f freq]`` sets the frequency of the SPI device. The default is very
conservative.
Expand All @@ -212,7 +212,9 @@ Exchange data: ``exch [OPTIONS] <Optional TX Data>``
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

This command triggers an SPI transfer, returning the data back from the far end.
As an example (with MOSI looped back to MISO)::

As an example you can exchange (send and receive) 4 bytes (-x 4) on SPI2 (-b 2) using the command below with the ``loopback`` approach.
This approach requires that you connect the MOSI pin directly to the MISO pin (NOTE: SCLK and CS are not directly involved, but you still can see the clock and chip select waveforms if you decide to use an oscilloscope or more properly a logic analyzer to analyze these pins)::

nsh> spi exch -b 2 -x 4 aabbccdd

Expand All @@ -221,7 +223,7 @@ As an example (with MOSI looped back to MISO)::
Note that the ``TX Data`` are always specified in hex, and are always two digits
each, case insensitive.

I2C Build Configuration
SPI Build Configuration
-----------------------

NuttX Configuration Requirements
Expand All @@ -241,7 +243,7 @@ The SPI tools requires the following in your NuttX configuration:
CONFIG_SPI_DRIVER=y

The SPI tool will then use the SPI character driver to access the SPI bus.
These devices will reside at ``/dev/spiN`` where ``N`` is the I2C bus number.
These devices will reside at ``/dev/spiN`` where ``N`` is the SPI bus number.

**Note**: The SPI driver ``ioctl`` interface is defined in
``include/nuttx/spi/spi.h``.
28 changes: 28 additions & 0 deletions Documentation/components/drivers/character/touchscreen.rst
Original file line number Diff line number Diff line change
Expand Up @@ -36,3 +36,31 @@ found in the following locations:
``boards/<arch>/<chip>/<board>/src/``
directory for boards that use an external touchscreen
controller chip.

Application Programming Interface
=================================

The first thing to be done in order to use the touchscreen driver from an
application is to include the correct header filer. It contains the
Application Programming Interface to the driver. To do so, include

.. code-block:: c
#include <nuttx/input/touchscreen.h>
Touchscreen driver is registered as a POSIX character device file into
``/dev`` namespace. It is necessary to open the device to get a file descriptor
for further operations. This can be done with standard POSIX ``open()`` call.

The driver is accessed through ``read``, ``write``, ``poll`` and ``ioctl``
interface, Following ``ioctl`` commands are available:

* :c:macro:`TSIOC_GRAB`

.. c:macro:: TSIOC_GRAB
This command let the current handle has the device grabbed. When a handle grabs
a device it becomes sole recipient for all touchscreen events coming from the
device. An argument is an ``int32_t`` variable to enable or disable the grab.


8 changes: 8 additions & 0 deletions Documentation/components/drivers/special/i2c.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,11 @@ I2C Device Drivers

- **Examples**: ``arch/z80/src/ez80/ez80_i2c.c``,
``arch/z80/src/z8/z8_i2c.c``, etc.

- ``struct i2c_slaveops_s``. Each I2C slave device driver must implement
an instance of ``struct i2c_slaveops_s``. That structure defines a call
table with the following methods:

- **Binding I2C Slave Drivers**. I2C slave drivers are normally directly
accessed by user code, We can read and write to device nodes using posix
interfaces.
2 changes: 1 addition & 1 deletion Documentation/components/paging.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ allocates a physical page and maps it to the virtual memory space that
triggered the page fault exception and then resumes execution from the same
point where the page fault first occurred.

:ref:`knsh32_paging` simulates a device with 4MiB physical memory with 8MiB
:ref:`knsh_paging` simulates a device with 4MiB physical memory with 8MiB
of virtual heap memory allocated for each process. This is possible by
enabling on-demand paging.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -691,3 +691,22 @@ at 13.56 MHz and ISO/IEC 14443 A/MIFARE and NTAG.

.. figure:: mfrc522_image.jpg
:align: center

bmp280
------

Configures the NuttShell (nsh) over USB Serial (check usbserial configuration) and enables BMP280 Digital Pressure Sensor.
BMP280 has an I2C address that can be configure by SDO. Connecting SDO to GND results in slave
address 0x76, connection it to VDD results in slave address 0x77. This can be configured by enabling BMP280_I2C_ADDR_76 or BMP280_I2C_ADDR_77. This configuration uses I2C1 and slave address 0x77.

NSH commands::

NuttShell (NSH) NuttX-12.6.0-RC1
nsh> bmp280
Absolute pressure [hPa] = 911.400024
Temperature [C] = 26.110001
nsh> bmp280
Absolute pressure [hPa] = 932.650024
Temperature [C] = 24.490000
There is a known issue where every time the sensor is initialized, the first measurement is wrong, please check https://github.com/apache/nuttx/issues/12421 for the latest updates on this issue.
Loading

0 comments on commit 9a7f3a6

Please sign in to comment.