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

Spi drivers #19820

Draft
wants to merge 29 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
b6f94e0
tests/drivers/adt7310: adapted to the new SPI API
hugueslarrive Jul 3, 2023
e392ec0
drivers/at25xxx: adapted to the new SPI API
hugueslarrive Jul 4, 2023
8810097
drivers/at86rf215: adapted to the new SPI API
hugueslarrive Jul 4, 2023
2d5fd1a
drivers/at86rf2xx: adapted to the new SPI API
hugueslarrive Jul 4, 2023
4da0811
drivers/ata8520e: adapted to the new SPI API
hugueslarrive Jul 4, 2023
d18ff5d
drivers/atwinc15x0: adapted to the new SPI API
hugueslarrive Jul 4, 2023
25d68ab
drivers/bmx280: adapted to the new SPI API
hugueslarrive Jul 9, 2023
f7d38ee
drivers/candev_mcp2515: adapted to the new SPI API
hugueslarrive Jul 9, 2023
23b514b
drivers/cc110x: adapted to the new SPI API
hugueslarrive Jul 2, 2023
9845ea6
drivers/cc2420: adapted to the new SPI API
hugueslarrive Jul 9, 2023
6cd4368
drivers/ds3234: adapted to the new SPI API
hugueslarrive Jul 2, 2023
43b50a5
drivers/enc28j60: adapted to the new SPI API
hugueslarrive Jul 9, 2023
2f557ce
drivers/encx24j600: adapted to the new SPI API
hugueslarrive Jul 9, 2023
42126ee
drivers/epd_bw_spi: adapted to the new SPI API
hugueslarrive Jul 9, 2023
fe743ba
drivers/ili9341: adapted to the new SPI API
hugueslarrive Jul 9, 2023
4e3a99c
drivers/lcd: adapted to the new SPI API
hugueslarrive Jul 9, 2023
31b6c2f
drivers/st7735: adapted to the new SPI API
hugueslarrive Jul 9, 2023
8a0c375
drivers/kw2xrf: adapted to the new SPI API
hugueslarrive Jul 9, 2023
485dc2c
drivers/l3gxxxx: adapted to the new SPI API
hugueslarrive Jul 9, 2023
e03bf87
drivers/lis2dh12: adapted to the new SPI API
hugueslarrive Jul 2, 2023
682c906
drivers/lis3dh: adapted to the new SPI API
hugueslarrive Jul 9, 2023
7bc430b
drivers/mfrc522: adapted to the new SPI API
hugueslarrive Jul 9, 2023
7d281f0
drivers/nrf24l01p_ng: adapted to the new SPI API
hugueslarrive Jul 2, 2023
e716f8f
drivers/sx1280: adapted to the new SPI API
hugueslarrive Jul 3, 2023
74c1c01
pkg/driver_bme680: adapted to the new SPI API
hugueslarrive Jul 12, 2023
52ff99e
pkg/driver_sx126x:: adapted to the new SPI API
hugueslarrive Jul 12, 2023
d88e7df
pkg/mynewt-core: adapted to the new SPI API
hugueslarrive Jul 12, 2023
496a922
pkg/uwb-dw1000: adapted to the new SPI API
hugueslarrive Jul 12, 2023
4bb71b8
periph/spi: printing and testing SPI clock rates
hugueslarrive Aug 12, 2021
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
Prev Previous commit
Next Next commit
drivers/epd_bw_spi: adapted to the new SPI API
  • Loading branch information
hugueslarrive committed Jul 11, 2023
commit 42126ee44d74a899106f62ebc434b2b16882d45a
5 changes: 5 additions & 0 deletions drivers/epd_bw_spi/epd_bw_spi.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2022 Silke Hofstra
* 2023 Hugues Larrive
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand All @@ -14,6 +15,7 @@
* @brief Device driver implementation for the epd_bw_spi display controller
*
* @author Silke Hofstra <silke@slxh.eu>
* @author Hugues Larrive <hugues.larrive@pm.me>
* @}
*/
#include <string.h>
Expand Down Expand Up @@ -105,6 +107,9 @@ int epd_bw_spi_init(epd_bw_spi_t *dev, const epd_bw_spi_params_t *params)
return res;
}

/* compute the SPI clk configuration */
dev->params.spi_clk = spi_get_clk(dev->params.spi, dev->params.spi_freq);

return 0;
}

Expand Down
7 changes: 5 additions & 2 deletions drivers/epd_bw_spi/include/epd_bw_spi_params.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Silke Hofstra
* 2023 Hugues Larrive
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand All @@ -14,13 +15,15 @@
* @brief Default configuration for epd_bw_spi
*
* @author Silke Hofstra <silke@slxh.eu>
* @author Hugues Larrive <hugues.larrive@pm.me>
*/

#ifndef EPD_BW_SPI_PARAMS_H
#define EPD_BW_SPI_PARAMS_H

#include "board.h"
#include "epd_bw_spi.h"
#include "macros/units.h"

#ifdef __cplusplus
extern "C" {
Expand Down Expand Up @@ -109,7 +112,7 @@ static const uint8_t epd_bw_spi_il3829_lut_default_part[] = {
/**
* @brief SPI device clock speed.
*/
#define EPD_BW_SPI_PARAM_SPI_CLK (SPI_CLK_5MHZ)
#define EPD_BW_SPI_PARAM_SPI_CLK MHZ(4) /* 1 / 250ns min clock cycle time */
#endif

/**
Expand Down Expand Up @@ -175,7 +178,7 @@ static const uint8_t epd_bw_spi_il3829_lut_default_part[] = {
* @brief Parameters to initialize the display with.
*/
#define EPD_BW_SPI_PARAMS { .spi = EPD_BW_SPI_PARAM_SPI, \
.spi_clk = EPD_BW_SPI_PARAM_SPI_CLK, \
.spi_freq = EPD_BW_SPI_PARAM_SPI_CLK, \
.cs_pin = EPD_BW_SPI_PARAM_CS, \
.dc_pin = EPD_BW_SPI_PARAM_DC, \
.rst_pin = EPD_BW_SPI_PARAM_RST, \
Expand Down
5 changes: 4 additions & 1 deletion drivers/include/epd_bw_spi.h
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/*
* Copyright (C) 2019 Silke Hofstra
* 2023 Hugues Larrive
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
Expand Down Expand Up @@ -27,6 +28,7 @@
* @brief Generic black/white e-paper/e-ink display SPI driver.
*
* @author Silke Hofstra <silke@slxh.eu>
* @author Hugues Larrive <hugues.larrive@pm.me>
*/

#ifndef EPD_BW_SPI_H
Expand Down Expand Up @@ -84,7 +86,8 @@ typedef struct {
*/
typedef struct {
spi_t spi; /**< SPI device that the display is connected to */
spi_clk_t spi_clk; /**< SPI clock speed to use */
spi_clk_t spi_clk; /**< SPI clock configuration computed during init */
uint32_t spi_freq; /**< SPI clock speed to use */
gpio_t cs_pin; /**< pin connected to the CHIP SELECT line */
gpio_t dc_pin; /**< pin connected to the DC line */
gpio_t rst_pin; /**< pin connected to the reset line (optional) */
Expand Down