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

drivers/periph: use uint_fast8_t as default type

The default driver type is just an index into a device array defined
by the board.

If a platform wants to encode additional information in the device type,
it can define a custom type.

This means we can just set the default type to whatever fits the target
CPU best.

On ARM this will still be a 32 bit word, but on AVR it will by a 8 bit byte.
This commit is contained in:
Benjamin Valentin 2021-11-12 16:26:36 +01:00
parent 3dac8a5493
commit 1768e93710
8 changed files with 16 additions and 16 deletions

View File

@ -69,14 +69,14 @@ extern "C" {
* @brief Define default ADC type identifier
*/
#ifndef HAVE_ADC_T
typedef unsigned int adc_t;
typedef uint_fast8_t adc_t;
#endif
/**
* @brief Default ADC undefined value
*/
#ifndef ADC_UNDEF
#define ADC_UNDEF (UINT_MAX)
#define ADC_UNDEF (UINT_FAST8_MAX)
#endif
/**

View File

@ -64,7 +64,7 @@ extern "C" {
* @brief Define default DAC type identifier
*/
#ifndef HAVE_DAC_T
typedef unsigned int dac_t;
typedef uint_fast8_t dac_t;
#endif
/**
@ -79,7 +79,7 @@ enum {
* @brief Default DAC undefined value
*/
#ifndef DAC_UNDEF
#define DAC_UNDEF (UINT_MAX)
#define DAC_UNDEF (UINT_FAST8_MAX)
#endif
/**

View File

@ -139,7 +139,7 @@ extern "C" {
* @{
*/
#ifndef I2C_UNDEF
#define I2C_UNDEF (UINT_MAX)
#define I2C_UNDEF (UINT_FAST8_MAX)
#endif
/** @} */
@ -148,7 +148,7 @@ extern "C" {
* @{
*/
#ifndef HAVE_I2C_T
typedef unsigned int i2c_t;
typedef uint_fast8_t i2c_t;
#endif
/** @} */

View File

@ -82,14 +82,14 @@ extern "C" {
* @brief Default PWM undefined value
*/
#ifndef PWM_UNDEF
#define PWM_UNDEF (UINT_MAX)
#define PWM_UNDEF (UINT_FAST8_MAX)
#endif
/**
* @brief Default PWM type definition
*/
#ifndef HAVE_PWM_T
typedef unsigned int pwm_t;
typedef uint_fast8_t pwm_t;
#endif
/**

View File

@ -98,14 +98,14 @@ extern "C" {
* @brief Default QDEC undefined value
*/
#ifndef QDEC_UNDEF
#define QDEC_UNDEF (UINT_MAX)
#define QDEC_UNDEF (UINT_FAST8_MAX)
#endif
/**
* @brief Default QDEC type definition
*/
#ifndef HAVE_QDEC_T
typedef unsigned int qdec_t;
typedef uint_fast8_t qdec_t;
#endif
/**

View File

@ -91,7 +91,7 @@ extern "C" {
* @brief Define global value for undefined SPI device
*/
#ifndef SPI_UNDEF
#define SPI_UNDEF (UINT_MAX)
#define SPI_UNDEF (UINT_FAST8_MAX)
#endif
/**
@ -116,7 +116,7 @@ extern "C" {
* @brief Default type for SPI devices
*/
#ifndef HAVE_SPI_T
typedef unsigned int spi_t;
typedef uint_fast8_t spi_t;
#endif
/**

View File

@ -56,7 +56,7 @@ extern "C" {
* @brief Default value for timer not defined
*/
#ifndef TIMER_UNDEF
#define TIMER_UNDEF (UINT_MAX)
#define TIMER_UNDEF (UINT_FAST8_MAX)
#endif
/**
@ -66,7 +66,7 @@ extern "C" {
* and vendor device header.
*/
#ifndef HAVE_TIMER_T
typedef unsigned int tim_t;
typedef uint_fast8_t tim_t;
#endif
/**

View File

@ -74,14 +74,14 @@ extern "C" {
* @brief Define default UART type identifier
*/
#ifndef HAVE_UART_T
typedef unsigned int uart_t;
typedef uint_fast8_t uart_t;
#endif
/**
* @brief Default UART undefined value
*/
#ifndef UART_UNDEF
#define UART_UNDEF (UINT_MAX)
#define UART_UNDEF (UINT_FAST8_MAX)
#endif
/**