mirror of
https://github.com/betaflight/betaflight.git
synced 2025-07-25 09:16:07 +03:00
Optimisation of driver header files
This commit is contained in:
parent
4bb0816122
commit
07adf66bbb
100 changed files with 212 additions and 138 deletions
|
@ -6,16 +6,7 @@
|
|||
#include <platform.h>
|
||||
#include "resource.h"
|
||||
|
||||
// IO pin identification
|
||||
// make sure that ioTag_t can't be assigned into IO_t without warning
|
||||
typedef uint8_t ioTag_t; // packet tag to specify IO pin
|
||||
typedef void* IO_t; // type specifying IO pin. Currently ioRec_t pointer, but this may change
|
||||
|
||||
// NONE initializer for ioTag_t variables
|
||||
#define IOTAG_NONE ((ioTag_t)0)
|
||||
|
||||
// NONE initializer for IO_t variable
|
||||
#define IO_NONE ((IO_t)0)
|
||||
#include "io_types.h"
|
||||
|
||||
// preprocessor is used to convert pinid to requested C data value
|
||||
// compile-time error is generated if requested pin is not available (not set in TARGET_IO_PORTx)
|
||||
|
@ -24,19 +15,6 @@ typedef void* IO_t; // type specifying IO pin. Currently ioRec_t poin
|
|||
// expand pinid to to ioTag_t
|
||||
#define IO_TAG(pinid) DEFIO_TAG(pinid)
|
||||
|
||||
// both ioTag_t and IO_t are guarantied to be zero if pinid is NONE (no pin)
|
||||
// this simplifies initialization (globals are zeroed on start) and allows
|
||||
// omitting unused fields in structure initializers.
|
||||
// it is also possible to use IO_t and ioTag_t as boolean value
|
||||
// TODO - this may conflict with requirement to generate warning/error on IO_t - ioTag_t assignment
|
||||
// IO_t being pointer is only possibility I know of ..
|
||||
|
||||
// pin config handling
|
||||
// pin config is packed into ioConfig_t to decrease memory requirements
|
||||
// IOCFG_x macros are defined for common combinations for all CPUs; this
|
||||
// helps masking CPU differences
|
||||
|
||||
typedef uint8_t ioConfig_t; // packed IO configuration
|
||||
#if defined(STM32F1)
|
||||
|
||||
// mode is using only bits 6-2
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue