1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

drivers/periph_common: build periph module selectively

This commit is contained in:
Alexandre Abadie 2021-12-17 15:16:03 +01:00
parent 3b601933ce
commit 749efa507d
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
7 changed files with 8 additions and 26 deletions

View File

@ -1 +1,7 @@
PERIPH_COMMON_MODULES_SRCS_ALL = $(filter-out init.c,$(wildcard *.c))
PERIPH_COMMON_MODULES_NAMES = $(subst .c,,$(PERIPH_COMMON_MODULES_SRCS_ALL))
PERIPH_COMMON_MODULES = $(addprefix periph_, $(PERIPH_COMMON_MODULES_NAMES))
PERIPH_COMMON_MODULES_USED = $(filter $(PERIPH_COMMON_MODULES),$(USEMODULE))
SRC = init.c $(subst periph_,,$(addsuffix .c,$(PERIPH_COMMON_MODULES_USED)))
include $(RIOTBASE)/Makefile.base

View File

@ -23,9 +23,6 @@
#include "periph_cpu.h"
#include "assert.h"
/* guard this file, must be done before including periph/eeprom.h */
#if defined(EEPROM_SIZE)
#include "periph/eeprom.h"
uint8_t eeprom_read_byte(uint32_t pos)
@ -60,4 +57,3 @@ size_t eeprom_erase(void)
{
return eeprom_clear(0, EEPROM_SIZE);
}
#endif

View File

@ -22,13 +22,8 @@
#include "cpu.h"
#include "assert.h"
/* guard this file, must be done before including periph/flashpage.h
* TODO: remove as soon as periph drivers can be build selectively */
#if defined(FLASHPAGE_SIZE) || defined(PERIPH_FLASHPAGE_CUSTOM_PAGESIZES)
#include "periph/flashpage.h"
#endif
#ifdef MODULE_PERIPH_FLASHPAGE_PAGEWISE
void flashpage_read(unsigned page, void *data)
{
assert(page < FLASHPAGE_NUMOF);
@ -64,6 +59,7 @@ int flashpage_write_and_verify(unsigned page, const void *data)
return flashpage_verify(page, data);
}
#ifdef FLASHPAGE_SIZE
void flashpage_write_page(unsigned page, const void *data)
{
assert((unsigned) page < FLASHPAGE_NUMOF);
@ -75,7 +71,7 @@ void flashpage_write_page(unsigned page, const void *data)
flashpage_write(flashpage_addr(page), data, FLASHPAGE_SIZE);
}
}
#endif /* MODULE_PERIPH_FLASHPAGE_PAGEWISE */
#endif
#if defined(FLASHPAGE_RWWEE_NUMOF)
void flashpage_rwwee_read(unsigned page, void *data)

View File

@ -9,8 +9,6 @@
#include "periph/gpio.h"
#include <stdint.h>
#ifdef MODULE_PERIPH_GPIO
uint8_t gpio_util_shiftin(gpio_t data_pin, gpio_t clock_pin)
{
uint8_t byte = 0x00;
@ -25,5 +23,3 @@ uint8_t gpio_util_shiftin(gpio_t data_pin, gpio_t clock_pin)
return byte;
}
#endif /* MODULE_PERIPH_GPIO */

View File

@ -24,8 +24,6 @@
#include "periph/i2c.h"
#include "byteorder.h"
#ifdef I2C_NUMOF
#ifdef PERIPH_I2C_NEED_READ_REG
int i2c_read_reg(i2c_t dev, uint16_t addr, uint16_t reg,
void *data, uint8_t flags)
@ -103,5 +101,3 @@ int i2c_write_regs(i2c_t dev, uint16_t addr, uint16_t reg,
return i2c_write_bytes(dev, addr, data, len, flags | I2C_NOSTART);
}
#endif /* PERIPH_I2C_NEED_WRITE_REGS */
#endif /* I2C_NUMOF */

View File

@ -18,7 +18,6 @@
* @}
*/
#include "kernel_defines.h"
#if IS_USED(MODULE_PERIPH_PTP_TIMER)
#include "irq.h"
#include "periph/ptp.h"
@ -45,6 +44,3 @@ void ptp_timer_set_u64(uint64_t target)
irq_restore(irq_state);
}
#endif /* !defined(HAVE_PTP_TIMER_SET_U64) */
#else
typedef int dont_be_pedantic;
#endif

View File

@ -25,8 +25,6 @@
#include "cpu.h"
#include "periph/spi.h"
#ifdef SPI_NUMOF
#ifdef PERIPH_SPI_NEEDS_INIT_CS
int spi_init_cs(spi_t bus, spi_cs_t cs)
{
@ -69,5 +67,3 @@ void spi_transfer_regs(spi_t bus, spi_cs_t cs,
spi_transfer_bytes(bus, cs, false, out, in, len);
}
#endif
#endif /* SPI_NUMOF */