5.2.1 - Updated I2C files
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
TESTS/mbedmicro-mbed/attributes/attributes.c@1:f30bdcd2b33b, 2017-02-27 (annotated)
- Committer:
- jacobjohnson
- Date:
- Mon Feb 27 17:45:05 2017 +0000
- Revision:
- 1:f30bdcd2b33b
- Parent:
- 0:098463de4c5d
changed the inputscale from 1 to 7 in analogin_api.c. This will need to be changed later, and accessed from the main level, but for now this allows the adc to read a value from 0 to 3.7V, instead of just up to 1V.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-onsemi | 0:098463de4c5d | 1 | #include "toolchain.h" |
group-onsemi | 0:098463de4c5d | 2 | |
group-onsemi | 0:098463de4c5d | 3 | #include <stdio.h> |
group-onsemi | 0:098463de4c5d | 4 | #include <stdint.h> |
group-onsemi | 0:098463de4c5d | 5 | |
group-onsemi | 0:098463de4c5d | 6 | |
group-onsemi | 0:098463de4c5d | 7 | MBED_PACKED(struct) TestAttrPackedStruct1 { |
group-onsemi | 0:098463de4c5d | 8 | char a; |
group-onsemi | 0:098463de4c5d | 9 | int x; |
group-onsemi | 0:098463de4c5d | 10 | }; |
group-onsemi | 0:098463de4c5d | 11 | |
group-onsemi | 0:098463de4c5d | 12 | typedef MBED_PACKED(struct) { |
group-onsemi | 0:098463de4c5d | 13 | char a; |
group-onsemi | 0:098463de4c5d | 14 | int x; |
group-onsemi | 0:098463de4c5d | 15 | } TestAttrPackedStruct2; |
group-onsemi | 0:098463de4c5d | 16 | |
group-onsemi | 0:098463de4c5d | 17 | int testPacked() { |
group-onsemi | 0:098463de4c5d | 18 | int failed = 0; |
group-onsemi | 0:098463de4c5d | 19 | |
group-onsemi | 0:098463de4c5d | 20 | if (sizeof(struct TestAttrPackedStruct1) != sizeof(int) + sizeof(char)) { |
group-onsemi | 0:098463de4c5d | 21 | failed++; |
group-onsemi | 0:098463de4c5d | 22 | } |
group-onsemi | 0:098463de4c5d | 23 | |
group-onsemi | 0:098463de4c5d | 24 | if (sizeof(TestAttrPackedStruct2) != sizeof(int) + sizeof(char)) { |
group-onsemi | 0:098463de4c5d | 25 | failed++; |
group-onsemi | 0:098463de4c5d | 26 | } |
group-onsemi | 0:098463de4c5d | 27 | |
group-onsemi | 0:098463de4c5d | 28 | return failed; |
group-onsemi | 0:098463de4c5d | 29 | } |
group-onsemi | 0:098463de4c5d | 30 | |
group-onsemi | 0:098463de4c5d | 31 | |
group-onsemi | 0:098463de4c5d | 32 | MBED_ALIGN(8) char a; |
group-onsemi | 0:098463de4c5d | 33 | MBED_ALIGN(8) char b; |
group-onsemi | 0:098463de4c5d | 34 | MBED_ALIGN(16) char c; |
group-onsemi | 0:098463de4c5d | 35 | MBED_ALIGN(8) char d; |
group-onsemi | 0:098463de4c5d | 36 | MBED_ALIGN(16) char e; |
group-onsemi | 0:098463de4c5d | 37 | |
group-onsemi | 0:098463de4c5d | 38 | int testAlign() { |
group-onsemi | 0:098463de4c5d | 39 | int failed = 0; |
group-onsemi | 0:098463de4c5d | 40 | |
group-onsemi | 0:098463de4c5d | 41 | if(((uintptr_t)&a) & 0x7){ |
group-onsemi | 0:098463de4c5d | 42 | failed++; |
group-onsemi | 0:098463de4c5d | 43 | } |
group-onsemi | 0:098463de4c5d | 44 | if(((uintptr_t)&b) & 0x7){ |
group-onsemi | 0:098463de4c5d | 45 | failed++; |
group-onsemi | 0:098463de4c5d | 46 | } |
group-onsemi | 0:098463de4c5d | 47 | if(((uintptr_t)&c) & 0xf){ |
group-onsemi | 0:098463de4c5d | 48 | failed++; |
group-onsemi | 0:098463de4c5d | 49 | } |
group-onsemi | 0:098463de4c5d | 50 | if(((uintptr_t)&d) & 0x7){ |
group-onsemi | 0:098463de4c5d | 51 | failed++; |
group-onsemi | 0:098463de4c5d | 52 | } |
group-onsemi | 0:098463de4c5d | 53 | if(((uintptr_t)&e) & 0xf){ |
group-onsemi | 0:098463de4c5d | 54 | failed++; |
group-onsemi | 0:098463de4c5d | 55 | } |
group-onsemi | 0:098463de4c5d | 56 | |
group-onsemi | 0:098463de4c5d | 57 | return failed; |
group-onsemi | 0:098463de4c5d | 58 | } |
group-onsemi | 0:098463de4c5d | 59 | |
group-onsemi | 0:098463de4c5d | 60 | |
group-onsemi | 0:098463de4c5d | 61 | int testUnused1(MBED_UNUSED int arg) { |
group-onsemi | 0:098463de4c5d | 62 | return 0; |
group-onsemi | 0:098463de4c5d | 63 | } |
group-onsemi | 0:098463de4c5d | 64 | |
group-onsemi | 0:098463de4c5d | 65 | int testUnused() { |
group-onsemi | 0:098463de4c5d | 66 | return testUnused1(0); |
group-onsemi | 0:098463de4c5d | 67 | } |
group-onsemi | 0:098463de4c5d | 68 | |
group-onsemi | 0:098463de4c5d | 69 | |
group-onsemi | 0:098463de4c5d | 70 | int testWeak1(); |
group-onsemi | 0:098463de4c5d | 71 | int testWeak2(); |
group-onsemi | 0:098463de4c5d | 72 | |
group-onsemi | 0:098463de4c5d | 73 | MBED_WEAK int testWeak1() { |
group-onsemi | 0:098463de4c5d | 74 | return 1; |
group-onsemi | 0:098463de4c5d | 75 | } |
group-onsemi | 0:098463de4c5d | 76 | |
group-onsemi | 0:098463de4c5d | 77 | int testWeak2() { |
group-onsemi | 0:098463de4c5d | 78 | return 0; |
group-onsemi | 0:098463de4c5d | 79 | } |
group-onsemi | 0:098463de4c5d | 80 | |
group-onsemi | 0:098463de4c5d | 81 | int testWeak() { |
group-onsemi | 0:098463de4c5d | 82 | return testWeak1() | testWeak2(); |
group-onsemi | 0:098463de4c5d | 83 | } |
group-onsemi | 0:098463de4c5d | 84 | |
group-onsemi | 0:098463de4c5d | 85 | |
group-onsemi | 0:098463de4c5d | 86 | MBED_PURE int testPure1() { |
group-onsemi | 0:098463de4c5d | 87 | return 0; |
group-onsemi | 0:098463de4c5d | 88 | } |
group-onsemi | 0:098463de4c5d | 89 | |
group-onsemi | 0:098463de4c5d | 90 | int testPure() { |
group-onsemi | 0:098463de4c5d | 91 | return testPure1(); |
group-onsemi | 0:098463de4c5d | 92 | } |
group-onsemi | 0:098463de4c5d | 93 | |
group-onsemi | 0:098463de4c5d | 94 | |
group-onsemi | 0:098463de4c5d | 95 | MBED_FORCEINLINE int testForceInline1() { |
group-onsemi | 0:098463de4c5d | 96 | return 0; |
group-onsemi | 0:098463de4c5d | 97 | } |
group-onsemi | 0:098463de4c5d | 98 | |
group-onsemi | 0:098463de4c5d | 99 | int testForceInline() { |
group-onsemi | 0:098463de4c5d | 100 | return testForceInline1(); |
group-onsemi | 0:098463de4c5d | 101 | } |
group-onsemi | 0:098463de4c5d | 102 | |
group-onsemi | 0:098463de4c5d | 103 | |
group-onsemi | 0:098463de4c5d | 104 | MBED_NORETURN int testNoReturn1() { |
group-onsemi | 0:098463de4c5d | 105 | while (1) {} |
group-onsemi | 0:098463de4c5d | 106 | } |
group-onsemi | 0:098463de4c5d | 107 | |
group-onsemi | 0:098463de4c5d | 108 | int testNoReturn() { |
group-onsemi | 0:098463de4c5d | 109 | if (0) { |
group-onsemi | 0:098463de4c5d | 110 | testNoReturn1(); |
group-onsemi | 0:098463de4c5d | 111 | } |
group-onsemi | 0:098463de4c5d | 112 | return 0; |
group-onsemi | 0:098463de4c5d | 113 | } |
group-onsemi | 0:098463de4c5d | 114 | |
group-onsemi | 0:098463de4c5d | 115 | |
group-onsemi | 0:098463de4c5d | 116 | int testUnreachable1(int i) { |
group-onsemi | 0:098463de4c5d | 117 | switch (i) { |
group-onsemi | 0:098463de4c5d | 118 | case 0: |
group-onsemi | 0:098463de4c5d | 119 | return 0; |
group-onsemi | 0:098463de4c5d | 120 | } |
group-onsemi | 0:098463de4c5d | 121 | |
group-onsemi | 0:098463de4c5d | 122 | MBED_UNREACHABLE; |
group-onsemi | 0:098463de4c5d | 123 | } |
group-onsemi | 0:098463de4c5d | 124 | |
group-onsemi | 0:098463de4c5d | 125 | int testUnreachable() { |
group-onsemi | 0:098463de4c5d | 126 | return testUnreachable1(0); |
group-onsemi | 0:098463de4c5d | 127 | } |
group-onsemi | 0:098463de4c5d | 128 | |
group-onsemi | 0:098463de4c5d | 129 | |
group-onsemi | 0:098463de4c5d | 130 | MBED_DEPRECATED("this message should not be displayed") |
group-onsemi | 0:098463de4c5d | 131 | void testDeprecatedUnused(); |
group-onsemi | 0:098463de4c5d | 132 | void testDeprecatedUnused() { } |
group-onsemi | 0:098463de4c5d | 133 | |
group-onsemi | 0:098463de4c5d | 134 | MBED_DEPRECATED("this message should be displayed") |
group-onsemi | 0:098463de4c5d | 135 | int testDeprecatedUsed(); |
group-onsemi | 0:098463de4c5d | 136 | int testDeprecatedUsed() { |
group-onsemi | 0:098463de4c5d | 137 | return 0; |
group-onsemi | 0:098463de4c5d | 138 | } |
group-onsemi | 0:098463de4c5d | 139 | |
group-onsemi | 0:098463de4c5d | 140 | MBED_DEPRECATED_SINCE("mbed-os-3.14", "this message should not be displayed") |
group-onsemi | 0:098463de4c5d | 141 | void testDeprecatedSinceUnused(); |
group-onsemi | 0:098463de4c5d | 142 | void testDeprecatedSinceUnused() { } |
group-onsemi | 0:098463de4c5d | 143 | |
group-onsemi | 0:098463de4c5d | 144 | MBED_DEPRECATED_SINCE("mbed-os-3.14", "this message should be displayed") |
group-onsemi | 0:098463de4c5d | 145 | int testDeprecatedSinceUsed(); |
group-onsemi | 0:098463de4c5d | 146 | int testDeprecatedSinceUsed() { |
group-onsemi | 0:098463de4c5d | 147 | return 0; |
group-onsemi | 0:098463de4c5d | 148 | } |
group-onsemi | 0:098463de4c5d | 149 | |
group-onsemi | 0:098463de4c5d | 150 | int testDeprecated() { |
group-onsemi | 0:098463de4c5d | 151 | return testDeprecatedUsed() + testDeprecatedSinceUsed(); |
group-onsemi | 0:098463de4c5d | 152 | } |
group-onsemi | 0:098463de4c5d | 153 |