8000 Merge pull request #5095 from dhalbert/raytac_mdbt50q-rx · tannewt/circuitpython@4bcf0d4 · GitHub
[go: up one dir, main page]

Skip to content

Commit 4bcf0d4

Browse files
authored
Merge pull request micropython#5095 from dhalbert/raytac_mdbt50q-rx
Add raytac_mdbt50q-rx
2 parents 3ec3e70 + 8183303 commit 4bcf0d4

File tree

8 files changed

+100
-2
lines changed

8 files changed

+100
-2
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -345,6 +345,7 @@ jobs:
345345
- "qtpy_m0_haxpress"
346346
- "raspberry_pi_pico"
347347
- "raytac_mdbt50q-db-40"
348+
- "raytac_mdbt50q-rx"
348349
- "robohatmm1_m4"
349350
- "sam32"
350351
- "same54_xplained"

ports/nrf/boards/raytac_mdbt50q-db-40/mpconfigboard.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,3 +28,4 @@
2828
#define MICROPY_HW_MCU_NAME "nRF52840"
2929

3030
#define MICROPY_HW_LED_STATUS (&pin_P0_13)
31+
#define MICROPY_HW_LED_STATUS_INVERTED (1)

ports/nrf/boards/raytac_mdbt50q-db-40/pins.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
6666
{ MP_ROM_QSTR(MP_QSTR_CTS), MP_ROM_PTR(&pin_P0_07) },
6767
{ MP_ROM_QSTR(MP_QSTR_RTS), MP_ROM_PTR(&pin_P0_05) },
6868

69+
// Note that these are inverted; you must pull them low to turn on the LEDs.
6970
{ MP_ROM_QSTR(MP_QSTR_LED_R), MP_ROM_PTR(&pin_P0_14) },
7071
{ MP_ROM_QSTR(MP_QSTR_LED_G), MP_ROM_PTR(&pin_P0_13) },
7172
{ MP_ROM_QSTR(MP_QSTR_LED_B), MP_ROM_PTR(&pin_P0_15) },
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2017 Scott Shawcroft for Adafruit Industries
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#include "supervisor/board.h"
28+
29+
void board_init(void) {
30+
}
31+
32+
bool board_requests_safe_mode(void) {
33+
return false;
34+
}
35+
36+
void reset_board(void) {
37+
38+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
/*
2+
* This file is part of the MicroPython project, http://micropython.org/
3+
*
4+
* The MIT License (MIT)
5+
*
6+
* Copyright (c) 2016 Glenn Ruben Bakke
7+
*
8+
* Permission is hereby granted, free of charge, to any person obtaining a copy
9+
* of this software and associated documentation files (the "Software"), to deal
10+
* in the Software without restriction, including without limitation the rights
11+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
12+
* copies of the Software, and to permit persons to whom the Software is
13+
* furnished to do so, subject to the following conditions:
14+
*
15+
* The above copyright notice and this permission notice shall be included in
16+
* all copies or substantial portions of the Software.
17+
*
18+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
19+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
20+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
21+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
22+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
23+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24+
* THE SOFTWARE.
25+
*/
26+
27+
#define MICROPY_HW_BOARD_NAME "MDBT50Q-RX Dongle"
28+
#define MICROPY_HW_MCU_NAME "nRF52840"
29+
30+
#define MICROPY_HW_LED_STATUS (&pin_P1_13)
31+
#define MICROPY_HW_LED_STATUS_INVERTED (1)
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
USB_VID = 0x239A
2+
USB_PID = 0x810C
3+
USB_PRODUCT = "MDBT50Q-RX Dongle"
4+
USB_MANUFACTURER = "Raytac Corporation"
5+
6+
MCU_CHIP = nrf52840
7+
8+
INTERNAL_FLASH_FILESYSTEM = 1
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#include "shared-bindings/board/__init__.h"
2+
3+
STATIC const mp_rom_map_elem_t board_module_globals_table[] = {
4+
{ MP_ROM_QSTR(MP_QSTR_P0_15), MP_ROM_PTR(&pin_P0_15) },
5+
{ MP_ROM_QSTR(MP_QSTR_BUTTON), MP_ROM_PTR(&pin_P0_15) },
6+
7+
{ MP_ROM_QSTR(MP_QSTR_P1_13), MP_ROM_PTR(&pin_P1_13) },
8+
{ MP_ROM_QSTR(MP_QSTR_INVERTED_LED), MP_ROM_PTR(&pin_P1_13) },
9+
};
10+
11+
MP_DEFINE_CONST_DICT(board_module_globals, board_module_globals_table);

supervisor/shared/status_leds.c

Lines changed: 9 additions & 2 deletions
F172
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,11 @@ uint16_t status_rgb_color[3] = {
101101
digitalio_digitalinout_obj_t single_color_led;
102102

103103
uint8_t rgb_status_brightness = 0xff;
104+
105+
#ifndef MICROPY_HW_LED_STATUS_INVERTED
106+
#define MICROPY_HW_LED_STATUS_INVERTED (0)
107+
#endif
108+
104109
#endif
105110

106111
#if CIRCUITPY_DIGITALIO && (defined(MICROPY_HW_LED_RX) || defined(MICROPY_HW_LED_TX))
@@ -189,7 +194,8 @@ void status_led_init() {
189194

190195
#elif defined(MICROPY_HW_LED_STATUS)
191196
common_hal_digitalio_digitalinout_construct(&single_color_led, MICROPY_HW_LED_STATUS);
192-
common_hal_digitalio_digitalinout_switch_to_output(&single_color_led, true, DRIVE_MODE_PUSH_PULL);
197+
common_hal_digitalio_digitalinout_switch_to_output(
198+
&single_color_led, MICROPY_HW_LED_STATUS_INVERTED == 0, DRIVE_MODE_PUSH_PULL);
193199
#endif
194200

195201
#if CIRCUITPY_DIGITALIO && CIRCUITPY_STATUS_LED
@@ -282,7 +288,8 @@ void new_status_color(uint32_t rgb) {
282288
common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_g, status_rgb_color[1]);
283289
common_hal_pwmio_pwmout_set_duty_cycle(&rgb_status_b, status_rgb_color[2]);
284290
#elif CIRCUITPY_DIGITALIO && defined(MICROPY_HW_LED_STATUS)
285-
common_hal_digitalio_digitalinout_set_value(&single_color_led, rgb_adjusted > 0);
291+
common_hal_digitalio_digitalinout_set_value(
292+
&single_color_led, (rgb_adjusted > 0) ^ MICROPY_HW_LED_STATUS_INVERTED);
286293
#endif
287294
}
288295

0 commit comments

Comments
 (0)
0