Skip to content

Commit ee17e60

Browse files
committed
update V2.3.1
add locking mechanism to dsPIC porting update blinky_button example
1 parent e83d13d commit ee17e60

19 files changed

+4356
-948
lines changed

sst_c/examples/blinky_button.X/blinky1.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
DBC_MODULE_NAME("blinky1") /* for DBC assertions in this module */
3131

3232
/*..........................................................................*/
33-
typedef struct { /* Blinky task */
33+
typedef struct { /* Blinky1 task */
3434
SST_Task super; /* inherit SST_Task */
3535
SST_TimeEvt te; /* time event for generating TIMEOUT events */
3636
uint16_t toggles; /* number of toggles to perform for TIMEOUT event */
@@ -42,7 +42,7 @@ static void Blinky1_dispatch(Blinky1 * const me, SST_Evt const * const e);
4242

4343
/*..........................................................................*/
4444
static Blinky1 Blinky1_inst; /* the Blinky instance */
45-
SST_Task * AO_Blinky1 = &Blinky1_inst.super; /* opaque AO pointer */
45+
SST_Task * const AO_Blinky1 = &Blinky1_inst.super; /* opaque AO pointer */
4646

4747
void Blinky1_instantiate(void) {
4848
Blinky1_ctor(&Blinky1_inst);
@@ -72,8 +72,11 @@ static void Blinky1_dispatch(Blinky1 * const me, SST_Evt const * const e) {
7272
switch (e->sig) {
7373
case TIMEOUT_SIG: {
7474
for (uint16_t i = me->toggles; i > 0U; --i) {
75+
/* just to exercise SST task scheduler lock... */
76+
SST_LockKey key = SST_Task_lock(3U);
7577
BSP_d5on();
7678
BSP_d5off();
79+
SST_Task_unlock(key);
7780
}
7881
break;
7982
}

sst_c/examples/blinky_button.X/blinky3.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ static void Blinky3_dispatch(Blinky3 * const me, SST_Evt const * const e);
4242

4343
/*..........................................................................*/
4444
static Blinky3 Blinky3_inst; /* the Blinky3 instance */
45-
SST_Task * AO_Blinky3 = &Blinky3_inst.super; /* opaque AO pointer */
45+
SST_Task * const AO_Blinky3 = &Blinky3_inst.super; /* opaque AO pointer */
4646

4747
void Blinky3_instantiate(void) {
4848
Blinky3_ctor(&Blinky3_inst);

sst_c/examples/blinky_button.X/blinky_button.h

+4-4
Original file line numberDiff line numberDiff line change
@@ -51,15 +51,15 @@ typedef struct {
5151
} ButtonWorkEvt;
5252

5353
void Blinky1_instantiate(void);
54-
extern SST_Task * AO_Blinky1; /* opaque task pointer */
54+
extern SST_Task * const AO_Blinky1; /* opaque task pointer */
5555

5656
void Blinky3_instantiate(void);
57-
extern SST_Task * AO_Blinky3; /* opaque task pointer */
57+
extern SST_Task * const AO_Blinky3; /* opaque task pointer */
5858

5959
void Button2a_instantiate(void);
60-
extern SST_Task * AO_Button2a; /* opaque task pointer */
60+
extern SST_Task * const AO_Button2a; /* opaque task pointer */
6161

6262
void Button2b_instantiate(void);
63-
extern SST_Task * AO_Button2b; /* opaque task pointer */
63+
extern SST_Task * const AO_Button2b; /* opaque task pointer */
6464

6565
#endif /* BLINKY_BUTTON_H_ */

sst_c/examples/blinky_button.X/bsp_dspic33ep128gs804.c

-8
Original file line numberDiff line numberDiff line change
@@ -190,14 +190,6 @@ void BSP_init(void) {
190190
SST_Task_setIRQ(AO_Button2a, _PTG2Interrupt_n);
191191
SST_Task_setIRQ(AO_Blinky1, _PTG3Interrupt_n);
192192

193-
194-
/* configure test pins on GPIOA (digital output) */
195-
//gpio_set_direction(GPIOA, TST1_PIN | TST2_PIN | TST6_PIN, GPIO_OUTPUT);
196-
197-
/* configure button on GPIOF (digital input) */
198-
//gpio_set_direction(GPIOA, BTN_SW1, GPIO_INPUT_PU);
199-
/* configure test pins on GPIOD (digital output) */
200-
//gpio_set_direction(GPIOB, TST3_PIN | TST4_PIN | TST5_PIN, GPIO_OUTPUT);
201193

202194
gpio_set_direction(TST1_PORT, TST1_PIN, GPIO_OUTPUT);
203195
gpio_set_direction(TST2_PORT, TST2_PIN, GPIO_OUTPUT);

sst_c/examples/blinky_button.X/button2a.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void Button2a_dispatch(Button2a * const me, SST_Evt const * const e);
4141

4242
/*..........................................................................*/
4343
static Button2a Button2a_inst; /* the Button2a instance */
44-
SST_Task * AO_Button2a = &Button2a_inst.super; /* opaque AO pointer */
44+
SST_Task * const AO_Button2a = &Button2a_inst.super; /* opaque AO pointer */
4545

4646
void Button2a_instantiate(void) {
4747
Button2a_ctor(&Button2a_inst);

sst_c/examples/blinky_button.X/button2b.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ static void Button2b_dispatch(Button2b * const me, SST_Evt const * const e);
4141

4242
/*..........................................................................*/
4343
static Button2b Button2b_inst; /* the Button2b instance */
44-
SST_Task * AO_Button2b = &Button2b_inst.super; /* opaque AO pointer */
44+
SST_Task * const AO_Button2b = &Button2b_inst.super; /* opaque AO pointer */
4545

4646
void Button2b_instantiate(void) {
4747
Button2b_ctor(&Button2b_inst);

sst_c/examples/blinky_button.X/dist/default/debug/blinky_button.X.debug.map

+3,344
Large diffs are not rendered by default.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
3+
<project>
4+
<executable name="dist/default/debug/blinky_button.X.debug.elf">
5+
<memory name="data">
6+
<units>bytes</units>
7+
<length>8192</length>
8+
<used>232</used>
9+
<free>7960</free>
10+
</memory>
11+
<memory name="program">
12+
<units>bytes</units>
13+
<length>131136</length>
14+
<used>9222</used>
15+
<free>121914</free>
16+
</memory>
17+
</executable>
18+
</project>

0 commit comments

Comments
 (0)