Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support strf/s2lp #6

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
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
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,3 +40,6 @@ endif()

# STMEMSC - Hardware Abstraction Layer for ST sensor
add_subdirectory_ifdef(CONFIG_HAS_STMEMSC sensor/stmemsc)

# STRF - S2LP
add_subdirectory_ifdef(CONFIG_IEEE802154_S2LP strf/s2lp)
3 changes: 3 additions & 0 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,7 @@ Available libs:
* sensor/vl53l0x:
allows to drive the vl53l0x sensor
full information can be found here : http://www.st.com/en/embedded-software/stsw-img005.html
* strf/subg1:
provides support for the s2lp radio transceiver.
full information can be found here : https://www.st.com/en/embedded-software/x-cube-subg1.html
*...
48 changes: 48 additions & 0 deletions strf/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
STM32CubeSUBG1
##############

Origin:
ST Microelectronics
https://www.st.com/en/embedded-software/x-cube-subg1.html

Status:
version 3.2.0

Purpose:
ST Microelectronics official software package for SUBG1 radio series.

Description:
This package is an extract of the official STM32CubeSUBG1 expansion package
written by ST Microelectronics. It contains the software library for the
s2-lp 802.15.4 radio.

Dependencies:
None.

URL:
https://www.st.com/en/embedded-software/x-cube-subg1.html

commit:
version 3.2.0

Maintained-by:
External

License:
BSD-3-Clause

License Link:
https://opensource.org/licenses/BSD-3-Clause

Patch List:

*Removed unneeded S2LP_Util.h include from s2lp MCU_Interface.h file and Config_RangeExt
calls from s2lp S2LPCmdStrobeRx/S2LPCmdStrobeTx of S2LP_Commands.h.

*Fixed warnings for parentheses around arithmetic operation.
Impacted files:
s2lp/S2LP_Library/Src/S2LP_PacketHandler.c

*Fixed warnings for dereferencing type-punned pointer
Impacted files:
s2lp/S2LP_Library/Src/S2LP_Gpio.c
25 changes: 25 additions & 0 deletions strf/s2lp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright (c) 2021 Nikos Oikonomou <[email protected]>
#
# SPDX-License-Identifier: Apache-2.0

zephyr_include_directories(
S2LP_Library/Inc
)

zephyr_sources(
S2LP_Library/Src/S2LP_Commands.c
S2LP_Library/Src/S2LP_Csma.c
S2LP_Library/Src/S2LP_Fifo.c
S2LP_Library/Src/S2LP_General.c
S2LP_Library/Src/S2LP_Gpio.c
S2LP_Library/Src/S2LP_PacketHandler.c
S2LP_Library/Src/S2LP_PktBasic.c
S2LP_Library/Src/S2LP_PktStack.c
S2LP_Library/Src/S2LP_PktWMbus.c
S2LP_Library/Src/S2LP_Qi.c
S2LP_Library/Src/S2LP_Radio.c
S2LP_Library/Src/S2LP_Timer_ex.c
S2LP_Library/Src/S2LP_Timer.c
S2LP_Library/Src/S2LP_Types.c
)

166 changes: 166 additions & 0 deletions strf/s2lp/S2LP_Library/Inc/MCU_Interface.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,166 @@
/**
* @file MCU_Interface.h
* @author LowPower RF BU - AMG
* @version 1.1.0
* @date July 1, 2016
* @brief Header file for low level S2LP SPI driver.
******************************************************************************
* @attention
*
* <h2><center>&copy; COPYRIGHT(c) 2019 STMicroelectronics</center></h2>
*
* Redistribution and use in source and binary forms, with or without modification,
* are permitted provided that the following conditions are met:
* 1. Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* 2. Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* 3. Neither the name of STMicroelectronics nor the names of its contributors
* may be used to endorse or promote products derived from this software
* without specific prior written permission.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
* FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
* CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
*
* This header file constitutes an interface to the SPI driver used to
* communicate with S2LP.
* It exports some function prototypes to write/read registers and FIFOs
* and to send command strobes.
* Since the S2LP libraries are totally platform independent, the implementation
* of these functions are not provided here. The user have to implement these functions
* taking care to keep the exported prototypes.
*
* These functions are:
*
* <ul>
* <li>S2LPSpiInit</i>
* <li>S2LPSpiWriteRegisters</i>
* <li>S2LPSpiReadRegisters</i>
* <li>S2LPSpiCommandStrobes</i>
* <li>S2LPSpiWriteLinearFifo</i>
* <li>S2LPSpiReadLinearFifo</i>
* </ul>
*
* @note An example of SPI driver implementation is available in the <i>Sdk_Eval</i> library.
*
*
* <h2><center>&copy; COPYRIGHT 2019 STMicroelectronics</center></h2>
*/


/* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __MCU_INTERFACE_H
#define __MCU_INTERFACE_H


/* Includes ------------------------------------------------------------------*/
#include "S2LP_Config.h"

#ifdef __cplusplus
extern "C" {
#endif


/** @addtogroup S2LP_Libraries
* @{
*/

/** @defgroup S2LP_SPI_Driver SPI Driver
* @brief Header file for low level S2LP SPI driver.
* @details See the file <i>@ref MCU_Interface.h</i> for more details.
* @{
*/


/** @defgroup SPI_Exported_Types SPI Exported Types
* @{
*/

typedef S2LPStatus StatusBytes;

/**
* @}
*/


/** @defgroup SPI_Exported_Constants SPI Exported Constants
* @{
*/

/**
* @}
*/


/** @defgroup SPI_Exported_Functions SPI Exported Functions
* @{
*/

void RadioSpiInit(void);
void RadioSpiDeinit(void);
StatusBytes RadioSpiWriteRegisters(uint8_t cRegAddress, uint8_t cNbBytes, uint8_t* pcBuffer);
StatusBytes RadioSpiReadRegisters(uint8_t cRegAddress, uint8_t cNbBytes, uint8_t* pcBuffer);
StatusBytes RadioSpiCommandStrobes(uint8_t cCommandCode);
StatusBytes RadioSpiWriteFifo(uint8_t cNbBytes, uint8_t* pcBuffer);
StatusBytes RadioSpiReadFifo(uint8_t cNbBytes, uint8_t* pcBuffer);
//static void SPI_Error(void);

void RadioEnterShutdown(void);
void RadioExitShutdown(void);
//SFlagStatus RadioCheckShutdown(void);

/**
* @}
*/


/** @defgroup SPI_Exported_Macros SPI Exported Macros
* @{
*/

#define S2LPEnterShutdown RadioEnterShutdown
#define S2LPExitShutdown RadioExitShutdown
#define S2LPCheckShutdown (SFlagStatus)RadioCheckShutdown //(S2LPFlagStatus)SdkEvalCheckShutdown

#define S2LPSpiInit RadioSpiInit
#define S2LPSpiDeinit RadioSpiDeinit
#define S2LPSpiWriteRegisters(cRegAddress, cNbBytes, pcBuffer) RadioSpiWriteRegisters(cRegAddress, cNbBytes, pcBuffer)
#define S2LPSpiReadRegisters(cRegAddress, cNbBytes, pcBuffer) RadioSpiReadRegisters(cRegAddress, cNbBytes, pcBuffer)
#define S2LPSpiCommandStrobes(cCommandCode) RadioSpiCommandStrobes(cCommandCode)
#define S2LPSpiWriteFifo(cNbBytes, pcBuffer) RadioSpiWriteFifo(cNbBytes, pcBuffer)
#define S2LPSpiReadFifo(cNbBytes, pcBuffer) RadioSpiReadFifo(cNbBytes, pcBuffer)
//#define SdkEvalSpiReadRegisters(cRegAddress, cNbBytes, pcBuffer) S2LPSpiReadRegisters(cRegAddress, cNbBytes, pcBuffer)
//#define SdkEvalSpiWriteRegisters(cRegAddress, cNbBytes, pcBuffer) S2LPSpiWriteRegisters(cRegAddress, cNbBytes, pcBuffer)
/**
* @}
*/


/**
* @}
*/


/**
* @}
*/



#ifdef __cplusplus
}
#endif

#endif

/******************* (C) COPYRIGHT 2016 STMicroelectronics *****END OF FILE****/
Loading