Subversion Repositories HomeAutomation

Rev

Rev 1910 | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | SVN | RSS feed

Rev 1910 Rev 1978
Line 15... Line 15...
15
uint8_t demoState[8] = {ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING,
15
uint8_t demoState[8] = {ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING,
16
                        ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING,
16
                        ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING,
17
                        ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING,
17
                        ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING,
18
                        ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING};
18
                        ACT_PCAPWM_DEMO_STATE_NOT_RUNNING, ACT_PCAPWM_DEMO_STATE_NOT_RUNNING};
19
 
19
 
20
#ifdef act_pcaPWM_USEEEPROM
20
#if act_pcaPWM_USEEEPROM==1
21
#include "act_pcaPWM_eeprom.h"
21
#include "act_pcaPWM_eeprom.h"
22
struct eeprom_act_pcaPWM EEMEM eeprom_act_pcaPWM =
22
struct eeprom_act_pcaPWM EEMEM eeprom_act_pcaPWM =
23
{
23
{
24
    {
24
    {
25
        ///TODO: Define initialization values on the EEPROM variables here, this will generate a *.eep file that can be used to store this values to the node, can in future be done with a EEPROM module and the make-scrips. Write the values in the exact same order as the struct is defined in the *.h file.
25
        ///TODO: Define initialization values on the EEPROM variables here, this will generate a *.eep file that can be used to store this values to the node, can in future be done with a EEPROM module and the make-scrips. Write the values in the exact same order as the struct is defined in the *.h file.
Line 89... Line 89...
89
}
89
}
90
#endif
90
#endif
91
 
91
 
92
void act_pcaPWM_Init(void)
92
void act_pcaPWM_Init(void)
93
{
93
{
94
#ifdef act_pcaPWM_USEEEPROM
94
#if act_pcaPWM_USEEEPROM==1
95
    if (EEDATA_OK)
95
    if (EEDATA_OK)
96
    {
96
    {
97
      setValue[0] = eeprom_read_word(EEDATA16.ch1);
97
      setValue[0] = eeprom_read_word(EEDATA16.ch1);
98
      setValue[1] = eeprom_read_word(EEDATA16.ch2);
98
      setValue[1] = eeprom_read_word(EEDATA16.ch2);
99
      setValue[2] = eeprom_read_word(EEDATA16.ch3);
99
      setValue[2] = eeprom_read_word(EEDATA16.ch3);
Line 145... Line 145...
145
    {
145
    {
146
        if (setValue[i] != isValue[i])
146
        if (setValue[i] != isValue[i])
147
        {
147
        {
148
            isValue[i] = setValue[i];
148
            isValue[i] = setValue[i];
149
            pca9634_setDuty(i, isValue[i]*act_pcaPWM_FACT);
149
            pca9634_setDuty(i, isValue[i]*act_pcaPWM_FACT);
150
#ifdef act_pcaPWM_USEEEPROM
150
#if act_pcaPWM_USEEEPROM==1
151
            Timer_SetTimeout(act_pcaPWM_STORE_VALUE_TIMEOUT, act_pcaPWM_STORE_VALUE_TIMEOUT_TIME*1000, TimerTypeOneShot, 0);
151
            Timer_SetTimeout(act_pcaPWM_STORE_VALUE_TIMEOUT, act_pcaPWM_STORE_VALUE_TIMEOUT_TIME*1000, TimerTypeOneShot, 0);
152
#endif
152
#endif
153
        }
153
        }
154
    }
154
    }
155
 
155
 
156
#ifdef act_pcaPWM_USEEEPROM
156
#if act_pcaPWM_USEEEPROM==1
157
    if (Timer_Expired(act_pcaPWM_STORE_VALUE_TIMEOUT))
157
    if (Timer_Expired(act_pcaPWM_STORE_VALUE_TIMEOUT))
158
    {
158
    {
159
        if (isValue[0] != eeprom_read_word(EEDATA16.ch1))
159
        if (isValue[0] != eeprom_read_word(EEDATA16.ch1))
160
        {
160
        {
161
            eeprom_write_word_crc(EEDATA16.ch1, isValue[0], WITH_CRC);
161
            eeprom_write_word_crc(EEDATA16.ch1, isValue[0], WITH_CRC);