mirror of
https://github.com/markqvist/OpenModem.git
synced 2025-03-13 09:26:33 -04:00
Merge 48ef9a625f9f9be0bbcdd37b849b3d855c5a37d4 into f0d6430cfdd10e2b210419837a1788edf1ea8601
This commit is contained in:
commit
a5f56caad0
@ -250,7 +250,7 @@ bool bme280_init(uint8_t cs_usrio_pin) {
|
||||
|
||||
bme280_temperature_fine_adjust = BME280_TEMPERATURE_ADJUSTMENT;
|
||||
|
||||
USR_IO_DDR |= bme280_cs_usrio_pin;
|
||||
USR_IO_DDR |= _BV(bme280_cs_usrio_pin);
|
||||
|
||||
SPI_DDR |= _BV(SPI_MOSI) | _BV(SPI_CLK);
|
||||
SPI_DDR &= ~(_BV(SPI_MISO));
|
||||
|
@ -16,12 +16,13 @@
|
||||
#include "diskio.h"
|
||||
#include "device.h"
|
||||
#include "hardware/LED.h"
|
||||
#include "util/Config.h"
|
||||
|
||||
|
||||
/* Port controls (Platform dependent) */
|
||||
#define CS_LOW() SD_CS_PORT &= ~(_BV(SD_CS_PIN)) /* CS=low */
|
||||
#define CS_HIGH() SD_CS_PORT |= _BV(SD_CS_PIN) /* CS=high */
|
||||
#define MMC_CD ((SD_DETECT_INPUT & _BV(SD_DETECT_PIN))) /* Card detected. yes:true, no:false, default:true */
|
||||
#define MMC_CD (config_invert_sddetect == false ? (SD_DETECT_INPUT & _BV(SD_DETECT_PIN)) : ((SD_DETECT_INPUT & _BV(SD_DETECT_PIN)) == 0)) /* Card detected. yes:true, no:false, default:true */
|
||||
#define MMC_WP (false) /* Write protected. yes:true, no:false, default:false */
|
||||
#define FCLK_SLOW() SPCR = 0x52 /* Set slow clock (F_CPU / 64) */
|
||||
#define FCLK_FAST() SPCR = 0x50 /* Set fast clock (F_CPU / 2) */
|
||||
@ -578,6 +579,6 @@ void disk_timerproc(void) {
|
||||
} else {
|
||||
s |= (STA_NODISK | STA_NOINIT); /* Socket empty */
|
||||
}
|
||||
|
||||
|
||||
Stat = s; /* Update MMC status */
|
||||
}
|
||||
|
@ -613,6 +613,15 @@ void kiss_serialCallback(uint8_t sbyte) {
|
||||
if (sbyte == 0x00) {
|
||||
kiss_output_modem_mode();
|
||||
}
|
||||
} else if (command == CMD_INVERT_SDDETECT) {
|
||||
if (sbyte == FESC) { ESCAPE = true; } else {
|
||||
if (ESCAPE) {
|
||||
if (sbyte == TFEND) sbyte = FEND;
|
||||
if (sbyte == TFESC) sbyte = FESC;
|
||||
ESCAPE = false;
|
||||
}
|
||||
config_set_invert_sddetect(sbyte);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -37,6 +37,7 @@
|
||||
#define CMD_NMEA 0x40
|
||||
#define CMD_PRINT_CONFIG 0xF0
|
||||
#define CMD_RETURN 0xFF
|
||||
#define CMD_INVERT_SDDETECT 0x15
|
||||
|
||||
void kiss_init(AX25Ctx *ax25, Afsk *afsk, Serial *ser);
|
||||
void kiss_messageCallback(AX25Ctx *ctx);
|
||||
|
@ -119,6 +119,7 @@ void config_save_to_eeprom(void) {
|
||||
config_data[i++] = config_gps_mode;
|
||||
config_data[i++] = config_bluetooth_mode;
|
||||
config_data[i++] = config_serial_baudrate;
|
||||
config_data[i++] = config_invert_sddetect;
|
||||
|
||||
md5_hash_t checksum;
|
||||
md5(&checksum, &config_data, config_data_size*8);
|
||||
@ -146,6 +147,7 @@ void config_load_defaults(void) {
|
||||
config_bluetooth_mode = CONFIG_BLUETOOTH_AUTODETECT;
|
||||
config_serial_baudrate = CONFIG_BAUDRATE_115200;
|
||||
config_source = CONFIG_SOURCE_DEFAULT;
|
||||
config_invert_sddetect = false;
|
||||
}
|
||||
|
||||
void config_load_from_eeprom(void) {
|
||||
@ -169,6 +171,7 @@ void config_load_from_eeprom(void) {
|
||||
config_gps_mode = config_data[ADDR_E_GPS_MODE];
|
||||
config_bluetooth_mode = config_data[ADDR_E_BLUETOOTH_MODE];
|
||||
config_serial_baudrate = config_data[ADDR_E_SERIAL_BAUDRATE];
|
||||
config_invert_sddetect = config_data[ADDR_E_INVERT_SDDETECT];
|
||||
}
|
||||
|
||||
bool config_validate_sd(void) {
|
||||
@ -243,6 +246,14 @@ void config_set_bt_mode(uint8_t mode) {
|
||||
if (mode == CONFIG_BLUETOOTH_REQUIRED) config_bluetooth_mode = CONFIG_BLUETOOTH_REQUIRED;
|
||||
}
|
||||
|
||||
void config_set_invert_sddetect(uint8_t invert_sddetect) {
|
||||
if (invert_sddetect == 0x00) {
|
||||
config_invert_sddetect = false;
|
||||
} else {
|
||||
config_invert_sddetect = true;
|
||||
}
|
||||
}
|
||||
|
||||
void EEPROM_writebyte(uint16_t addr, uint8_t data) {
|
||||
// Disable interrupts
|
||||
cli();
|
||||
|
@ -22,8 +22,9 @@
|
||||
#define ADDR_E_GPS_MODE 0x0D
|
||||
#define ADDR_E_BLUETOOTH_MODE 0x0E
|
||||
#define ADDR_E_SERIAL_BAUDRATE 0x0F
|
||||
#define ADDR_E_CHECKSUM 0x10
|
||||
#define ADDR_E_END 0x20
|
||||
#define ADDR_E_INVERT_SDDETECT 0x10
|
||||
#define ADDR_E_CHECKSUM 0x11
|
||||
#define ADDR_E_END 0x21
|
||||
|
||||
#define CONFIG_GPS_OFF 0x00
|
||||
#define CONFIG_GPS_AUTODETECT 0x01
|
||||
@ -73,6 +74,7 @@ uint8_t config_gps_mode;
|
||||
uint8_t config_gps_nmea_output;
|
||||
uint8_t config_bluetooth_mode;
|
||||
uint8_t config_serial_baudrate;
|
||||
bool config_invert_sddetect;
|
||||
|
||||
bool config_user_jobs_enabled;
|
||||
bool config_output_diagnostics;
|
||||
@ -109,6 +111,7 @@ void config_set_log_packets(uint8_t log_packets);
|
||||
void config_set_nmea_output(uint8_t nmea_output);
|
||||
void config_set_gps_mode(uint8_t mode);
|
||||
void config_set_bt_mode(uint8_t mode);
|
||||
void config_set_invert_sddetect(uint8_t inv_sddetect);
|
||||
|
||||
void config_enable_diagnostics(void);
|
||||
void config_disable_diagnostics(void);
|
||||
|
Loading…
x
Reference in New Issue
Block a user