Ray Liu
/
NuMaker-mbed-NuBrick-example
Modify the file main.cpp for M487
NuMaker-mbed-NuBrick/NuBrickMasterIR.cpp@0:a67fc999dd68, 2017-09-29 (annotated)
- Committer:
- shliu1
- Date:
- Fri Sep 29 05:44:02 2017 +0000
- Revision:
- 0:a67fc999dd68
main.cpp adds the setting of TARGET_NUMAKER_PFM_M487 for M487
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
shliu1 | 0:a67fc999dd68 | 1 | /* mbed Microcontroller Library |
shliu1 | 0:a67fc999dd68 | 2 | * Copyright (c) 2016 ARM Limited |
shliu1 | 0:a67fc999dd68 | 3 | * |
shliu1 | 0:a67fc999dd68 | 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
shliu1 | 0:a67fc999dd68 | 5 | * you may not use this file except in compliance with the License. |
shliu1 | 0:a67fc999dd68 | 6 | * You may obtain a copy of the License at |
shliu1 | 0:a67fc999dd68 | 7 | * |
shliu1 | 0:a67fc999dd68 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
shliu1 | 0:a67fc999dd68 | 9 | * |
shliu1 | 0:a67fc999dd68 | 10 | * Unless required by applicable law or agreed to in writing, software |
shliu1 | 0:a67fc999dd68 | 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
shliu1 | 0:a67fc999dd68 | 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
shliu1 | 0:a67fc999dd68 | 13 | * See the License for the specific language governing permissions and |
shliu1 | 0:a67fc999dd68 | 14 | * limitations under the License. |
shliu1 | 0:a67fc999dd68 | 15 | */ |
shliu1 | 0:a67fc999dd68 | 16 | #include "NuBrickMasterIR.h" |
shliu1 | 0:a67fc999dd68 | 17 | |
shliu1 | 0:a67fc999dd68 | 18 | NuBrickMasterIR::NuBrickMasterIR(I2C &i2c, bool debug) : |
shliu1 | 0:a67fc999dd68 | 19 | NuBrickMaster(i2c, NuBrick_I2CAddr_IR, debug) { |
shliu1 | 0:a67fc999dd68 | 20 | |
shliu1 | 0:a67fc999dd68 | 21 | static const NuBrickField::IndexName ir_feature_field_index_name_arr[] = { |
shliu1 | 0:a67fc999dd68 | 22 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex1_Plus1, "sleep_period"), |
shliu1 | 0:a67fc999dd68 | 23 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex2_Plus1, "num_learned_data"), |
shliu1 | 0:a67fc999dd68 | 24 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex3_Plus1, "using_data_type"), |
shliu1 | 0:a67fc999dd68 | 25 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex4_Plus1, "index_orig_data_to_send"), |
shliu1 | 0:a67fc999dd68 | 26 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex5_Plus1, "index_learned_data_to_send") |
shliu1 | 0:a67fc999dd68 | 27 | }; |
shliu1 | 0:a67fc999dd68 | 28 | |
shliu1 | 0:a67fc999dd68 | 29 | static const NuBrickField::IndexName ir_input_field_index_name_arr[] = { |
shliu1 | 0:a67fc999dd68 | 30 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex1_Plus1, "received_data_flag") |
shliu1 | 0:a67fc999dd68 | 31 | }; |
shliu1 | 0:a67fc999dd68 | 32 | |
shliu1 | 0:a67fc999dd68 | 33 | static const NuBrickField::IndexName ir_output_field_index_name_arr[] = { |
shliu1 | 0:a67fc999dd68 | 34 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex1_Plus1, "send_IR_flag"), |
shliu1 | 0:a67fc999dd68 | 35 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex2_Plus1, "learn_IR_flag") |
shliu1 | 0:a67fc999dd68 | 36 | }; |
shliu1 | 0:a67fc999dd68 | 37 | |
shliu1 | 0:a67fc999dd68 | 38 | // Add fields of feature report |
shliu1 | 0:a67fc999dd68 | 39 | add_feature_fields(ir_feature_field_index_name_arr, |
shliu1 | 0:a67fc999dd68 | 40 | sizeof (ir_feature_field_index_name_arr) / sizeof (ir_feature_field_index_name_arr[0])); |
shliu1 | 0:a67fc999dd68 | 41 | |
shliu1 | 0:a67fc999dd68 | 42 | // Add fields of input report |
shliu1 | 0:a67fc999dd68 | 43 | add_input_fields(ir_input_field_index_name_arr, |
shliu1 | 0:a67fc999dd68 | 44 | sizeof (ir_input_field_index_name_arr) / sizeof (ir_input_field_index_name_arr[0])); |
shliu1 | 0:a67fc999dd68 | 45 | |
shliu1 | 0:a67fc999dd68 | 46 | // Add fields of output report |
shliu1 | 0:a67fc999dd68 | 47 | add_output_fields(ir_output_field_index_name_arr, |
shliu1 | 0:a67fc999dd68 | 48 | sizeof (ir_output_field_index_name_arr) / sizeof (ir_output_field_index_name_arr[0])); |
shliu1 | 0:a67fc999dd68 | 49 | |
shliu1 | 0:a67fc999dd68 | 50 | // No lock needed in the constructor |
shliu1 | 0:a67fc999dd68 | 51 | |
shliu1 | 0:a67fc999dd68 | 52 | } |