mirror of
https://github.com/markqvist/OpenModem.git
synced 2025-06-02 21:32:53 -04:00
Added the ability to invert SD_DETECT for cardholders with a normally open contact to determine the presence of a card.
This commit is contained in:
parent
596539f0cd
commit
7f8dfae211
5 changed files with 28 additions and 3 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue