Modify the file main.cpp for M487

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?

UserRevisionLine numberNew contents of line
shliu1 0:a67fc999dd68 1 /* mbed Microcontroller Library
shliu1 0:a67fc999dd68 2 * Copyright (c) 2015-2016 Nuvoton
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
shliu1 0:a67fc999dd68 17 #ifndef NUBRICK_PROT_H
shliu1 0:a67fc999dd68 18 #define NUBRICK_PROT_H
shliu1 0:a67fc999dd68 19
shliu1 0:a67fc999dd68 20 #include <stdint.h>
shliu1 0:a67fc999dd68 21
shliu1 0:a67fc999dd68 22 #ifdef __cplusplus
shliu1 0:a67fc999dd68 23 extern "C" {
shliu1 0:a67fc999dd68 24 #endif
shliu1 0:a67fc999dd68 25
shliu1 0:a67fc999dd68 26 /** Predefined I2C addresses for NuMaker Brick I2C slave devices
shliu1 0:a67fc999dd68 27 */
shliu1 0:a67fc999dd68 28 enum NuBrick_I2CAddr {
shliu1 0:a67fc999dd68 29 NuBrick_I2CAddr_Buzzer = 0x15 << 1,
shliu1 0:a67fc999dd68 30 NuBrick_I2CAddr_LED = 0x16 << 1,
shliu1 0:a67fc999dd68 31 NuBrick_I2CAddr_AHRS = 0x17 << 1,
shliu1 0:a67fc999dd68 32 NuBrick_I2CAddr_Sonar = 0x18 << 1,
shliu1 0:a67fc999dd68 33 NuBrick_I2CAddr_Temp = 0x19 << 1,
shliu1 0:a67fc999dd68 34 NuBrick_I2CAddr_Gas = 0x1A << 1,
shliu1 0:a67fc999dd68 35 NuBrick_I2CAddr_IR = 0x1B << 1,
shliu1 0:a67fc999dd68 36 NuBrick_I2CAddr_Key = 0x1C << 1,
shliu1 0:a67fc999dd68 37 NuBrick_I2CAddr_Reserved9 = 0x1D << 1,
shliu1 0:a67fc999dd68 38 NuBrick_I2CAddr_Reserved10 = 0x1E << 1,
shliu1 0:a67fc999dd68 39 NuBrick_I2CAddr_Reserved11 = 0x1F << 1,
shliu1 0:a67fc999dd68 40 NuBrick_I2CAddr_Reserved12 = 0x20 << 1,
shliu1 0:a67fc999dd68 41 NuBrick_I2CAddr_Reserved13 = 0x21 << 1,
shliu1 0:a67fc999dd68 42 NuBrick_I2CAddr_Reserved14 = 0x22 << 1,
shliu1 0:a67fc999dd68 43 };
shliu1 0:a67fc999dd68 44
shliu1 0:a67fc999dd68 45 /** NuMaker Brick protocol: command code
shliu1 0:a67fc999dd68 46 */
shliu1 0:a67fc999dd68 47 enum NuBrick_Comm {
shliu1 0:a67fc999dd68 48 NuBrick_Comm_None = 0,
shliu1 0:a67fc999dd68 49 NuBrick_Comm_GetDeviceDesc = 1, // Get device descriptor
shliu1 0:a67fc999dd68 50 NuBrick_Comm_GetReportDesc = 2, // Get report descriptor (feature/input/output)
shliu1 0:a67fc999dd68 51 NuBrick_Comm_GetInputReport = 3, // Get input report
shliu1 0:a67fc999dd68 52 NuBrick_Comm_SetOutputReport = 4, // Set output report
shliu1 0:a67fc999dd68 53 NuBrick_Comm_GetFeatureReport = 5, // Get feature report
shliu1 0:a67fc999dd68 54 NuBrick_Comm_SetFeatureReport = 6, // Set feature report
shliu1 0:a67fc999dd68 55 };
shliu1 0:a67fc999dd68 56
shliu1 0:a67fc999dd68 57 /** NuMaker Brick protocol: descriptor type
shliu1 0:a67fc999dd68 58 */
shliu1 0:a67fc999dd68 59 enum NuBrick_DescType {
shliu1 0:a67fc999dd68 60 NuBrick_DescType_FeatureReport = 257,
shliu1 0:a67fc999dd68 61 NuBrick_DescType_InputReport = 258,
shliu1 0:a67fc999dd68 62 NuBrick_DescType_OutputReport = 259,
shliu1 0:a67fc999dd68 63 };
shliu1 0:a67fc999dd68 64
shliu1 0:a67fc999dd68 65 /** NuMaker Brick protocol: report descriptor
shliu1 0:a67fc999dd68 66 */
shliu1 0:a67fc999dd68 67 enum NuBrick_ReportDesc {
shliu1 0:a67fc999dd68 68 NuBrick_ReportDesc_Min_Plus1 = 9,
shliu1 0:a67fc999dd68 69 NuBrick_ReportDesc_Min_Plus2 = 10,
shliu1 0:a67fc999dd68 70 NuBrick_ReportDesc_Max_Plus1 = 13,
shliu1 0:a67fc999dd68 71 NuBrick_ReportDesc_Max_Plus2 = 14,
shliu1 0:a67fc999dd68 72
shliu1 0:a67fc999dd68 73 NuBrick_ReportDesc_FieldIndex1_Plus1 = 5,
shliu1 0:a67fc999dd68 74 NuBrick_ReportDesc_FieldIndex2_Plus1 = 17,
shliu1 0:a67fc999dd68 75 NuBrick_ReportDesc_FieldIndex3_Plus1 = 29,
shliu1 0:a67fc999dd68 76 NuBrick_ReportDesc_FieldIndex4_Plus1 = 41,
shliu1 0:a67fc999dd68 77 NuBrick_ReportDesc_FieldIndex5_Plus1 = 53,
shliu1 0:a67fc999dd68 78 NuBrick_ReportDesc_FieldIndex6_Plus1 = 65,
shliu1 0:a67fc999dd68 79 NuBrick_ReportDesc_FieldIndex7_Plus1 = 77,
shliu1 0:a67fc999dd68 80 NuBrick_ReportDesc_FieldIndex8_Plus1 = 89,
shliu1 0:a67fc999dd68 81 NuBrick_ReportDesc_FieldIndex9_Plus1 = 101,
shliu1 0:a67fc999dd68 82 NuBrick_ReportDesc_FieldIndex10_Plus1 = 113,
shliu1 0:a67fc999dd68 83 };
shliu1 0:a67fc999dd68 84
shliu1 0:a67fc999dd68 85 enum {
shliu1 0:a67fc999dd68 86 NuBrick_DeviceDesc_Len = 26, // Device descriptor length
shliu1 0:a67fc999dd68 87 };
shliu1 0:a67fc999dd68 88
shliu1 0:a67fc999dd68 89 struct NuBrick_Device_Descriptor {
shliu1 0:a67fc999dd68 90 uint16_t dev_desc_len; // Device descriptor length
shliu1 0:a67fc999dd68 91 uint16_t report_desc_len; // Report descriptor length
shliu1 0:a67fc999dd68 92 uint16_t input_report_len; // Input report length
shliu1 0:a67fc999dd68 93 uint16_t output_report_len; // Output report length
shliu1 0:a67fc999dd68 94 uint16_t getfeat_report_len; // Get feature report length
shliu1 0:a67fc999dd68 95 uint16_t setfeat_report_len; // Set feature report length
shliu1 0:a67fc999dd68 96 uint16_t cid; // Company ID
shliu1 0:a67fc999dd68 97 uint16_t did; // Device ID
shliu1 0:a67fc999dd68 98 uint16_t pid; // Product ID
shliu1 0:a67fc999dd68 99 uint16_t uid; // Product ID
shliu1 0:a67fc999dd68 100 uint16_t ucid; // Product ID
shliu1 0:a67fc999dd68 101 uint16_t reserved1; // Reserved 1
shliu1 0:a67fc999dd68 102 uint16_t reserved2; // Reserved 2
shliu1 0:a67fc999dd68 103 };
shliu1 0:a67fc999dd68 104
shliu1 0:a67fc999dd68 105
shliu1 0:a67fc999dd68 106 #ifdef __cplusplus
shliu1 0:a67fc999dd68 107 }
shliu1 0:a67fc999dd68 108 #endif
shliu1 0:a67fc999dd68 109
shliu1 0:a67fc999dd68 110 #endif