Skip to content

Commit

Permalink
Cannot determine high speed capability in header
Browse files Browse the repository at this point in the history
  • Loading branch information
henrygab committed Apr 19, 2020
1 parent 8dfc43a commit e927848
Showing 1 changed file with 3 additions and 144 deletions.
147 changes: 3 additions & 144 deletions platforms/arm/nrf52/fastpin_arm_nrf52.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,150 +131,9 @@ template <uint32_t _MASK, typename _PORT, uint8_t _PORT_NUMBER, uint8_t _PIN_NUM
FASTLED_NRF52_INLINE_ATTRIBUTE static void fastset(register port_ptr_t port, register port_t val) { *port = val; }
constexpr static uint32_t nrf_pin2() { return NRF_GPIO_PIN_MAP(_PORT_NUMBER, _PIN_NUMBER); }
constexpr static bool LowSpeedOnlyRecommended() {
// only allow one function body.
#undef _FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT

// unique cases for each board / processor package / module?
#if defined(NRF52810_XXAA) && defined(NRF52810_PACKAGE_QFN48)
#if defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT)
#error "Multiple board match"
#endif
#define _FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT 1
static_assert(_PORT_NUMBER == 0, "nRF52810 only has one port");
return (
(_PIN_NUMBER == 25) ||
(_PIN_NUMBER == 26) ||
(_PIN_NUMBER == 27) ||
(_PIN_NUMBER == 28) ||
(_PIN_NUMBER == 29)
);
#endif
#if defined(NRF52810_XXAA) && defined(NRF52810_PACKAGE_QFN32)
#if defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT)
#error "Multiple board match"
#endif
#define _FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT 1
static_assert(_PORT_NUMBER == 0, "nRF52810 only has one port");
if (_PORT_NUMBER == 0) {
if (
(_PIN_NUMBER == 26) ||
(_PIN_NUMBER == 27)
) {
return true;
}
}
return false;
#endif
#if defined(NRF52832_XXAA) || defined(NRF52832_XXAB)
#if defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT)
#error "Multiple board match"
#endif
#define _FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT 1
static_assert(_PORT_NUMBER == 0, "nRF52832 only has one port");
// data sheets shows the same pins in both QFN48 and WLCSP package
// are recommended as low-speed only:
return (
(_PIN_NUMBER == 22) ||
(_PIN_NUMBER == 23) ||
(_PIN_NUMBER == 24) ||
(_PIN_NUMBER == 25) ||
(_PIN_NUMBER == 26) ||
(_PIN_NUMBER == 27) ||
(_PIN_NUMBER == 28) ||
(_PIN_NUMBER == 29) ||
(_PIN_NUMBER == 30) ||
(_PIN_NUMBER == 31)
);
#endif
#if defined(NRF52840_XXAA) && defined(NRF52840_PACKAGE_aQFN73)
#if defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT)
#error "Multiple board match"
#endif
#define _FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT 1
static_assert(_PORT_NUMBER == 0 || _PORT_NUMBER == 1, "nRF52840 only has two ports");
return
(
(
(_PORT_NUMBER == 0) &&
(
(_PIN_NUMBER == 2) ||
(_PIN_NUMBER == 3) ||
(_PIN_NUMBER == 9) ||
(_PIN_NUMBER == 10) ||
(_PIN_NUMBER == 11) ||
(_PIN_NUMBER == 12) ||
(_PIN_NUMBER == 14) ||
(_PIN_NUMBER == 28) ||
(_PIN_NUMBER == 29) ||
(_PIN_NUMBER == 30) ||
(_PIN_NUMBER == 31)
)
)
||
(
(_PORT_NUMBER == 1) &&
(
(_PIN_NUMBER == 2) ||
(_PIN_NUMBER == 3) ||
(_PIN_NUMBER == 4) ||
(_PIN_NUMBER == 5) ||
(_PIN_NUMBER == 6) ||
(_PIN_NUMBER == 7) ||
(_PIN_NUMBER == 10) ||
(_PIN_NUMBER == 13) ||
(_PIN_NUMBER == 15)
)
)
);
#endif
#if false && defined(NRF52840_XXAA) && (defined(NRF52840_PACKAGE_aQFN73) || defined(ARDUINO_NRF52840_FEATHER))
// Adafruit nRF52840 feather uses RAYTAC MDBT50Q module, which is aQFN73
// See https://cdn-learn.adafruit.com/assets/assets/000/068/544/original/Raytac_MDBT50Q.pdf
#if defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT)
#error "Multiple board match"
#endif
#define _FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT 1
static_assert(_PORT_NUMBER == 0 || _PORT_NUMBER == 1, "nRF52840 only has two ports");
return
(
(
(_PORT_NUMBER == 0) &&
(
(_PIN_NUMBER == 2) ||
(_PIN_NUMBER == 3) ||
(_PIN_NUMBER == 9) ||
(_PIN_NUMBER == 10) ||
(_PIN_NUMBER == 28) ||
(_PIN_NUMBER == 29) ||
(_PIN_NUMBER == 30) ||
(_PIN_NUMBER == 31)
)
)
||
(
(_PORT_NUMBER == 1) &&
(
(_PIN_NUMBER == 1) ||
(_PIN_NUMBER == 2) ||
(_PIN_NUMBER == 3) ||
(_PIN_NUMBER == 4) ||
(_PIN_NUMBER == 5) ||
(_PIN_NUMBER == 6) ||
(_PIN_NUMBER == 7) ||
(_PIN_NUMBER == 10) ||
(_PIN_NUMBER == 11) ||
(_PIN_NUMBER == 12) ||
(_PIN_NUMBER == 13) ||
(_PIN_NUMBER == 14) ||
(_PIN_NUMBER == 15)
)
)
);
#endif
#if !defined(_FASTLED_NRF52_LOW_SPEED_ONLY_BOARD_DETECT)
#warning "Unknown board / package, ... caller must determine pins that support high-speed"
return false; // choosing default to be FALSE, to allow users to ATTEMPT to use high-speed on pins where support is not known
#endif
// Caller must always determine if high speed use if allowed on a given pin,
// because it depends on more than just the chip packaging ... it depends on entire board (and even system) design.
return false; // choosing default to be FALSE, to allow users to ATTEMPT to use high-speed on pins where support is not known
}
// Expose the nrf pin (port/pin combined), port, and pin as properties (e.g., for setting up SPI)

Expand Down

0 comments on commit e927848

Please sign in to comment.