add APP
This commit is contained in:
parent
14cb929b7c
commit
70f80452fc
@ -1,13 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<diagram program="umlet" version="15.1">
|
||||
<zoom_level>20</zoom_level>
|
||||
<zoom_level>15</zoom_level>
|
||||
<element>
|
||||
<id>UMLSpecialState</id>
|
||||
<coordinates>
|
||||
<x>640</x>
|
||||
<y>60</y>
|
||||
<w>40</w>
|
||||
<h>40</h>
|
||||
<x>600</x>
|
||||
<y>150</y>
|
||||
<w>30</w>
|
||||
<h>30</h>
|
||||
</coordinates>
|
||||
<panel_attributes>type=initial</panel_attributes>
|
||||
<additional_attributes/>
|
||||
@ -15,10 +15,10 @@
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>560</x>
|
||||
<y>220</y>
|
||||
<w>200</w>
|
||||
<h>80</h>
|
||||
<x>135</x>
|
||||
<y>225</y>
|
||||
<w>960</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>WAIT</panel_attributes>
|
||||
<additional_attributes/>
|
||||
@ -26,21 +26,66 @@
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>640</x>
|
||||
<y>80</y>
|
||||
<w>60</w>
|
||||
<h>180</h>
|
||||
<x>600</x>
|
||||
<y>165</y>
|
||||
<w>45</w>
|
||||
<h>90</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-></panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;70.0</additional_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;40.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>320</x>
|
||||
<x>135</x>
|
||||
<y>420</y>
|
||||
<w>240</w>
|
||||
<h>80</h>
|
||||
<w>210</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ST_BLINKER_L</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>915</x>
|
||||
<y>420</y>
|
||||
<w>180</w>
|
||||
<h>360</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ST_BLINKER_W</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>495</x>
|
||||
<y>570</y>
|
||||
<w>210</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ST_BLINKER_R</panel_attributes>
|
||||
<additional_attributes/>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>990</x>
|
||||
<y>270</y>
|
||||
<w>150</w>
|
||||
<h>180</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=<->
|
||||
evLongClick</panel_attributes>
|
||||
<additional_attributes>10.0;100.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<coordinates>
|
||||
<x>135</x>
|
||||
<y>720</y>
|
||||
<w>570</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ST_BLINKER_LR</panel_attributes>
|
||||
<additional_attributes/>
|
||||
@ -48,34 +93,134 @@
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>420</x>
|
||||
<y>280</y>
|
||||
<w>280</w>
|
||||
<h>180</h>
|
||||
<x>690</x>
|
||||
<y>735</y>
|
||||
<w>255</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-></panel_attributes>
|
||||
<additional_attributes>120.0;10.0;10.0;70.0</additional_attributes>
|
||||
<panel_attributes>lt=->
|
||||
m1=evLongClick</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;150.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>640</x>
|
||||
<y>280</y>
|
||||
<w>280</w>
|
||||
<h>180</h>
|
||||
<x>690</x>
|
||||
<y>585</y>
|
||||
<w>255</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=-></panel_attributes>
|
||||
<additional_attributes>10.0;10.0;120.0;70.0</additional_attributes>
|
||||
<panel_attributes>lt=->
|
||||
m1=evLongClick</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;150.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>UMLState</id>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>760</x>
|
||||
<y>420</y>
|
||||
<w>240</w>
|
||||
<h>80</h>
|
||||
<x>330</x>
|
||||
<y>435</y>
|
||||
<w>615</w>
|
||||
<h>60</h>
|
||||
</coordinates>
|
||||
<panel_attributes>ST_BLINKER_W</panel_attributes>
|
||||
<additional_attributes/>
|
||||
<panel_attributes>lt=->
|
||||
m1=evLongClick</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;390.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>150</x>
|
||||
<y>270</y>
|
||||
<w>120</w>
|
||||
<h>180</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickL</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;100.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>300</x>
|
||||
<y>270</y>
|
||||
<w>210</w>
|
||||
<h>180</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickL / evEndL
|
||||
</panel_attributes>
|
||||
<additional_attributes>10.0;100.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>150</x>
|
||||
<y>465</y>
|
||||
<w>120</w>
|
||||
<h>285</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickR</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;170.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>300</x>
|
||||
<y>465</y>
|
||||
<w>225</w>
|
||||
<h>285</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickR / evEndR</panel_attributes>
|
||||
<additional_attributes>10.0;170.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>270</y>
|
||||
<w>120</w>
|
||||
<h>330</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickR</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;200.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>660</x>
|
||||
<y>270</y>
|
||||
<w>225</w>
|
||||
<h>330</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickR / evEndR</panel_attributes>
|
||||
<additional_attributes>10.0;200.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>510</x>
|
||||
<y>615</y>
|
||||
<w>120</w>
|
||||
<h>135</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickL</panel_attributes>
|
||||
<additional_attributes>10.0;10.0;10.0;70.0</additional_attributes>
|
||||
</element>
|
||||
<element>
|
||||
<id>Relation</id>
|
||||
<coordinates>
|
||||
<x>660</x>
|
||||
<y>615</y>
|
||||
<w>210</w>
|
||||
<h>135</h>
|
||||
</coordinates>
|
||||
<panel_attributes>lt=->
|
||||
m1=evClickL / evEndL</panel_attributes>
|
||||
<additional_attributes>10.0;70.0;10.0;10.0</additional_attributes>
|
||||
</element>
|
||||
</diagram>
|
||||
|
216
03-software/ch/kb28/blinkerProject/app/app.c
Normal file
216
03-software/ch/kb28/blinkerProject/app/app.c
Normal file
@ -0,0 +1,216 @@
|
||||
/**
|
||||
* @author Rémi Heredero (remi@heredero.ch)
|
||||
* @version 1.0.0
|
||||
* @date 2023-06-15
|
||||
*/
|
||||
|
||||
#include "app.h"
|
||||
#include "factory/factory.h"
|
||||
#include "../middleware/blinker.h"
|
||||
#include "../middleware/clickHandler.h"
|
||||
|
||||
void clickL(APP* me){
|
||||
POST(me, &APP_processEvent, evAPclickL, 0, 0);
|
||||
}
|
||||
void clickLn(APP* me){
|
||||
POST(me, &APP_processEvent, evAPclickLn, 0, 0);
|
||||
}
|
||||
void clickR(APP* me){
|
||||
POST(me, &APP_processEvent, evAPclickR, 0, 0);
|
||||
}
|
||||
void clickRn(APP* me){
|
||||
POST(me, &APP_processEvent, evAPclickRn, 0, 0);
|
||||
}
|
||||
void endL(APP* me){
|
||||
POST(me, &APP_processEvent, evAPendL, 0, 0);
|
||||
}
|
||||
void endR(APP* me){
|
||||
POST(me, &APP_processEvent, evAPendR, 0, 0);
|
||||
}
|
||||
void longClick(APP* me){
|
||||
POST(me, &APP_processEvent, evAPlongClick, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void APP_init(APP* me){
|
||||
|
||||
me->state = STAP_INIT;
|
||||
|
||||
CLICK_HANDLER_setSingleClickCallback(ch1(), CLICK_HANDLER_defineCallBack(&clickL, me));
|
||||
CLICK_HANDLER_setSingleClickCallback(ch3(), CLICK_HANDLER_defineCallBack(&clickR, me));
|
||||
|
||||
CLICK_HANDLER_setDoubleClickCallback(ch1(), CLICK_HANDLER_defineCallBack(&clickLn, me));
|
||||
CLICK_HANDLER_setDoubleClickCallback(ch3(), CLICK_HANDLER_defineCallBack(&clickRn, me));
|
||||
|
||||
CLICK_HANDLER_setLongClickCallback(ch1(), CLICK_HANDLER_defineCallBack(&longClick, me));
|
||||
CLICK_HANDLER_setLongClickCallback(ch3(), CLICK_HANDLER_defineCallBack(&longClick, me));
|
||||
|
||||
BLINKER_setFinished(blL(), BLINKER_defineCallBack(&endL, me));
|
||||
BLINKER_setFinished(blR(), BLINKER_defineCallBack(&endR, me));
|
||||
|
||||
}
|
||||
|
||||
void APP_startBehaviour(APP* me){
|
||||
POST(me, &APP_processEvent, evAPinit, 0, 0);
|
||||
}
|
||||
|
||||
bool APP_processEvent(Event* ev){
|
||||
bool processed = false;
|
||||
APP* me = (APP*) Event_getTarget(ev);
|
||||
APP_STATES oldState = me->state;
|
||||
evIDT evid = Event_getId(ev);
|
||||
|
||||
switch(me->state) { // In state
|
||||
case STAP_INIT:
|
||||
if(evid == evAPinit) {
|
||||
me->state = STAP_WAIT;
|
||||
}
|
||||
break;
|
||||
|
||||
case STAP_WAIT:
|
||||
if(evid == evAPclickL) {
|
||||
me->state = STAP_BLINKER_L;
|
||||
BLINKER_blink(blL());
|
||||
}
|
||||
if(evid == evAPclickLn) {
|
||||
me->state = STAP_BLINKER_L;
|
||||
BLINKER_blinkN(blL());
|
||||
}
|
||||
if(evid == evAPclickR) {
|
||||
me->state = STAP_BLINKER_R;
|
||||
BLINKER_blink(blR());
|
||||
}
|
||||
if(evid == evAPclickRn) {
|
||||
me->state = STAP_BLINKER_R;
|
||||
BLINKER_blinkN(blR());
|
||||
}
|
||||
if(evid == evAPlongClick) {
|
||||
me->state = STAP_BLINKER_W;
|
||||
BLINKER_blink(blB());
|
||||
}
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_L:
|
||||
if(evid == evAPclickR){
|
||||
me->state = STAP_BLINKER_LR;
|
||||
BLINKER_blink(blR());
|
||||
}
|
||||
if(evid == evAPclickRn){
|
||||
me->state = STAP_BLINKER_LR;
|
||||
BLINKER_blinkN(blR());
|
||||
}
|
||||
if(evid == evAPclickL) {
|
||||
me->state = STAP_WAIT;
|
||||
BLINKER_endBlink(blL());
|
||||
}
|
||||
if(evid == evAPendL) {
|
||||
me->state = STAP_WAIT;
|
||||
}
|
||||
if(evid == evAPlongClick) {
|
||||
me->state = STAP_BLINKER_W;
|
||||
BLINKER_endBlink(blL());
|
||||
BLINKER_blink(blB());
|
||||
}
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_R:
|
||||
if(evid == evAPclickL){
|
||||
me->state = STAP_BLINKER_LR;
|
||||
BLINKER_blink(blL());
|
||||
}
|
||||
if(evid == evAPclickLn){
|
||||
me->state = STAP_BLINKER_LR;
|
||||
BLINKER_blinkN(blL());
|
||||
}
|
||||
if(evid == evAPclickR) {
|
||||
me->state = STAP_WAIT;
|
||||
BLINKER_endBlink(blR());
|
||||
}
|
||||
if(evid == evAPendR) {
|
||||
me->state = STAP_WAIT;
|
||||
}
|
||||
if(evid == evAPlongClick) {
|
||||
me->state = STAP_BLINKER_W;
|
||||
BLINKER_endBlink(blR());
|
||||
BLINKER_blink(blB());
|
||||
}
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_LR:
|
||||
if(evid == evAPclickR) {
|
||||
me->state = STAP_BLINKER_L;
|
||||
BLINKER_endBlink(blR());
|
||||
}
|
||||
if(evid == evAPendR) {
|
||||
me->state = STAP_BLINKER_L;
|
||||
}
|
||||
if(evid == evAPclickL) {
|
||||
me->state = STAP_BLINKER_R;
|
||||
BLINKER_endBlink(blL());
|
||||
}
|
||||
if(evid == evAPendL) {
|
||||
me->state = STAP_BLINKER_R;
|
||||
}
|
||||
if(evid == evAPlongClick) {
|
||||
me->state = STAP_BLINKER_W;
|
||||
BLINKER_endBlink(blL());
|
||||
BLINKER_endBlink(blR());
|
||||
BLINKER_blink(blB());
|
||||
}
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_W:
|
||||
if(evid == evAPlongClick){
|
||||
me->state = STAP_WAIT;
|
||||
BLINKER_endBlink(blB());
|
||||
}
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
if(oldState != me->state) {
|
||||
switch(oldState) { // on exit
|
||||
case STAP_INIT:
|
||||
break;
|
||||
|
||||
case STAP_WAIT:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_L:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_R:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_LR:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_W:
|
||||
break;
|
||||
}
|
||||
|
||||
switch(me->state) { // on entry
|
||||
case STAP_INIT:
|
||||
break;
|
||||
|
||||
case STAP_WAIT:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_L:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_R:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_LR:
|
||||
break;
|
||||
|
||||
case STAP_BLINKER_W:
|
||||
break;
|
||||
|
||||
}
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
40
03-software/ch/kb28/blinkerProject/app/app.h
Normal file
40
03-software/ch/kb28/blinkerProject/app/app.h
Normal file
@ -0,0 +1,40 @@
|
||||
/**
|
||||
* @author Rémi Heredero (remi@heredero.ch)
|
||||
* @version 1.0.0
|
||||
* @date 2023-06-17
|
||||
*/
|
||||
#ifndef APP_H
|
||||
#define APP_H
|
||||
|
||||
#include "../xf/xf.h"
|
||||
|
||||
typedef enum {
|
||||
STAP_INIT,
|
||||
STAP_WAIT,
|
||||
STAP_BLINKER_L,
|
||||
STAP_BLINKER_R,
|
||||
STAP_BLINKER_LR,
|
||||
STAP_BLINKER_W
|
||||
} APP_STATES;
|
||||
|
||||
typedef enum {
|
||||
evAPinit = 150,
|
||||
evAPclickL,
|
||||
evAPclickLn,
|
||||
evAPclickR,
|
||||
evAPclickRn,
|
||||
evAPendL,
|
||||
evAPendR,
|
||||
evAPlongClick
|
||||
} APP_EVENTS;
|
||||
|
||||
typedef struct {
|
||||
APP_STATES state; // Actual state
|
||||
} APP;
|
||||
|
||||
void APP_init(APP* me);
|
||||
void APP_startBehaviour(APP* me);
|
||||
bool APP_processEvent(Event* ev);
|
||||
|
||||
#endif /* APP_H */
|
||||
|
@ -72,6 +72,10 @@ BLINKER* blB() {
|
||||
return &theFactory.blB_;
|
||||
}
|
||||
|
||||
APP* app() {
|
||||
return &theFactory.app_;
|
||||
}
|
||||
|
||||
//initialize all objects
|
||||
void Factory_init() {
|
||||
LED_init(l1(), 1);
|
||||
@ -113,6 +117,8 @@ void Factory_init() {
|
||||
BLINKER_init(blR());
|
||||
BLINKER_init(blB());
|
||||
|
||||
APP_init(app());
|
||||
|
||||
}
|
||||
|
||||
void warningBlink(void* on_){
|
||||
@ -130,7 +136,6 @@ void warningBlink(void* on_){
|
||||
|
||||
//connect objects if required
|
||||
void Factory_build() {
|
||||
|
||||
|
||||
BLINKER_setTurnOn(blL(), BLINKER_defineCallBack(&LED_on, l1()));
|
||||
BLINKER_setTurnOff(blL(), BLINKER_defineCallBack(&LED_off, l1()));
|
||||
@ -139,15 +144,6 @@ void Factory_build() {
|
||||
BLINKER_setTurnOn(blB(), BLINKER_defineCallBack(&warningBlink, true));
|
||||
BLINKER_setTurnOff(blB(), BLINKER_defineCallBack(&warningBlink, false));
|
||||
|
||||
CLICK_HANDLER_setSingleClickCallback(ch1(), CLICK_HANDLER_defineCallBack(&BLINKER_toggle, blL()));
|
||||
CLICK_HANDLER_setSingleClickCallback(ch3(), CLICK_HANDLER_defineCallBack(&BLINKER_toggle, blR()));
|
||||
|
||||
CLICK_HANDLER_setDoubleClickCallback(ch1(), CLICK_HANDLER_defineCallBack(&BLINKER_blinkN, blL()));
|
||||
CLICK_HANDLER_setDoubleClickCallback(ch3(), CLICK_HANDLER_defineCallBack(&BLINKER_blinkN, blR()));
|
||||
|
||||
CLICK_HANDLER_setLongClickCallback(ch1(), CLICK_HANDLER_defineCallBack(&BLINKER_toggle, blB()));
|
||||
CLICK_HANDLER_setLongClickCallback(ch3(), CLICK_HANDLER_defineCallBack(&BLINKER_toggle, blB()));
|
||||
|
||||
}
|
||||
|
||||
//start all state machines
|
||||
@ -161,4 +157,5 @@ void Factory_start() {
|
||||
BLINKER_starBehaviour(blL());
|
||||
BLINKER_starBehaviour(blR());
|
||||
BLINKER_starBehaviour(blB());
|
||||
APP_startBehaviour(app());
|
||||
}
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "../../board/button/button.h"
|
||||
#include "../../middleware/clickHandler.h"
|
||||
#include "../../middleware/blinker.h"
|
||||
#include "../app.h"
|
||||
|
||||
typedef struct {
|
||||
LED l1_;
|
||||
@ -35,6 +36,7 @@ typedef struct {
|
||||
BLINKER blL_;
|
||||
BLINKER blR_;
|
||||
BLINKER blB_;
|
||||
APP app_;
|
||||
} Factory;
|
||||
|
||||
|
||||
@ -66,4 +68,6 @@ BLINKER* blL();
|
||||
BLINKER* blR();
|
||||
BLINKER* blB();
|
||||
|
||||
APP* app();
|
||||
|
||||
#endif
|
@ -37,6 +37,10 @@ void BLINKER_setTurnOff(BLINKER* me, blinkerCallBack callBack) {
|
||||
me->turnOff = callBack;
|
||||
}
|
||||
|
||||
void BLINKER_setFinished(BLINKER* me, blinkerCallBack callBack){
|
||||
me->finished = callBack;
|
||||
}
|
||||
|
||||
void BLINKER_defineNblink(BLINKER* me, uint8_t n){
|
||||
me->nBlink = n;
|
||||
}
|
||||
@ -101,6 +105,7 @@ bool BLINKER_processEvent(Event* ev) {
|
||||
if(evid == evBLtimer) {
|
||||
if(me->remainBlinks == 0) {
|
||||
me->state = STBL_WAIT;
|
||||
if(me->finished.fCallBack != NULL) me->finished.fCallBack(me->finished.param);
|
||||
} else {
|
||||
me->state = STBL_ON;
|
||||
POST(me, &BLINKER_processEvent, evBLtimer, me->tON, 0);
|
||||
@ -111,7 +116,7 @@ bool BLINKER_processEvent(Event* ev) {
|
||||
}
|
||||
|
||||
if(oldState != me->state) {
|
||||
switch(me->state) {
|
||||
switch(me->state) { // on entry
|
||||
case STBL_INIT:
|
||||
break;
|
||||
|
||||
@ -126,7 +131,9 @@ bool BLINKER_processEvent(Event* ev) {
|
||||
if(me->turnOff.fCallBack != NULL) me->turnOff.fCallBack(me->turnOff.param);
|
||||
break;
|
||||
}
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
||||
void BLINKER_endBlink(BLINKER* me) {
|
||||
@ -145,5 +152,4 @@ void BLINKER_toggle(BLINKER* me){
|
||||
BLINKER_endBlink(me);
|
||||
break;
|
||||
}
|
||||
me->toggleRemainBlinks = me->remainBlinks;
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
/**
|
||||
* @author Rémi Heredero (remi@heredero.ch)
|
||||
* @version. 1.0.0
|
||||
* @version 1.0.0
|
||||
* @date 2023-06-15
|
||||
*/
|
||||
|
||||
@ -39,6 +39,7 @@ typedef struct {
|
||||
uint8_t remainBlinks; // Actual remain blink
|
||||
blinkerCallBack turnOn; // Callback for turnOn
|
||||
blinkerCallBack turnOff; // Calbback for turnOff
|
||||
blinkerCallBack finished; // Callback for finish n blink
|
||||
}BLINKER;
|
||||
|
||||
/**
|
||||
@ -75,6 +76,13 @@ void BLINKER_setTurnOn(BLINKER* me, blinkerCallBack callBack);
|
||||
*/
|
||||
void BLINKER_setTurnOff(BLINKER* me, blinkerCallBack callBack);
|
||||
|
||||
/**
|
||||
* Set callback event functions for when the blinker has blink n times
|
||||
* @param me the blinker itseld
|
||||
* @param callBack callBack function when the blinker has blink n times
|
||||
*/
|
||||
void BLINKER_setFinished(BLINKER* me, blinkerCallBack callBack);
|
||||
|
||||
/**
|
||||
* define number of time the Blinker have to blink
|
||||
* @param me the blinker itself
|
||||
|
@ -147,5 +147,7 @@ bool CLICK_HANDLER_processEvent(Event* ev) {
|
||||
case STCH_DOUBLE_CLICK:
|
||||
break;
|
||||
}
|
||||
processed = true;
|
||||
}
|
||||
return processed;
|
||||
}
|
||||
|
@ -8,6 +8,7 @@
|
||||
<logicalFolder name="factory" displayName="factory" projectFiles="true">
|
||||
<itemPath>ch/kb28/blinkerProject/app/factory/factory.h</itemPath>
|
||||
</logicalFolder>
|
||||
<itemPath>ch/kb28/blinkerProject/app/app.h</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="board" displayName="board" projectFiles="true">
|
||||
<logicalFolder name="button" displayName="button" projectFiles="true">
|
||||
@ -28,7 +29,7 @@
|
||||
</logicalFolder>
|
||||
<logicalFolder name="middleware" displayName="middleware" projectFiles="true">
|
||||
<itemPath>ch/kb28/blinkerProject/middleware/clickHandler.h</itemPath>
|
||||
<itemPath>ch/kb28/blinkerProject/middleware/blinker.c</itemPath>
|
||||
<itemPath>ch/kb28/blinkerProject/middleware/blinker.h</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="xf" displayName="xf" projectFiles="true">
|
||||
<itemPath>ch/kb28/blinkerProject/xf/ireactive.h</itemPath>
|
||||
@ -48,6 +49,7 @@
|
||||
<itemPath>ch/kb28/blinkerProject/app/factory/factory.c</itemPath>
|
||||
</logicalFolder>
|
||||
<itemPath>ch/kb28/blinkerProject/app/main.c</itemPath>
|
||||
<itemPath>ch/kb28/blinkerProject/app/app.c</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="board" displayName="board" projectFiles="true">
|
||||
<logicalFolder name="button" displayName="button" projectFiles="true">
|
||||
@ -68,7 +70,7 @@
|
||||
</logicalFolder>
|
||||
<logicalFolder name="middleware" displayName="middleware" projectFiles="true">
|
||||
<itemPath>ch/kb28/blinkerProject/middleware/clickHandler.c</itemPath>
|
||||
<itemPath>ch/kb28/blinkerProject/middleware/blinker.h</itemPath>
|
||||
<itemPath>ch/kb28/blinkerProject/middleware/blinker.c</itemPath>
|
||||
</logicalFolder>
|
||||
<logicalFolder name="xf" displayName="xf" projectFiles="true">
|
||||
<itemPath>ch/kb28/blinkerProject/xf/xf.c</itemPath>
|
||||
@ -95,7 +97,7 @@
|
||||
<platformTool>PICkit3PlatformTool</platformTool>
|
||||
<languageToolchain>XC8</languageToolchain>
|
||||
<languageToolchainVersion>2.41</languageToolchainVersion>
|
||||
<platform>2</platform>
|
||||
<platform>3</platform>
|
||||
</toolsSet>
|
||||
<packs>
|
||||
<pack name="PIC18F-K_DFP" vendor="Microchip" version="1.7.134"/>
|
||||
|
Reference in New Issue
Block a user