Skip to content

Commit c455793

Browse files
authored
Merge pull request #905 from microbit-foundation/feature/nrf52820_microbitv2
Add nrf52820_microbit_if and nrf52820_microbit_bl
2 parents 8df64c3 + d0d9a71 commit c455793

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

61 files changed

+4824
-557
lines changed

projects.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,14 @@ projects:
511511
- *module_if
512512
- *module_hic_max32625
513513
- records/board/max78000fthr.yaml
514+
nrf52820_microbit_bl:
515+
- *module_bl
516+
- records/hic_hal/nrf52820.yaml
517+
- records/board/nrf52820_microbit_bl.yaml
518+
nrf52820_microbit_if:
519+
- *module_if
520+
- *module_hic_nrf52820
521+
- records/board/microbitv2_nrf52820.yaml
514522
sam3u2c_mkit_dk_dongle_nrf5x_if:
515523
- *module_if
516524
- *module_hic_sam3u2c

records/board/microbitv2.yaml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,12 @@ common:
1010
- BOARD_USB_BMAXPOWER=0x96
1111
- BOARD_EXTRA_BUFFER=100
1212
includes:
13-
- source/board/microbitv2
13+
- source/board/microbitv2/
14+
- source/board/microbitv2/kl27z/
1415
sources:
1516
board:
1617
- source/board/microbitv2/
18+
- source/board/microbitv2/kl27z/
1719
target:
1820
- source/family/nordic/nrf52/target.c
1921
- source/family/nordic/target_reset_nrf52.c
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
common:
2+
macros:
3+
- HID_LED_DEF=GPIO_LED_ON
4+
- CDC_LED_DEF=GPIO_LED_ON
5+
- MSC_LED_DEF=GPIO_LED_ON
6+
- USB_PROD_STR="BBC micro:bit CMSIS-DAP"
7+
# - DELAY_FAST_CYCLES=2U # Fast delay needed to reach 8MHz SWD clock speed
8+
# - DAP_DEFAULT_SWJ_CLOCK=8000000
9+
- BOARD_EXTRA_BUFFER=100
10+
- CDC_ACM_DEFAULT_BAUDRATE=115200
11+
includes:
12+
- source/board/microbitv2/
13+
- source/board/microbitv2/nrf52820/
14+
sources:
15+
board:
16+
- source/board/microbitv2/
17+
- source/board/microbitv2/nrf52820/
18+
target:
19+
- source/family/nordic/nrf52/target.c
20+
- source/family/nordic/target_reset_nrf52.c
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
common:
2+
sources:
3+
board:
4+
- source/board/nrf52820_microbit_bl.c
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
/**
2+
* @file gpio_extra.h
3+
* @brief
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright 2021 Micro:bit Educational Foundation
7+
* SPDX-License-Identifier: Apache-2.0
8+
*
9+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
10+
* not use this file except in compliance with the License.
11+
* You may obtain a copy of the License at
12+
*
13+
* http://www.apache.org/licenses/LICENSE-2.0
14+
*
15+
* Unless required by applicable law or agreed to in writing, software
16+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
17+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
* See the License for the specific language governing permissions and
19+
* limitations under the License.
20+
*/
21+
22+
#ifndef GPIO_EXTRA_H
23+
#define GPIO_EXTRA_H
24+
25+
#include "gpio.h"
26+
27+
#ifdef __cplusplus
28+
extern "C" {
29+
#endif
30+
31+
void gpio_enable_hid_led(void);
32+
void gpio_disable_hid_led(void);
33+
34+
void gpio_init_combined_int(void);
35+
void gpio_disable_combined_int(void);
36+
void gpio_assert_combined_int(void);
37+
38+
#ifdef __cplusplus
39+
}
40+
#endif
41+
42+
#endif

source/board/microbitv2/i2c.h

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
/**
2+
* @file i2c.h
3+
* @brief
4+
*
5+
* DAPLink Interface Firmware
6+
* Copyright 2020 NXP
7+
* Copyright 2021 Micro:bit Educational Foundation
8+
* SPDX-License-Identifier: Apache-2.0
9+
*
10+
* Licensed under the Apache License, Version 2.0 (the "License"); you may
11+
* not use this file except in compliance with the License.
12+
* You may obtain a copy of the License at
13+
*
14+
* http://www.apache.org/licenses/LICENSE-2.0
15+
*
16+
* Unless required by applicable law or agreed to in writing, software
17+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
18+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
19+
* See the License for the specific language governing permissions and
20+
* limitations under the License.
21+
*/
22+
23+
#ifndef I2C_H_
24+
#define I2C_H_
25+
26+
#include <stdint.h>
27+
#include <stdbool.h>
28+
29+
/*! i2c Read/Write Callback prototype */
30+
typedef void (*i2cCallback_t)
31+
(
32+
uint8_t* pData,
33+
uint8_t size
34+
);
35+
36+
typedef enum {
37+
I2C_STATUS_SUCCESS = 0,
38+
I2C_STATUS_FAIL
39+
} i2c_status_t;
40+
41+
/* TX and RX buffer size */
42+
#define I2C_DATA_LENGTH (1024U + 8U)
43+
44+
void i2c_initialize(void);
45+
void i2c_deinitialize(void);
46+
i2c_status_t i2c_registerWriteCallback(i2cCallback_t writeCallback, uint8_t slaveAddress);
47+
i2c_status_t i2c_registerReadCallback(i2cCallback_t readCallback, uint8_t slaveAddress);
48+
void i2c_clearBuffers(void);
49+
void i2c_fillBuffer(uint8_t* data, uint32_t position, uint32_t size);
50+
bool i2c_isBusy(void);
51+
bool i2c_canSleep(void);
52+
53+
#endif /* I2C_H_ */

0 commit comments

Comments
 (0)