Ray Liu
/
NuMaker-mbed-NuBrick-example
Modify the file main.cpp for M487
NuMaker-mbed-NuBrick/NuBrickMasterGas.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 "NuBrickMasterGas.h" |
shliu1 | 0:a67fc999dd68 | 17 | |
shliu1 | 0:a67fc999dd68 | 18 | NuBrickMasterGas::NuBrickMasterGas(I2C &i2c, bool debug) : |
shliu1 | 0:a67fc999dd68 | 19 | NuBrickMaster(i2c, NuBrick_I2CAddr_Gas, debug) { |
shliu1 | 0:a67fc999dd68 | 20 | |
shliu1 | 0:a67fc999dd68 | 21 | static const NuBrickField::IndexName gas_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, "gas_AT") |
shliu1 | 0:a67fc999dd68 | 24 | }; |
shliu1 | 0:a67fc999dd68 | 25 | |
shliu1 | 0:a67fc999dd68 | 26 | static const NuBrickField::IndexName gas_input_field_index_name_arr[] = { |
shliu1 | 0:a67fc999dd68 | 27 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex1_Plus1, "gas"), |
shliu1 | 0:a67fc999dd68 | 28 | NuBrickField::IndexName(NuBrick_ReportDesc_FieldIndex2_Plus1, "over_flag") |
shliu1 | 0:a67fc999dd68 | 29 | }; |
shliu1 | 0:a67fc999dd68 | 30 | |
shliu1 | 0:a67fc999dd68 | 31 | // Add fields of feature report |
shliu1 | 0:a67fc999dd68 | 32 | add_feature_fields(gas_feature_field_index_name_arr, |
shliu1 | 0:a67fc999dd68 | 33 | sizeof (gas_feature_field_index_name_arr) / sizeof (gas_feature_field_index_name_arr[0])); |
shliu1 | 0:a67fc999dd68 | 34 | |
shliu1 | 0:a67fc999dd68 | 35 | // Add fields of input report |
shliu1 | 0:a67fc999dd68 | 36 | add_input_fields(gas_input_field_index_name_arr, |
shliu1 | 0:a67fc999dd68 | 37 | sizeof (gas_input_field_index_name_arr) / sizeof (gas_input_field_index_name_arr[0])); |
shliu1 | 0:a67fc999dd68 | 38 | |
shliu1 | 0:a67fc999dd68 | 39 | // Add fields of output report |
shliu1 | 0:a67fc999dd68 | 40 | |
shliu1 | 0:a67fc999dd68 | 41 | // No lock needed in the constructor |
shliu1 | 0:a67fc999dd68 | 42 | |
shliu1 | 0:a67fc999dd68 | 43 | } |