summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Halbert <halbert@halwitz.org>2018-09-01 00:29:36 -0400
committerDan Halbert <halbert@halwitz.org>2018-09-01 00:29:36 -0400
commit4382389e6f7b5f5f05ac1b8f87fd482fdfa12d16 (patch)
tree44bccd156730ee9b743931fb9e768bc373173128
parent9ea809bef73e6862103cd71802803122e97bf80b (diff)
fix typos, remove incorrect pca10059 example; add default buses for pca10056; improve board names for pca boards
-rw-r--r--conf.py2
-rw-r--r--ports/nrf/boards/feather_nrf52832/pins.c2
-rw-r--r--ports/nrf/boards/pca10040/mpconfigboard.h5
-rw-r--r--ports/nrf/boards/pca10056/mpconfigboard.h12
-rw-r--r--ports/nrf/boards/pca10059/examples/buttons.py26
-rw-r--r--ports/nrf/boards/pca10059/mpconfigboard.h2
-rw-r--r--ports/nrf/common-hal/microcontroller/__init__.c1
-rw-r--r--ports/nrf/peripherals/nrf/pins.h2
8 files changed, 17 insertions, 35 deletions
diff --git a/conf.py b/conf.py
index 8a7d49a43..0f363923f 100644
--- a/conf.py
+++ b/conf.py
@@ -115,9 +115,9 @@ exclude_patterns = ["**/build*",
"ports/minimal",
"ports/nrf/device",
"ports/nrf/drivers",
- "ports/nrf/hal",
"ports/nrf/modules",
"ports/nrf/nrfx",
+ "ports/nrf/peripherals",
"ports/nrf/usb",
"ports/pic16bit",
"ports/qemu-arm",
diff --git a/ports/nrf/boards/feather_nrf52832/pins.c b/ports/nrf/boards/feather_nrf52832/pins.c
index b14b944e8..f4d5023e1 100644
--- a/ports/nrf/boards/feather_nrf52832/pins.c
+++ b/ports/nrf/boards/feather_nrf52832/pins.c
@@ -22,7 +22,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_NFC1), MP_ROM_PTR(&pin_P0_09) },
{ MP_ROM_QSTR(MP_QSTR_NFC2), MP_ROM_PTR(&pin_P0_10) },
- { MP_ROM_QSTR(MP_QSTR_27), MP_ROM_PTR(&pin_P0_27) },
+ { MP_ROM_QSTR(MP_QSTR_D27), MP_ROM_PTR(&pin_P0_27) },
{ MP_ROM_QSTR(MP_QSTR_D30), MP_ROM_PTR(&pin_P0_30) },
{ MP_ROM_QSTR(MP_QSTR_A6), MP_ROM_PTR(&pin_P0_30) },
diff --git a/ports/nrf/boards/pca10040/mpconfigboard.h b/ports/nrf/boards/pca10040/mpconfigboard.h
index 40035e2ca..ebf808ce2 100644
--- a/ports/nrf/boards/pca10040/mpconfigboard.h
+++ b/ports/nrf/boards/pca10040/mpconfigboard.h
@@ -4,6 +4,7 @@
* The MIT License (MIT)
*
* Copyright (c) 2016 Glenn Ruben Bakke
+ * Copyright (c) 2018 Dan Halbert for Adafruit Industries
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
@@ -28,8 +29,8 @@
#define MICROPY_HW_MCU_NAME "nRF52832"
#define MICROPY_PY_SYS_PLATFORM "nRF52-DK"
-#define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 11)
-#define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 12)
+#define MICROPY_HW_UART_RX NRF_GPIO_PIN_MAP(0, 8)
+#define MICROPY_HW_UART_TX NRF_GPIO_PIN_MAP(0, 6)
#define MICROPY_HW_UART_HWFC (0)
#define PORT_HEAP_SIZE (32 * 1024)
diff --git a/ports/nrf/boards/pca10056/mpconfigboard.h b/ports/nrf/boards/pca10056/mpconfigboard.h
index dbd422663..de4545d62 100644
--- a/ports/nrf/boards/pca10056/mpconfigboard.h
+++ b/ports/nrf/boards/pca10056/mpconfigboard.h
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#define MICROPY_HW_BOARD_NAME "PCA10056"
+#define MICROPY_HW_BOARD_NAME "PCA10056 nRF52840-DK"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_PY_SYS_PLATFORM "nRF52840-DK"
@@ -38,3 +38,13 @@
// Temp (could be removed) 0: usb cdc (default), 1 : hwuart (jlink)
#define CFG_HWUART_FOR_SERIAL 0
+
+#define DEFAULT_I2C_BUS_SCL (&pin_P0_27)
+#define DEFAULT_I2C_BUS_SDA (&pin_P0_26)
+
+#define DEFAULT_SPI_BUS_SCK (&pin_P1_15)
+#define DEFAULT_SPI_BUS_MOSI (&pin_P1_13)
+#define DEFAULT_SPI_BUS_MISO (&pin_P1_14)
+
+#define DEFAULT_UART_BUS_RX (&pin_P1_01)
+#define DEFAULT_UART_BUS_TX (&pin_P1_02)
diff --git a/ports/nrf/boards/pca10059/examples/buttons.py b/ports/nrf/boards/pca10059/examples/buttons.py
deleted file mode 100644
index 1a0c5aabb..000000000
--- a/ports/nrf/boards/pca10059/examples/buttons.py
+++ /dev/null
@@ -1,26 +0,0 @@
-import board
-import digitalio
-import gamepad
-import time
-
-pad = gamepad.GamePad(
- digitalio.DigitalInOut(board.P0_11),
- digitalio.DigitalInOut(board.P0_12),
- digitalio.DigitalInOut(board.P0_24),
- digitalio.DigitalInOut(board.P0_25),
-)
-
-prev_buttons = 0
-
-while True:
- buttons = pad.get_pressed()
-
- if buttons != prev_buttons:
- for i in range(0, 4):
- bit = (1 << i)
- if (buttons & bit) != (prev_buttons & bit):
- print('Button %d %s' % (i + 1, 'pressed' if buttons & bit else 'released'))
-
- prev_buttons = buttons
-
- time.sleep(0.1)
diff --git a/ports/nrf/boards/pca10059/mpconfigboard.h b/ports/nrf/boards/pca10059/mpconfigboard.h
index bca61fd0f..b248011ec 100644
--- a/ports/nrf/boards/pca10059/mpconfigboard.h
+++ b/ports/nrf/boards/pca10059/mpconfigboard.h
@@ -24,7 +24,7 @@
* THE SOFTWARE.
*/
-#define MICROPY_HW_BOARD_NAME "PCA10059"
+#define MICROPY_HW_BOARD_NAME "PCA10059 nRF52840 Dongle"
#define MICROPY_HW_MCU_NAME "nRF52840"
#define MICROPY_PY_SYS_PLATFORM "nRF52840-DK"
diff --git a/ports/nrf/common-hal/microcontroller/__init__.c b/ports/nrf/common-hal/microcontroller/__init__.c
index 46fe1e190..c2e0c5b41 100644
--- a/ports/nrf/common-hal/microcontroller/__init__.c
+++ b/ports/nrf/common-hal/microcontroller/__init__.c
@@ -79,7 +79,6 @@ STATIC const mp_rom_map_elem_t mcu_pin_globals_table[] = {
{ MP_ROM_QSTR(MP_QSTR_P0_11), MP_ROM_PTR(&pin_P0_11) },
{ MP_ROM_QSTR(MP_QSTR_P0_12), MP_ROM_PTR(&pin_P0_12) },
{ MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) },
- { MP_ROM_QSTR(MP_QSTR_P0_13), MP_ROM_PTR(&pin_P0_13) },
{ MP_ROM_QSTR(MP_QSTR_P0_14), MP_ROM_PTR(&pin_P0_14) },
{ MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) },
{ MP_ROM_QSTR(MP_QSTR_P0_16), MP_ROM_PTR(&pin_P0_16) },
diff --git a/ports/nrf/peripherals/nrf/pins.h b/ports/nrf/peripherals/nrf/pins.h
index 1a87c0d88..22ca27457 100644
--- a/ports/nrf/peripherals/nrf/pins.h
+++ b/ports/nrf/peripherals/nrf/pins.h
@@ -67,6 +67,4 @@ extern const mp_obj_type_t mcu_pin_type;
#include "nrf52840/pins.h"
#endif
-//**************extern const mp_obj_type_t mcu_pin_type;
-
#endif // __MICROPY_INCLUDED_NRF_PERIPHERALS_PINS_H__