|
| 1 | +/** |
| 2 | + * @file microbit.c |
| 3 | + * @brief board ID for the BBC Microbit board |
| 4 | + * |
| 5 | + * DAPLink Interface Firmware |
| 6 | + * Copyright (c) 2009-2019, ARM Limited, All Rights Reserved |
| 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 | +#include "fsl_device_registers.h" |
| 22 | +#include "IO_Config.h" |
| 23 | +#include "DAP.h" |
| 24 | +#include "target_family.h" |
| 25 | +#include "target_board.h" |
| 26 | + |
| 27 | +const char *const board_id_artemis_dk_v10 = "A127"; |
| 28 | + |
| 29 | +typedef enum |
| 30 | +{ |
| 31 | + BOARD_VERSION_v10 = 0, |
| 32 | +} artemis_dk_version_t; |
| 33 | + |
| 34 | +static void set_board_id(artemis_dk_version_t board_version) |
| 35 | +{ |
| 36 | + switch (board_version) |
| 37 | + { |
| 38 | + case BOARD_VERSION_v10: |
| 39 | + target_device.rt_board_id = board_id_artemis_dk_v10; |
| 40 | + break; |
| 41 | + default: |
| 42 | + target_device.rt_board_id = board_id_artemis_dk_v10; |
| 43 | + break; |
| 44 | + } |
| 45 | +} |
| 46 | + |
| 47 | +// Called in main_task() to init before USB and files are configured |
| 48 | +static void prerun_board_config(void) |
| 49 | +{ |
| 50 | + // in the future you could auto-detect board version here |
| 51 | + artemis_dk_version_t board_version = (artemis_dk_version_t)BOARD_VERSION_v10; |
| 52 | + set_board_id(board_version); |
| 53 | +} |
| 54 | + |
| 55 | +// USB HID override function return 1 if the activity is trivial or response is null |
| 56 | +uint8_t usbd_hid_no_activity(uint8_t *buf) |
| 57 | +{ |
| 58 | + if (buf[0] == ID_DAP_Vendor3 && buf[1] == 0) |
| 59 | + return 1; |
| 60 | + else |
| 61 | + return 0; |
| 62 | +} |
| 63 | + |
| 64 | +const board_info_t g_board_info = { |
| 65 | + .info_version = 0x1, |
| 66 | + .family_id = kAmbiq_ama3b1kk_FamilyID, |
| 67 | + .daplink_url_name = "ARTEMIS_HTM", |
| 68 | + .daplink_drive_name = "ARTEMIS ", |
| 69 | + .daplink_target_url = "https://www.sparkfun.com/artemis", |
| 70 | + .prerun_board_config = prerun_board_config, |
| 71 | + .target_cfg = &target_device, |
| 72 | +}; |
0 commit comments