Ke Ao Teensy Flight Software
The software on the Teensy in the Ke Ao cubesat.
Loading...
Searching...
No Matches
rpi_channel.cpp File Reference

The channel controlling communications to the Raspberry Pi. More...

#include "channels/artemis_channels.h"
#include <Wire.h>
#include <pdu.h>

Functions

void receiveData (int byte_count)
 Helper function to receive data from the Raspberry Pi.
 
void sendData ()
 Helper function to send data to the Raspberry Pi.
 

Detailed Description

The channel controlling communications to the Raspberry Pi.

This is the channel that controls the communication to the Raspberry Pi on the OBC, in parallel to all other channels. When it gets a slice of computing time on the Teensy's processor, it performs actions related to the Raspberry Pi. This channel must be written such that it can be interrupted at any time to switch to the next channel.

Function Documentation

◆ receiveData()

void receiveData ( int  byte_count)

Helper function to receive data from the Raspberry Pi.

This function should be written to be as fast as possible as it is an interrupt service method. Most of the processing should be done in the infinite loop in the rpi_channel() function.

Parameters
byte_countThe number of bytes to be received from the Raspberry Pi.

If there are no bytes to be read, do nothing.

The I2C1 interface is locked for the exclusive use by the Raspberry Pi channel. Each byte in the message is read in from the I2C interface and copied into a buffer. This buffer is then printed to the Teensy's serial console.

Todo:
The message should be packaged into a packet and copied into the main_queue.

◆ sendData()

void sendData ( )

Helper function to send data to the Raspberry Pi.

This function should be written to be as fast as possible as it is an interrupt service method. Most of the processing should be done in the infinite loop in the rpi_channel() function.

The I2C1 interface is locked for the exclusive use by the Raspberry Pi channel.

For each byte in the packet, it is written to the I2C interface and printed to the Teensy's serial console. The ready flag is then reset to give the Raspberry Pi loop time to wrap the next packet.