First draft
This commit is contained in:
43
doc/examples/OBC+TTC/subsystems/OBC/main.c
Normal file
43
doc/examples/OBC+TTC/subsystems/OBC/main.c
Normal file
@@ -0,0 +1,43 @@
|
||||
#include <assert.h>
|
||||
|
||||
#include "../../shared/incp/service.h"
|
||||
#include "../../shared/incp/asn1/out/incp_generated.h"
|
||||
#include "../../shared/bus/bus.h"
|
||||
|
||||
|
||||
|
||||
//In this example, OBC will only ping and then request a variable from TTC
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
incp_async_ping(INCP_ENDPOINT_TTC, NULL);
|
||||
incp_async_datareq(INCP_ENDPOINT_TTC, ttcRxTotal_PRESENT);
|
||||
|
||||
for (;;);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// === SUBSYSTEM SPECIFIC INCP IMPLEMENTATIONS ===
|
||||
err_t impl_transmit(endpoint_t destination, void *buf, size_t size)
|
||||
{
|
||||
bus_send(destination, buf, size);
|
||||
}
|
||||
|
||||
err_t impl_populate_dataret(AnyData *data)
|
||||
{
|
||||
//LATER: Populate or deny
|
||||
}
|
||||
|
||||
void impl_callback_dataret(endpoint_t source, AnyData *data)
|
||||
{
|
||||
//LATER: Do whatever
|
||||
}
|
||||
|
||||
void impl_callback_pong(endpoint_t source, PingMsg *pong)
|
||||
{
|
||||
//LATER: Do whatever
|
||||
}
|
||||
50
doc/examples/OBC+TTC/subsystems/TTC/main.c
Normal file
50
doc/examples/OBC+TTC/subsystems/TTC/main.c
Normal file
@@ -0,0 +1,50 @@
|
||||
#include "../../shared/incp/service.h"
|
||||
#include "../../shared/incp/asn1/out/incp_generated.h"
|
||||
#include "../../shared/bus/bus.h"
|
||||
|
||||
|
||||
|
||||
//In this example, TTC will be passive and will only reply to datareqs and pings
|
||||
|
||||
|
||||
|
||||
int main()
|
||||
{
|
||||
for (;;);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
|
||||
// === SUBSYSTEM SPECIFIC INCP IMPLEMENTATIONS ===
|
||||
err_t impl_transmit(endpoint_t destination, void *buf, size_t size)
|
||||
{
|
||||
bus_send(destination, buf, size);
|
||||
}
|
||||
|
||||
err_t impl_populate_dataret(AnyData *data)
|
||||
{
|
||||
switch (data->kind)
|
||||
{
|
||||
case ttcRxTotal_PRESENT:
|
||||
data->u.ttcRxTotal.bytes = 69; //LATER: Proper data
|
||||
return ERR_SUCCESS;
|
||||
|
||||
case ttcTxTotal_PRESENT:
|
||||
data->u.ttcTxTotal.bytes = 420; //LATER: Proper data
|
||||
return ERR_SUCCESS;
|
||||
|
||||
default:
|
||||
return ERR_NOT_MINE;
|
||||
}
|
||||
}
|
||||
|
||||
void impl_callback_dataret(endpoint_t source, AnyData *data)
|
||||
{
|
||||
//LATER: Do whatever
|
||||
}
|
||||
|
||||
void impl_callback_pong(endpoint_t source, PingMsg *pong)
|
||||
{
|
||||
//LATER: Do whatever
|
||||
}
|
||||
Reference in New Issue
Block a user