Skip to content

CI deployement #49

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

Merged
merged 5 commits into from
Jul 5, 2022
Merged
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
30 changes: 30 additions & 0 deletions .github/workflows/astyle.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: astyle
on:
push:
branches:
- main
paths-ignore:
- '*.json'
- '**.md'
- keywords.txt
- library.properties
pull_request:
paths-ignore:
- '*.json'
- '**.md'
- keywords.txt
- library.properties
workflow_dispatch:
jobs:
astyle:
name: Check code formatting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: stm32duino/actions/astyle-check@main
# Use the output from the `Astyle` step
- name: Astyle Errors
if: failure()
run: |
cat ${{ steps.Astyle.outputs.astyle-result }}
exit 1
14 changes: 14 additions & 0 deletions .github/workflows/codespell.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
name: codespell
on:
push:
branches:
- main
pull_request:
workflow_dispatch:
jobs:
codespell:
name: Check for spelling errors
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
- uses: codespell-project/actions-codespell@master
40 changes: 40 additions & 0 deletions .github/workflows/compile-examples.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Compile Examples
on:
push:
branches:
- main
paths-ignore:
- '*.json'
- '**.md'
- keywords.txt
- library.properties
pull_request:
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
fqbn:
- STMicroelectronics:stm32:GenF1:pnum=BLUEBUTTON_F103RCT
- STMicroelectronics:stm32:Nucleo_144:pnum=NUCLEO_F207ZG
- STMicroelectronics:stm32:GenF4:pnum=FEATHER_F405
- STMicroelectronics:stm32:Disco:pnum=DISCO_F746NG
- STMicroelectronics:stm32:GenH7:pnum=DAISY_PATCH_SM
- STMicroelectronics:stm32:Eval:pnum=STEVAL_MKSBOX1V1,usb=CDCgen
- STMicroelectronics:stm32:Nucleo_144:pnum=NUCLEO_L552ZE_Q
- STMicroelectronics:stm32:Nucleo_144:pnum=NUCLEO_U575ZI_Q
steps:
- uses: actions/checkout@main
- uses: arduino/compile-sketches@v1
with:
fqbn: ${{ matrix.fqbn }}
platforms: |
- source-url: https://github.com/stm32duino/BoardManagerFiles/raw/main/package_stmicroelectronics_index.json
name: STMicroelectronics:stm32
libraries: |
# Install the library from the local path.
- source-path: ./
- name: FatFS
6 changes: 3 additions & 3 deletions src/SD.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
directories which simplifies interacting with files in subdirectories.

* Utility methods are provided to determine whether a file exists
and to create a directory heirarchy.
and to create a directory hierarchy.

*/

Expand Down Expand Up @@ -144,13 +144,13 @@ File SDClass::open(const char *filepath, uint8_t mode /* = FA_READ */)
file._fil->fs = 0;
file._dir.fs = 0;
#endif

if ((mode == FILE_WRITE) && (!SD.exists(filepath))) {
mode = mode | FA_CREATE_ALWAYS;
}

file._res = f_open(file._fil, filepath, mode);
if ( file._res != FR_OK) {
if (file._res != FR_OK) {
free(file._fil);
file._fil = NULL;
file._res = f_opendir(&file._dir, filepath);
Expand Down
5 changes: 4 additions & 1 deletion src/STM32SD.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,10 @@ class File {
DIR _dir = {}; // init all fields to 0
FRESULT _res = FR_OK;

FRESULT getErrorstate(void) {return _res;}
FRESULT getErrorstate(void)
{
return _res;
}

};

Expand Down
108 changes: 54 additions & 54 deletions src/bsp_sd.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,82 +41,82 @@

/* Definition for BSP SD */
#if defined(SDMMC1) || defined(SDMMC2)
#ifndef SD_INSTANCE
#define SD_INSTANCE SDMMC1
#endif

#define SD_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE
#define SD_CLK_DISABLE __HAL_RCC_SDMMC1_CLK_DISABLE
#ifdef SDMMC2
#define SD_CLK2_ENABLE __HAL_RCC_SDMMC2_CLK_ENABLE
#define SD_CLK2_DISABLE __HAL_RCC_SDMMC2_CLK_DISABLE
#endif

#define SD_CLK_EDGE SDMMC_CLOCK_EDGE_RISING
#define SD_CLK_BYPASS SDMMC_CLOCK_BYPASS_DISABLE
#define SD_CLK_PWR_SAVE SDMMC_CLOCK_POWER_SAVE_DISABLE
#define SD_BUS_WIDE_1B SDMMC_BUS_WIDE_1B
#define SD_BUS_WIDE_4B SDMMC_BUS_WIDE_4B
#define SD_BUS_WIDE_8B SDMMC_BUS_WIDE_8B
#define SD_HW_FLOW_CTRL_ENABLE SDMMC_HARDWARE_FLOW_CONTROL_ENABLE
#define SD_HW_FLOW_CTRL_DISABLE SDMMC_HARDWARE_FLOW_CONTROL_DISABLE

#ifdef STM32H7xx
#define SD_CLK_DIV 1
#else
#define SD_CLK_DIV SDMMC_TRANSFER_CLK_DIV
#endif

#ifdef SDMMC_TRANSCEIVER_ENABLE
#define SD_TRANSCEIVER_ENABLE SDMMC_TRANSCEIVER_ENABLE
#define SD_TRANSCEIVER_DISABLE SDMMC_TRANSCEIVER_DISABLE
#endif
#ifndef SD_INSTANCE
#define SD_INSTANCE SDMMC1
#endif

#define SD_CLK_ENABLE __HAL_RCC_SDMMC1_CLK_ENABLE
#define SD_CLK_DISABLE __HAL_RCC_SDMMC1_CLK_DISABLE
#ifdef SDMMC2
#define SD_CLK2_ENABLE __HAL_RCC_SDMMC2_CLK_ENABLE
#define SD_CLK2_DISABLE __HAL_RCC_SDMMC2_CLK_DISABLE
#endif

#define SD_CLK_EDGE SDMMC_CLOCK_EDGE_RISING
#define SD_CLK_BYPASS SDMMC_CLOCK_BYPASS_DISABLE
#define SD_CLK_PWR_SAVE SDMMC_CLOCK_POWER_SAVE_DISABLE
#define SD_BUS_WIDE_1B SDMMC_BUS_WIDE_1B
#define SD_BUS_WIDE_4B SDMMC_BUS_WIDE_4B
#define SD_BUS_WIDE_8B SDMMC_BUS_WIDE_8B
#define SD_HW_FLOW_CTRL_ENABLE SDMMC_HARDWARE_FLOW_CONTROL_ENABLE
#define SD_HW_FLOW_CTRL_DISABLE SDMMC_HARDWARE_FLOW_CONTROL_DISABLE

#ifdef STM32H7xx
#define SD_CLK_DIV 1
#else
#define SD_CLK_DIV SDMMC_TRANSFER_CLK_DIV
#endif

#ifdef SDMMC_TRANSCEIVER_ENABLE
#define SD_TRANSCEIVER_ENABLE SDMMC_TRANSCEIVER_ENABLE
#define SD_TRANSCEIVER_DISABLE SDMMC_TRANSCEIVER_DISABLE
#endif

#elif defined(SDIO)
#define SD_INSTANCE SDIO
#define SD_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE
#define SD_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE
#define SD_CLK_EDGE SDIO_CLOCK_EDGE_RISING
#define SD_CLK_BYPASS SDIO_CLOCK_BYPASS_DISABLE
#define SD_CLK_PWR_SAVE SDIO_CLOCK_POWER_SAVE_DISABLE
#define SD_BUS_WIDE_1B SDIO_BUS_WIDE_1B
#define SD_BUS_WIDE_4B SDIO_BUS_WIDE_4B
#define SD_BUS_WIDE_8B SDIO_BUS_WIDE_8B
#define SD_HW_FLOW_CTRL_ENABLE SDIO_HARDWARE_FLOW_CONTROL_ENABLE
#define SD_HW_FLOW_CTRL_DISABLE SDIO_HARDWARE_FLOW_CONTROL_DISABLE
#define SD_CLK_DIV SDIO_TRANSFER_CLK_DIV
#define SD_INSTANCE SDIO
#define SD_CLK_ENABLE __HAL_RCC_SDIO_CLK_ENABLE
#define SD_CLK_DISABLE __HAL_RCC_SDIO_CLK_DISABLE
#define SD_CLK_EDGE SDIO_CLOCK_EDGE_RISING
#define SD_CLK_BYPASS SDIO_CLOCK_BYPASS_DISABLE
#define SD_CLK_PWR_SAVE SDIO_CLOCK_POWER_SAVE_DISABLE
#define SD_BUS_WIDE_1B SDIO_BUS_WIDE_1B
#define SD_BUS_WIDE_4B SDIO_BUS_WIDE_4B
#define SD_BUS_WIDE_8B SDIO_BUS_WIDE_8B
#define SD_HW_FLOW_CTRL_ENABLE SDIO_HARDWARE_FLOW_CONTROL_ENABLE
#define SD_HW_FLOW_CTRL_DISABLE SDIO_HARDWARE_FLOW_CONTROL_DISABLE
#define SD_CLK_DIV SDIO_TRANSFER_CLK_DIV
#else
#error "Unknown SD_INSTANCE"
#error "Unknown SD_INSTANCE"
#endif

#ifndef SD_HW_FLOW_CTRL
#define SD_HW_FLOW_CTRL SD_HW_FLOW_CTRL_DISABLE
#define SD_HW_FLOW_CTRL SD_HW_FLOW_CTRL_DISABLE
#endif

#ifndef SD_BUS_WIDE
#define SD_BUS_WIDE SD_BUS_WIDE_4B
#define SD_BUS_WIDE SD_BUS_WIDE_4B
#endif

#if defined(SDMMC_TRANSCEIVER_ENABLE) && !defined(SD_TRANSCEIVER_MODE)
#define SD_TRANSCEIVER_MODE SD_TRANSCEIVER_DISABLE
#define SD_TRANSCEIVER_MODE SD_TRANSCEIVER_DISABLE
#endif

/* BSP SD Private Variables */
static SD_HandleTypeDef uSdHandle;
static uint32_t SD_detect_ll_gpio_pin = LL_GPIO_PIN_ALL;
static GPIO_TypeDef *SD_detect_gpio_port = GPIOA;
#ifdef SDMMC_TRANSCEIVER_ENABLE
static uint32_t SD_trans_en_ll_gpio_pin = LL_GPIO_PIN_ALL;
static GPIO_TypeDef *SD_trans_en_gpio_port = GPIOA;
static uint32_t SD_trans_sel_ll_gpio_pin = LL_GPIO_PIN_ALL;
static GPIO_TypeDef *SD_trans_sel_gpio_port = GPIOA;
static uint32_t SD_trans_en_ll_gpio_pin = LL_GPIO_PIN_ALL;
static GPIO_TypeDef *SD_trans_en_gpio_port = GPIOA;
static uint32_t SD_trans_sel_ll_gpio_pin = LL_GPIO_PIN_ALL;
static GPIO_TypeDef *SD_trans_sel_gpio_port = GPIOA;
#endif
#ifndef STM32L1xx
#define SD_OK HAL_OK
#define SD_TRANSFER_OK ((uint8_t)0x00)
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
#define SD_OK HAL_OK
#define SD_TRANSFER_OK ((uint8_t)0x00)
#define SD_TRANSFER_BUSY ((uint8_t)0x01)
#else /* STM32L1xx */
static SD_CardInfo uSdCardInfo;
static SD_CardInfo uSdCardInfo;
#endif


Expand Down
2 changes: 1 addition & 1 deletion src/bsp_sd.h
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ extern "C" {
#endif
#if !defined(STM32_CORE_VERSION) || (STM32_CORE_VERSION <= 0x01060100)
#error "This library version required a STM32 core version > 1.6.1.\
Please update the core or install previous libray version."
Please update the core or install previous library version."
#endif

/*SD Card information structure */
Expand Down
12 changes: 6 additions & 6 deletions src/ffconf.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@

/* FatFs specific configuration options. */
#if __has_include("ffconf_custom.h")
#include "ffconf_custom.h"
#include "ffconf_custom.h"
#else
#if _FATFS == 68300
#include "ffconf_default_68300.h"
#else
#include "ffconf_default_32020.h"
#endif
#if _FATFS == 68300
#include "ffconf_default_68300.h"
#else
#include "ffconf_default_32020.h"
#endif
#endif
#endif /* _ARDUINO_FFCONF_H */
4 changes: 2 additions & 2 deletions src/ffconf_default_32020.h
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@
/ option to 1 and f_getfree() function at first time after volume mount will
/ force a full FAT scan.
/
/ 0: Load all informations in the FSINFO if available.
/ 0: Load all information in the FSINFO if available.
/ 1: Do not trust free cluster count in the FSINFO.
*/

Expand Down Expand Up @@ -236,7 +236,7 @@
/� These options have no effect at read-only configuration (_FS_READONLY == 1). */

#if _NORTC_YEAR < 1980 || _NORTC_YEAR > 2107 || _NORTC_MON < 1 || _NORTC_MON > 12 || _NORTC_MDAY < 1 || _NORTC_MDAY > 31
#error Invalid _FS_NORTC settings
#error Invalid _FS_NORTC settings
#endif

#endif /* _FFCONFIG */
26 changes: 13 additions & 13 deletions src/ffconf_default_68300.h
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@
/ number and only an FAT volume found on the physical drive will be mounted.
/ When multi-partition is enabled (1), each logical drive number can be bound to
/ arbitrary physical drive and partition listed in the VolToPart[]. Also f_fdisk()
/ funciton will be available. */
/ function will be available. */


#define _MIN_SS 512
Expand Down Expand Up @@ -287,9 +287,9 @@
#define _FS_REENTRANT 0

#if _FS_REENTRANT
#include "cmsis_os.h"
#define _FS_TIMEOUT 1000
#define _SYNC_t osSemaphoreId
#include "cmsis_os.h"
#define _FS_TIMEOUT 1000
#define _SYNC_t osSemaphoreId
#endif
/* The option _FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
Expand All @@ -311,16 +311,16 @@
/* #include <windows.h> // O/S definitions */

#if _USE_LFN == 3
#if !defined(ff_malloc) || !defined(ff_free)
#include <stdlib.h>
#endif
#if !defined(ff_malloc) || !defined(ff_free)
#include <stdlib.h>
#endif

#if !defined(ff_malloc)
#define ff_malloc malloc
#endif
#if !defined(ff_malloc)
#define ff_malloc malloc
#endif

#if !defined(ff_free)
#define ff_free free
#endif
#if !defined(ff_free)
#define ff_free free
#endif
#endif
/*--- End of configuration options ---*/