Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

firmware update for eridium v2 lsf1 update #2

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @JasonBrave
* @JasonBrave @Pdada1
4 changes: 0 additions & 4 deletions board.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#ifndef BOARD_H
#define BOARD_H

#define MAX_TC_TIME_DIFF_ms 200
#define MAX_HEARTBEAT_TIME_DIFF_ms 2000
#define MAX_BUS_DEAD_TIME_ms 2000

#define RED_LED_ON() (LATB3 = 0)
#define RED_LED_OFF() (LATB3 = 1)
#define RED_LED_TOGGLE() (LATB3 ^= 1)
Expand Down
4 changes: 4 additions & 0 deletions main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
#include "spi.h"
#include "thermocouple.h"

#define MAX_TC_TIME_DIFF_ms 200 // 5 Hz
#define MAX_HEARTBEAT_TIME_DIFF_ms 500 // 2 Hz
#define MAX_BUS_DEAD_TIME_ms 5000 // 5 s

#if (BOARD_UNIQUE_ID == BOARD_ID_THERMOCOUPLE_1)
#define build_tc_temp_data_msg(timestamp, id, temp, msg) \
build_temp_data_msg(timestamp, id, temp, msg);
Expand Down
5 changes: 2 additions & 3 deletions spi.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ void spi1_init(void) {
SPI1CON0bits.EN = 1; // enable SPI
}

/**/
uint8_t spi1_exchange(uint8_t data) {
INTCON0bits.GIE = 0;
SPI1CON2bits.TXR = 0;
SPI1CON2bits.RXR = 1;
SPI1TCNT = 1;
SPI1TXB = data; /*if we're sending data, send it. if we're recieving, this is 0 (unless you
// initialized bad), but makes sure we output a clock*/
initialized bad), but makes sure we output a clock*/
while (!PIR2bits.SPI1RXIF) {
} // wait until receive buffer is not empty?? (basically until theres a clock)
data = SPI1RXB;
Expand All @@ -45,7 +44,7 @@ void spi1_exchange_buffer(uint8_t *data, uint8_t data_len) {
// set data length
SPI1TCNTL = data_len;
SPI1TCNTH = 0;
// uint8_t *block = data;

while (data_len) {
*data = spi1_exchange(*data); // sends pointer, so data gets shoved into array
data++; // increment array
Expand Down