Rev 1125 | Details | Compare with Previous | Last modification | View Log | SVN | RSS feed
| Rev | Author | Line No. | Line |
|---|---|---|---|
| 893 | arune | 1 | #ifndef ACT_DIMMER230 |
| 2 | #define ACT_DIMMER230 |
||
| 3 | |||
| 4 | /*----------------------------------------------------------------------------- |
||
| 5 | * Includes |
||
| 6 | *---------------------------------------------------------------------------*/ |
||
| 7 | /* system files */ |
||
| 8 | #include <avr/io.h> |
||
| 9 | #include <avr/interrupt.h> |
||
| 894 | arune | 10 | #include <avr/pgmspace.h> |
| 893 | arune | 11 | #include <stdio.h> |
| 12 | /* lib files */ |
||
| 13 | #include <config.h> |
||
| 14 | #include <bios.h> |
||
| 15 | #include <drivers/can/stdcan.h> |
||
| 16 | #include <drivers/timer/timer.h> |
||
| 1075 | arune | 17 | #include <drivers/mcu/gpio.h> |
| 893 | arune | 18 | |
| 1125 | linlun | 19 | #include <drivers/mcu/pcint.h> |
| 20 | |||
| 893 | arune | 21 | #define ACT_DIMMMER230_STATE_IDLE 0 |
| 22 | #define ACT_DIMMMER230_STATE_TIMER_ON 1 |
||
| 23 | #define ACT_DIMMMER230_STATE_xyz 2 |
||
| 24 | |||
| 1075 | arune | 25 | #define ACT_DIMMMER230_DEMO_STATE_NOT_RUNNING 0 |
| 26 | #define ACT_DIMMMER230_DEMO_STATE_DECREASE 1 |
||
| 27 | #define ACT_DIMMMER230_DEMO_STATE_INCREASE 2 |
||
| 28 | #define ACT_DIMMMER230_DEMO_STATE_GOBACK 3 |
||
| 29 | |||
| 895 | arune | 30 | #define ACT_DIMMMER230_PERIOD_TIME 10000 |
| 31 | |||
| 899 | arune | 32 | #define ACT_DIMMMER230_MAX_DIM 255 |
| 33 | #define ACT_DIMMMER230_MIN_DIM 0 |
||
| 34 | |||
| 1075 | arune | 35 | #define ACT_DIMMMER230_50HZ_PERIOD_TIME 10000 |
| 36 | #define ACT_DIMMMER230_60HZ_PERIOD_TIME 8000 |
||
| 899 | arune | 37 | |
| 893 | arune | 38 | #if act_dimmer230_ZC_PCINT<8 |
| 39 | #define act_dimmer230_ZC_PCINT_vect PCINT0_vect //interrupt vector |
||
| 40 | #define act_dimmer230_ZC_PCIE PCIE0 //interrupt enable |
||
| 41 | #define act_dimmer230_ZC_PCIF PCIF0 //interrupt flag |
||
| 1069 | arune | 42 | #define act_dimmer230_ZC_PCMSK PCMSK0 //mask register |
| 893 | arune | 43 | #define act_dimmer230_ZC_PCINT_BIT act_dimmer230_ZC_PCINT //interrupt bit |
| 44 | #endif |
||
| 45 | |||
| 46 | #if act_dimmer230_ZC_PCINT>=8 && act_dimmer230_ZC_PCINT<16 |
||
| 47 | #define act_dimmer230_ZC_PCINT_vect PCINT1_vect //interrupt vector |
||
| 48 | #define act_dimmer230_ZC_PCIE PCIE1 //interrupt enable |
||
| 49 | #define act_dimmer230_ZC_PCIF PCIF1 //interrupt flag |
||
| 1069 | arune | 50 | #define act_dimmer230_ZC_PCMSK PCMSK1 //mask register |
| 893 | arune | 51 | #define act_dimmer230_ZC_PCINT_BIT act_dimmer230_ZC_PCINT-8 //interrupt bit |
| 52 | #endif |
||
| 53 | |||
| 54 | #if act_dimmer230_ZC_PCINT>=16 && act_dimmer230_ZC_PCINT<24 |
||
| 55 | #define act_dimmer230_ZC_PCINT_vect PCINT2_vect //interrupt vector |
||
| 56 | #define act_dimmer230_ZC_PCIE PCIE2 //interrupt enable |
||
| 57 | #define act_dimmer230_ZC_PCIF PCIF2 //interrupt flag |
||
| 1069 | arune | 58 | #define act_dimmer230_ZC_PCMSK PCMSK2 //mask register |
| 893 | arune | 59 | #define act_dimmer230_ZC_PCINT_BIT act_dimmer230_ZC_PCINT-16 //interrupt bit |
| 60 | #endif |
||
| 61 | |||
| 62 | void act_dimmer230_Init(void); |
||
| 63 | void act_dimmer230_Process(void); |
||
| 64 | void act_dimmer230_HandleMessage(StdCan_Msg_t *rxMsg); |
||
| 65 | void act_dimmer230_List(uint8_t ModuleSequenceNumber); |
||
| 66 | |||
| 1976 | arune | 67 | #ifndef act_dimmer230_USEEEPROM |
| 68 | #define act_dimmer230_USEEEPROM 0 |
||
| 69 | #endif |
||
| 70 | |||
| 71 | #if act_dimmer230_USEEEPROM==1 |
||
| 1081 | arune | 72 | struct act_dimmer230_Data{ |
| 73 | // the dimmer will store its current value in eeprom, to use when starting |
||
| 74 | uint8_t eeDimmerValue; |
||
| 75 | }; |
||
| 76 | |||
| 77 | #endif |
||
| 78 | |||
| 893 | arune | 79 | #endif // ACT_DIMMER230 |