-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
242 additions
and
180 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
*.o | ||
*.lst | ||
*.map | ||
*.lss | ||
*.hex | ||
*.swp | ||
*.eep | ||
*.elf | ||
*.sym | ||
.dep/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
|
||
#include <avr/eeprom.h> | ||
|
||
uint8_t EEMEM EEepochStartSeconds; | ||
uint8_t EEMEM EEepochStartMinutes; | ||
uint8_t EEMEM EEepochStartHours; | ||
uint8_t EEMEM EEepochStartDays; | ||
|
||
uint16_t EEMEM EEballastTargetAltitude; | ||
int16_t EEMEM EEballastTargetPositiveVSpeed; | ||
int16_t EEMEM EEballastTargetNegativeVSpeed; | ||
|
||
uint16_t EEMEM EEmaydayAltitude; | ||
int16_t EEMEM EEmaydayVSpeed; | ||
|
||
uint16_t EEMEM EEballastSafetyAltThresh; | ||
uint8_t EEMEM EEautoBallastDisable; | ||
|
||
uint8_t EEMEM EEoverOceanFlag; | ||
|
||
int8_t EEMEM EEnightTemperatureForecast; | ||
uint32_t EEMEM EEsunriseAnticipation; | ||
|
||
uint16_t EEMEM EEmaxAllowableTXInterval; | ||
|
||
int8_t EEMEM EEbatteryHeaterSetpoint; | ||
|
||
uint16_t EEMEM EEdataCollectionInterval; //Var 0x03 | ||
uint16_t EEMEM EEdataTransmitInterval; //Var 0x04 | ||
uint16_t EEMEM EEshortDataTransmitInterval; | ||
|
||
uint16_t EEMEM EEhfDataTransmitInterval; | ||
uint8_t EEMEM EEhfRapidTransmit; | ||
|
||
|
||
uint32_t EEMEM EEepochOfLastBatchTransmit; | ||
|
||
uint16_t EEMEM EEcurrentBatchNumber; | ||
uint16_t EEMEM EEbatchSampleStart; | ||
uint16_t EEMEM EEbatchSampleEnd; | ||
|
||
uint16_t EEMEM EEcommPromStart; | ||
uint16_t EEMEM EEcommPromEnd; | ||
|
||
uint8_t EEMEM EEflightComputerResetCount; | ||
uint8_t EEMEM EEcommModuleResetCount; | ||
|
||
uint8_t EEMEM EEflightPhase; //Var 0x05 | ||
|
||
uint32_t EEMEM EEcurrentTelemetryBitmap[3]; //Var 0x06 | ||
uint16_t EEMEM EEcurrentTelemetryVersion; //Var 0x07 | ||
|
||
uint8_t EEMEM EEEpochLock = 0; | ||
|
||
uint16_t EEMEM EEhfTimeToTx; | ||
uint8_t EEMEM EEhfLenngthToTx; | ||
|
||
uint32_t EEMEM EEepochOffset; | ||
|
||
//THIS IS ALSO DEFINED IN MAIN, REMEMBER TO CHANGE THIS DUMMY | ||
#define VSPEEDSAMPLESDESIRED 20 | ||
|
||
int16_t EEMEM EEvSpeedHolderSamples[VSPEEDSAMPLESDESIRED]; | ||
|
||
//Needed for BMP085 | ||
short EEMEM EEBMPac1; | ||
short EEMEM EEBMPac2; | ||
short EEMEM EEBMPac3; | ||
unsigned short EEMEM EEBMPac4; | ||
unsigned short EEMEM EEBMPac5; | ||
unsigned short EEMEM EEBMPac6; | ||
short EEMEM EEBMPb1; | ||
short EEMEM EEBMPb2; | ||
short EEMEM EEBMPmb; | ||
short EEMEM EEBMPmc; | ||
short EEMEM EEBMPmd; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,83 @@ | ||
#include <stdio.h> | ||
#include <avr/io.h> | ||
#include <util/delay.h> | ||
#include <string.h> | ||
|
||
#include <avr/pgmspace.h> | ||
|
||
#include "lprintf.h" | ||
#include "lib/i2c.h" | ||
|
||
//LEDs on PB3 and PB4 | ||
#define STATUS_PORT PORTB | ||
#define STATUS_LED1 3 | ||
#define STATUS_LED2 4 | ||
|
||
#define yellow_on() ( PORTB |= (1 << STATUS_LED1) ) | ||
#define red_on() ( PORTB |= (1 << STATUS_LED2) ) | ||
|
||
#define yellow_off() ( PORTB &= ~(1 << STATUS_LED1) ) | ||
#define red_off() ( PORTB &= ~(1 << STATUS_LED2) ) | ||
|
||
int lprintf(char *str, ...) | ||
{ | ||
char lstr[301]; | ||
int chars; | ||
va_list args; | ||
|
||
va_start(args, str); | ||
|
||
lstr[0] = 'F'; | ||
|
||
chars = vsnprintf(lstr+1, 300, str, args); | ||
|
||
if(chars > 300) | ||
{ | ||
va_end(args); | ||
return 1; | ||
} else { | ||
uint8_t retVal = i2cMasterSendNI(0b00001110, chars+1, lstr); | ||
if(retVal != I2C_OK) | ||
{ | ||
yellow_on(); | ||
} | ||
|
||
va_end(args); | ||
return 0; | ||
} | ||
_delay_ms(100); | ||
} | ||
|
||
int lprintf_P(const char *str, ...) | ||
{ | ||
char lstr[100]; | ||
uint8_t i2cSend[101]; | ||
int chars; | ||
va_list args; | ||
|
||
va_start(args, str); | ||
|
||
chars = vsnprintf_P(lstr, 100, str, args); | ||
|
||
if(chars > 100) | ||
{ | ||
va_end(args); | ||
return 1; | ||
} else { | ||
int i=0; | ||
i2cSend[0] = 'F'; | ||
for(i=0; i <=chars; i++) | ||
{ | ||
i2cSend[i+1] = (uint8_t)lstr[i]; | ||
} | ||
uint8_t retVal = i2cMasterSendNI(0b00001110, chars+1, i2cSend); | ||
if(retVal != I2C_OK) | ||
{ | ||
yellow_on(); | ||
} | ||
|
||
va_end(args); | ||
return 0; | ||
} | ||
_delay_ms(100); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
#ifndef LPRINTF_H | ||
#define LPRINTF_H | ||
|
||
int lprintf(char *, ...); | ||
|
||
int lprintf_P(const char *, ...); | ||
|
||
#endif |
Oops, something went wrong.