Skip to content

Commit 887b9a2

Browse files
committed
2.1.2
1 parent 971feed commit 887b9a2

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

lesson-12/stm32c031-keil/main.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
// D12 (longer leg) on the CN9 connector
99
#define LD5_PIN 6U
1010

11-
typedef struct {
11+
typedef struct /* __attribute__((packed)) */ {
1212
uint8_t y;
1313
uint16_t x;
1414
} Point;

lesson-12/tm4c123-iar/main.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#include <stdint.h> // C99 standard integers
2-
3-
#include "tm4c_cmsis.h"
1+
#include "tm4c_cmsis.h" // CMSIS-compatible interface
42
#include "delay.h"
53

4+
#include <stdint.h> // C99 standard integers
5+
66
#define LED_RED (1U << 1)
77
#define LED_BLUE (1U << 2)
88
#define LED_GREEN (1U << 3)
99

10-
typedef struct {
10+
typedef struct /* _packed */ {
1111
uint8_t y;
1212
uint16_t x;
1313
} Point;
@@ -68,7 +68,7 @@ int main(void) {
6868

6969
GPIOF_AHB->DATA_Bits[LED_RED] = 0;
7070

71-
delay(500000);
71+
delay(250000);
7272
}
7373
//return 0; // unreachable code
7474
}

lesson-12/tm4c123-keil/main.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
#include <stdint.h> // C99 standard integers
2-
3-
#include "tm4c_cmsis.h"
1+
#include "tm4c_cmsis.h" // CMSIS-compatible interface
42
#include "delay.h"
53

4+
#include <stdint.h> // C99 standard integers
5+
66
#define LED_RED (1U << 1)
77
#define LED_BLUE (1U << 2)
88
#define LED_GREEN (1U << 3)
99

10-
typedef struct {
10+
typedef struct /* __attribute__((packed)) */ {
1111
uint8_t y;
1212
uint16_t x;
1313
} Point;
@@ -68,7 +68,7 @@ int main(void) {
6868

6969
GPIOF_AHB->DATA_Bits[LED_RED] = 0;
7070

71-
delay(500000);
71+
delay(250000);
7272
}
7373
//return 0; // unreachable code
7474
}

0 commit comments

Comments
 (0)