nrf/modules/machine/spi: Move enable-guard to prevent wrong includes

This patch moves the check of SPI configuration before
including any SPI header files. As targets might disable SPI
support, current code ends up in including SPIM if not SPI
is configured. Hence, this is why the check whether the module is
enabled should be done before including headers.
This commit is contained in:
Glenn Ruben Bakke 2018-05-08 20:06:55 +02:00 committed by Damien George
parent 774638e2a9
commit 5925004da3
1 changed files with 4 additions and 3 deletions

View File

@ -29,8 +29,11 @@
#include <stdio.h>
#include <string.h>
#include "py/nlr.h"
#include "py/runtime.h"
#if MICROPY_PY_MACHINE_HW_SPI
#include "py/nlr.h"
#include "py/mphal.h"
#include "extmod/machine_spi.h"
#include "pin.h"
@ -42,8 +45,6 @@
#include "nrfx_spim.h"
#endif
#if MICROPY_PY_MACHINE_HW_SPI
/// \moduleref pyb
/// \class SPI - a master-driven serial protocol
///