Added command latch ready event and camera upload configuration event.

The camera driver will now upload the exposure time when it's called from a scan object.
The output function now returns events which are not targeted at the camera or SICS
so that they can be fed back into the state transition function.
The input event handler (camera.c:camdriv_input) now feeds output events back into the
transition function.
This commit is contained in:
Ferdi Franceschini
2014-07-24 12:35:47 +10:00
parent a62a284372
commit 67a3a198ac
4 changed files with 153 additions and 105 deletions

View File

@@ -19,12 +19,13 @@ void print_state(state_t s) {
}
void print_event(event_t E) {
char *ca, *cm, *cd, *dr;
char *ca, *cm, *cd, *dr, *cl;
ca = event_names[E.ca];
cm = event_names[E.cm];
cd = event_names[E.cd];
dr = event_names[E.dr];
printf("%s,%s,%s,%s", ca, cm, cd, dr);
cl = event_names[E.cl];
printf("%s,%s,%s,%s,%s", ca, cm, cd, dr, cl);
}
event_t output(state_t Sc, enum event_codes Ei) {
@@ -78,7 +79,7 @@ int test_camrep2sym(void) {
int test_trans_fn(void) {
int i;
event_t Eo={0,0,0,0};
event_t Eo={0,0,0,0,0};
state_t Sc = {.cl=SCL_RDY, .cm=SCM_IDLE, .dr=SDR_IDLE};
@@ -101,6 +102,15 @@ int test_trans_fn(void) {
printf(",\t");
print_event(Eo);
printf("\n");
if (Eo.cl) {
/* TODO Handle feedback in the general case where there may be multiple events in Eo to feed back into the transition function */
printf("%s,\t",event_names[Eo.cl]);
print_state(Sc);
cam_trans_fn(Sc, Eo.cl, &Sc, &Eo);
printf(",\t");
print_event(Eo);
printf("\n");
}
}
fprintf(stderr, "TEST_TRANS_FN:OUTPUT:END\n");
return 1;
@@ -120,7 +130,10 @@ int camdriv_out(void *me, event_t Eo) {
if (Eo.dr) {
printf("camdriv_out: symbol=%s, output=%s\n", event_names[Eo.dr], event_signatures[Eo.dr]);
}
return 1;
if (Eo.cl) {
printf("camdriv_out: symbol=%s, output=%s\n", event_names[Eo.cl], event_signatures[Eo.cl]);
}
return -1;
}
int test_camdriv_event_io(void) {
@@ -139,12 +152,14 @@ int test_camdriv_event_io(void) {
printf("input: %s :", event_names[Ein]);
print_state(cdinfo.Sc);
printf("\n");
camdriv_input(&self, &cdinfo, Ein);
Ein = ECM_IDLE;
printf("input: %s :", event_names[Ein]);
cdinfo.Sc.cl=SCL_TK_SHOT;
print_state(cdinfo.Sc);
printf("\n");
camdriv_input(&self, &cdinfo, Ein);
fprintf(stderr, "TEST_CAMDRIVER_EVENT_IO:OUPUT:END\n");