Skip to content

Fix nRF52810 build with Arduino and SPI/I2C #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
name: Build Examples

on: [push, pull_request, workflow_dispatch]
on:
push:
branches:
-master
pull_request:
workflow_dispatch:

jobs:
build_arduino:
Expand All @@ -11,8 +16,11 @@ jobs:
- "libraries/n-able/examples/FreeRTOS"
- "libraries/n-able/examples/BLE_Advertiser"
- "libraries/n-able/examples/BLE_Scan"
- "libraries/SPI/examples/BarometricPressureSensor"
- "libraries/Wire/examples/digital_potentiometer"
variant:
- Generic_nRF51822:chip=xxaa
- Generic_nRF52810
- Generic_nRF52832
- Generic_nRF52833
- Generic_nRF52840
Expand Down Expand Up @@ -56,6 +64,7 @@ jobs:
- "example/lib/examples/NimBLE_Client"
variant:
- generic_nrf51822_xxaa
- generic_nrf52810
- generic_nrf52832
- generic_nrf52833
- generic_nrf52840
Expand Down
4 changes: 2 additions & 2 deletions boards.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1973,8 +1973,8 @@ Generic_nRF52810.build.core=nRF5
Generic_nRF52810.build.variant=Generic
Generic_nRF52810.build.variant_system_lib=
Generic_nRF52810.build.float_flags=
Generic_nRF52810.build.ldscript=nRF52810_xxaa.ld
Generic_nRF52810.build.extra_flags=-DNRF52_SERIES -DnRF52810_XXAA {bootloader.flags} -DCONFIG_NIMBLE_CPP_LOG_LEVEL={build.cpp_debug} {build.nimble_flags}
Generic_nRF52810.build.ldscript=nrf52810_xxaa.ld
Generic_nRF52810.build.extra_flags=-DNRF52_SERIES -DNRF52810_XXAA {bootloader.flags} -DCONFIG_NIMBLE_CPP_LOG_LEVEL={build.cpp_debug} {build.nimble_flags}

Generic_nRF52810.menu.lfclk.lfxo=Crystal Oscillator
Generic_nRF52810.menu.lfclk.lfxo.build.lfclk_flags=-DUSE_LFXO
Expand Down
2 changes: 1 addition & 1 deletion libraries/SPI/SPI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -254,7 +254,7 @@ void SPIClass::detachInterrupt() {
}

#if SPI_INTERFACES_COUNT > 0
#if defined(NRF52_SERIES)
#if defined(NRF52_SERIES) && defined(NRF_SPI2)
SPIClass SPI (NRF_SPI2, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI);
#else
SPIClass SPI (NRF_SPI0, PIN_SPI_MISO, PIN_SPI_SCK, PIN_SPI_MOSI);
Expand Down
11 changes: 11 additions & 0 deletions libraries/Wire/Wire_nRF52.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,15 +399,26 @@ void TwoWire::onService(void)
}
}

#if defined(NRF_TWIM1)
TwoWire Wire(NRF_TWIM1, NRF_TWIS1, SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL);
#else
TwoWire Wire(NRF_TWIM0, NRF_TWIS0, TWIM0_TWIS0_IRQn, PIN_WIRE_SDA, PIN_WIRE_SCL);
#endif

#if WIRE_INTERFACES_COUNT > 0
extern "C"
{
#if defined(NRF_TWIM1)
void SPIM1_SPIS1_TWIM1_TWIS1_SPI1_TWI1_IRQHandler(void)
{
Wire.onService();
}
#elif defined(TWIM0_TWIS0_IRQn)
void TWIM0_TWIS0_IRQHandler(void)
{
Wire.onService();
}
#endif
}
#endif

Expand Down