Rev 1910 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed
| Rev 1910 | Rev 1978 | ||
|---|---|---|---|
| Line 10... | Line 10... | ||
| 10 | 10 | ||
| 11 | #define HIGH 1 |
11 | #define HIGH 1 |
| 12 | #define LOW 2 |
12 | #define LOW 2 |
| 13 | #define NOCHANGE 0 |
13 | #define NOCHANGE 0 |
| 14 | 14 | ||
| 15 | |
15 | #if sns_inputAnalog_USEEEPROM==1 |
| 16 | #include "sns_inputAnalog_eeprom.h" |
16 | #include "sns_inputAnalog_eeprom.h" |
| 17 | 17 | ||
| 18 | struct eeprom_sns_inputAnalog EEMEM eeprom_sns_inputAnalog = |
18 | struct eeprom_sns_inputAnalog EEMEM eeprom_sns_inputAnalog = |
| 19 | { |
19 | { |
| 20 | { |
20 | { |
| Line 252... | Line 252... | ||
| 252 | #endif |
252 | #endif |
| 253 | } |
253 | } |
| 254 | 254 | ||
| 255 | void sns_inputAnalog_Init(void) |
255 | void sns_inputAnalog_Init(void) |
| 256 | { |
256 | { |
| 257 | |
257 | #if sns_inputAnalog_USEEEPROM==1 |
| 258 | if (EEDATA_OK) |
258 | if (EEDATA_OK) |
| 259 | { |
259 | { |
| 260 | /* Use stored data to set initial values for the module */ |
260 | /* Use stored data to set initial values for the module */ |
| 261 | for (uint8_t i=0; i<sns_inputAnalog_NUM_SUPPORTED; i++) |
261 | for (uint8_t i=0; i<sns_inputAnalog_NUM_SUPPORTED; i++) |
| 262 | { |
262 | { |
| Line 465... | Line 465... | ||
| 465 | sns_inputAnalog_Config[index].HighTh = sns_inputAnalog_Config[index].HighTh<<(sns_inputAnalog3Scale-6); |
465 | sns_inputAnalog_Config[index].HighTh = sns_inputAnalog_Config[index].HighTh<<(sns_inputAnalog3Scale-6); |
| 466 | sns_inputAnalog_Config[index].HighTh = sns_inputAnalog_Config[index].HighTh / sns_inputAnalog3Factor; |
466 | sns_inputAnalog_Config[index].HighTh = sns_inputAnalog_Config[index].HighTh / sns_inputAnalog3Factor; |
| 467 | break; |
467 | break; |
| 468 | } |
468 | } |
| 469 | 469 | ||
| 470 | |
470 | #if sns_inputAnalog_USEEEPROM==1 |
| 471 | /* Store config to eeprom */ |
471 | /* Store config to eeprom */ |
| 472 | #if ((__AVR_LIBC_MAJOR__ == 1 && __AVR_LIBC_MINOR__ == 6 && __AVR_LIBC_REVISION__ >= 7)||(__AVR_LIBC_MAJOR__ == 1 && __AVR_LIBC_MINOR__ > 6)||__AVR_LIBC_MAJOR__ > 1) |
472 | #if ((__AVR_LIBC_MAJOR__ == 1 && __AVR_LIBC_MINOR__ == 6 && __AVR_LIBC_REVISION__ >= 7)||(__AVR_LIBC_MAJOR__ == 1 && __AVR_LIBC_MINOR__ > 6)||__AVR_LIBC_MAJOR__ > 1) |
| 473 | eeprom_update_block( &sns_inputAnalog_Config[index], &eeprom_sns_inputAnalog+sizeof(sns_inputAnalog_Config)*index, sizeof(sns_inputAnalog_Config) ); |
473 | eeprom_update_block( &sns_inputAnalog_Config[index], &eeprom_sns_inputAnalog+sizeof(sns_inputAnalog_Config)*index, sizeof(sns_inputAnalog_Config) ); |
| 474 | #else |
474 | #else |
| 475 | eeprom_write_block( &sns_inputAnalog_Config[index], &eeprom_sns_inputAnalog+sizeof(sns_inputAnalog_Config)*index, sizeof(sns_inputAnalog_Config) ); |
475 | eeprom_write_block( &sns_inputAnalog_Config[index], &eeprom_sns_inputAnalog+sizeof(sns_inputAnalog_Config)*index, sizeof(sns_inputAnalog_Config) ); |