/** * Initialization code. */ void busInit(void) { BYTE i; //Initialize busInfo structure with configured values from EEPROM memclr(&busInfo, sizeof(busInfo)); //Clear busInfo structure busInfoInit(); //Initialze serial buses serInit(); #if defined(BRD_SBC65EC) ser2Init(); #endif i2cBusInit(); /* debugPutGenMsg(2); //@mxd:2:%s debugPutRomStringXNull((ROM char*)"Bus Ser1 Txbuf = 0x"); debugPutByteHex( (BYTE)(((WORD)busInfo.buf[BUSID_SER1].txBuf)>>8) ); debugPutByteHex( (BYTE)busInfo.buf[BUSID_SER1].txBuf ); debugPutByte(0); //Null terminate string debugPutGenMsg(2); //@mxd:2:%s debugPutRomStringXNull((ROM char*)"Bus Ser1 Rxbuf = 0x"); debugPutByteHex( (BYTE)(((WORD)busInfo.buf[BUSID_SER1].rxBuf)>>8) ); debugPutByteHex( (BYTE)busInfo.buf[BUSID_SER1].rxBuf ); debugPutByte(0); //Null terminate string */ #if (DEBUG_BUS >= LOG_ERROR) debugPutMsg(1); //@mxd:1:Initialized Serial Buses #endif }
/* * Main entry point. */ void main(void) { static TICK t = 0; BYTE c, i; WORD w; BYTE buf[10]; /* * Initialize any application specific hardware. */ InitializeBoard(); /* * Initialize all stack related components. * Following steps must be performed for all applications using * PICmicro TCP/IP Stack. */ TickInit(); /* * Initialize MPFS file system. */ MPFSInit(); //Intialize HTTP Execution unit htpexecInit(); //Initialze serial port serInit(); /* * Initialize Stack and application related NV variables. */ appcfgInit(); appcfgUSART(); //Configure the USART #ifdef SER_USE_INTERRUPT //Interrupt enabled serial ports have to be enabled serEnable(); #endif appcfgCpuIO(); // Configure the CPU's I/O port pins appcfgADC(); // Configure ADC unit appcfgPWM(); // Configure PWM unit //Clear Screen serPutRomString(AnsiEscClearScreen); /* * Wait a couple of seconds for user input. * - If something is detected, start config. * - If nothing detected, start main program. */ serPutRomString(PressKeyForConfig); for (i = 60; i > 0; --i) //Delay for 50mS x 60 = 3 sec { if ((i % 8) == 0) serPutByte('.'); if (serIsGetReady()) { SetConfig(); break; } DelayMs(50); } serPutByte('\r'); serPutByte('\n'); StackInit(); #if defined(STACK_USE_HTTP_SERVER) HTTPInit(); #endif #if defined(STACK_USE_FTP_SERVER) && defined(MPFS_USE_EEPROM) FTPInit(); #endif #if defined(STACK_USE_DHCP) || defined(STACK_USE_IP_GLEANING) if (!AppConfig.Flags.bIsDHCPEnabled ) { /* * Force IP address display update. */ myDHCPBindCount = 1; #if defined(STACK_USE_DHCP) DHCPDisable(); #endif } #endif #if defined( STACK_USE_VSCP ) vscp2_udpinit(); // init VSCP subsystem #endif /* * Once all items are initialized, go into infinite loop and let * stack items execute their tasks. * If application needs to perform its own task, it should be * done at the end of while loop. * Note that this is a "co-operative mult-tasking" mechanism * where every task performs its tasks (whether all in one shot * or part of it) and returns so that other tasks can do their * job. * If a task needs very long time to do its job, it must broken * down into smaller pieces so that other tasks can have CPU time. */ while ( 1 ) { /* * Blink SYSTEM LED every second. */ if ( TickGetDiff( TickGet(), t ) >= TICK_SECOND/2 ) { t = TickGet(); LATB6 ^= 1; } //Perform routine tasks MACTask(); /* * This task performs normal stack task including checking * for incoming packet, type of packet and calling * appropriate stack entity to process it. */ StackTask(); #if defined(STACK_USE_HTTP_SERVER) /* * This is a TCP application. It listens to TCP port 80 * with one or more sockets and responds to remote requests. */ HTTPServer(); #endif #if defined(STACK_USE_FTP_SERVER) && defined(MPFS_USE_EEPROM) FTPServer(); #endif /* * In future, as new TCP/IP applications are written, it * will be added here as new tasks. */ /* * Add your application speicifc tasks here. */ ProcessIO(); /* XEEBeginRead( EEPROM_CONTROL, 0x0530 ); while ( 1 ) { c = XEERead(); c = 1; } //c = XEERead(); XEEEndRead(); */ #if defined( STACK_USE_VSCP ) vscp2_Task(); #endif /* * For DHCP information, display how many times we have renewed the IP * configuration since last reset. */ if ( DHCPBindCount != myDHCPBindCount ) { DisplayIPValue(&AppConfig.MyIPAddr, TRUE); myDHCPBindCount = DHCPBindCount; } } }
/////////////////////////////////////////////////////////////////////////////// // Main entry point. // void main(void) { static TICK8 t = 0; BYTE i; char strBuf[10]; // Initialize any application specific hardware. InitializeBoard(); // Initialize all stack related components. // Following steps must be performed for all applications using // PICmicro TCP/IP Stack. TickInit(); // Initialize file system. fsysInit(); // Intialize HTTP Execution unit htpexecInit(); // Initialze serial port serInit(); // Initialize Stack and application related NV variables. appcfgInit(); appcfgUSART(); // Configure the USART #ifdef SER_USE_INTERRUPT // Interrupt enabled serial ports have to be enabled serEnable(); #endif appcfgCpuIO(); // Configure the CPU's I/O port pin directions - input or output appcfgCpuIOValues(); // Configure the CPU's I/O port pin default values appcfgADC(); // Configure ADC unit appcfgPWM(); // Configure PWM unit // Serial configuration menu - display it for configured time and // allow user to enter configuration menu scfInit( appcfgGetc( APPCFG_STARTUP_SER_DLY ) ); StackInit(); #if defined(STACK_USE_HTTP_SERVER) HTTPInit(); #endif #if defined( STACK_USE_DHCP ) || defined( STACK_USE_IP_GLEANING ) // If DHCP is NOT enabled if ( ( appcfgGetc( APPCFG_NETFLAGS ) & APPCFG_NETFLAGS_DHCP ) == 0 ) { // Force IP address display update. myDHCPBindCount = 1; #if defined( STACK_USE_DHCP ) DHCPDisable(); #endif } #endif #if ( DEBUG_MAIN >= LOG_DEBUG ) debugPutMsg(1); //@mxd:1:Starting main loop #endif // Init VSCP functionality vscp_init(); bInitialized = FALSE; // Not initialized #if defined(STACK_USE_NTP_SERVER) // Initialize time hour = 0; minute = 0; second = 0; #endif appcfgPutc( VSCP_DM_MATRIX_BASE, 0x00 ); appcfgPutc( VSCP_DM_MATRIX_BASE+1, 0x00 ); appcfgPutc( VSCP_DM_MATRIX_BASE+2, 0x00 ); appcfgPutc( VSCP_DM_MATRIX_BASE+3, 0x00 ); // // Once all items are initialized, go into infinite loop and let // stack items execute their tasks. // If application needs to perform its own task, it should be // done at the end of while loop. // Note that this is a "co-operative mult-tasking" mechanism // where every task performs its tasks (whether all in one shot // or part of it) and returns so that other tasks can do their // job. // If a task needs very long time to do its job, it must broken // down into smaller pieces so that other tasks can have CPU time. // while ( 1 ) { // Used for initial delay to give stack and chip some time to // initialize. If not used messages sent during this time will // fail. if ( TickGet() > ( 5 * TICK_SECOND ) ) { bInitialized = TRUE; } // We should do the ftp download every three hours //if ( TickGetDiff( TickGet(), loadTime ) >= ( 3 * 3600 * TICK_SECOND ) ) { // loadTime = TickGet(); // bftpLoadWork = TRUE; //} // Blink SYSTEM LED every second. if ( appcfgGetc( APPCFG_SYSFLAGS ) & APPCFG_SYSFLAGS_BLINKB6 ) { if ( TickGetDiff8bit( t ) >= ((TICK8)( TICKS_PER_SECOND / 2 ) ) ) { t = TickGet8bit(); TRISB_RB6 = 0; LATB6 ^= 1; } } // This task performs normal stack task including checking for incoming packet, // type of packet and calling appropriate stack entity to process it. StackTask(); #if defined(STACK_USE_HTTP_SERVER) // This is a TCP application. It listens to TCP port 80 // with one or more sockets and responds to remote requests. HTTPServer(); #endif #if defined(STACK_USE_FTP_SERVER) FTPServer(); #endif // Add your application speicifc tasks here. ProcessIO(); #if defined(VSCP_USE_TCP ) // VSCP Task if ( bInitialized ) { vscp_tcp_task(); } #endif if ( bInitialized ) { vscp_main_task(); process_can_message(); if ( g_can_error ) { send_can_error_message( g_can_error ); g_can_error = 0; } } #if defined(STACK_USE_NTP_SERVER) if ( bInitialized ) { //ntp_task(); } #endif // For DHCP information, display how many times we have renewed the IP // configuration since last reset. if ( DHCPBindCount != myDHCPBindCount ) { #if (DEBUG_MAIN >= LOG_INFO) debugPutMsg( 2 ); // @mxd:2:DHCP Bind Count = %D debugPutByteHex(DHCPBindCount); #endif // Display new IP address #if (DEBUG_MAIN >= LOG_INFO) debugPutMsg( 3 ); //@mxd:3:DHCP complete, IP = %D.%D.%D.%D debugPutByteHex( AppConfig.MyIPAddr.v[ 0 ] ); debugPutByteHex( AppConfig.MyIPAddr.v[ 1 ] ); debugPutByteHex( AppConfig.MyIPAddr.v[ 2 ] ); debugPutByteHex( AppConfig.MyIPAddr.v[ 3 ] ); #endif myDHCPBindCount = DHCPBindCount; } } }
int main() { #ifdef USE_SERPORT // start serial port sbi(uart_port, uart_rx_pin); // pull up serInit(38400); #endif // initialize ports // make power detect pin input cbi(power_detect_port, power_detect_pin); cbi(power_detect_ddr, power_detect_pin); sbi(LED_port, LED_pin); sbi(LED_ddr, LED_pin); #ifdef pull_up_res #ifdef trig_on_fall // setting port = pull ups on sbi(drum_port, green_pin); sbi(drum_port, red_pin); sbi(drum_port, yellow_pin); sbi(drum_port, blue_pin); sbi(drum_port, orange_pin); #endif #else cbi(drum_port, green_pin); cbi(drum_port, red_pin); cbi(drum_port, yellow_pin); cbi(drum_port, blue_pin); cbi(drum_port, orange_pin); #endif #ifdef trig_on_rise // clearing port = pull ups off cbi(drum_port, green_pin); cbi(drum_port, red_pin); cbi(drum_port, yellow_pin); cbi(drum_port, blue_pin); cbi(drum_port, orange_pin); #endif sbi(bass_port, bass1_pin); sbi(bass_port, bass2_pin); #ifdef GHWT sbi(plusminus_port, plus_pin); sbi(plusminus_port, minus_pin); sbi(stick_port, up_stick_pin); sbi(stick_port, down_stick_pin); sbi(stick_port, left_stick_pin); sbi(stick_port, right_stick_pin); #endif // all input cbi(drum_ddr, green_pin); cbi(drum_ddr, red_pin); cbi(drum_ddr, yellow_pin); cbi(drum_ddr, blue_pin); cbi(drum_ddr, orange_pin); cbi(bass_ddr, bass1_pin); cbi(bass_ddr, bass2_pin); #ifdef GHWT cbi(plusminus_ddr, plus_pin); cbi(plusminus_ddr, minus_pin); cbi(stick_ddr, up_stick_pin); cbi(stick_ddr, down_stick_pin); cbi(stick_ddr, left_stick_pin); cbi(stick_ddr, right_stick_pin); #endif // preinitialize comparison drum_in_preg = drum_in_reg; bass_in_preg = bass_in_reg; // initialize variables wm_timer = 0; // initialize flags hit_f_l = 0xFF; hit_f_h = 0xFF; for(unsigned char i = 0; i < 8; i++) { hit_t[i] = 0; hit_s[i] = default_hit_softness; } unsigned char but_dat[6]; // struct containing button data but_dat[0] = 0b00011111; but_dat[1] = 0b00011111; but_dat[2] = 0b11111111; but_dat[3] = 0b11111111; but_dat[4] = 0b11111111; but_dat[5] = 0b11111111; // make wiimote think this is a drum wm_init(drum_id, but_dat, cal_data, wm_timer_inc); while(1) { // check if connected to wiimote if(bit_is_clear(power_detect_input, power_detect_pin)) { // disconnected #ifdef USE_SERPORT // clear serial port buffer serFlush(); #endif // handles reconnections wm_init(drum_id, but_dat, cal_data, wm_timer_inc); continue; } // check hardware check_for_hits(); check_hit_f_llags(); // apply hits but_dat[5] = hit_f_l; #ifdef USE_SERPORT unsigned char d; // serial port latest data unsigned char c; // number of char in serial port buffer d = serRx(&c); // check for serial command if(c > 0) // new command over serial port { but_dat[4] = 0xFF; but_dat[5] = 0xFF; if(bit_is_set(d, 0)) cbi(but_dat[5], green_bit); if(bit_is_set(d, 1)) cbi(but_dat[5], red_bit); if(bit_is_set(d, 2)) cbi(but_dat[5], yellow_bit); if(bit_is_set(d, 3)) cbi(but_dat[5], blue_bit); if(bit_is_set(d, 4)) cbi(but_dat[5], orange_bit); if(bit_is_set(d, 5)) cbi(but_dat[5], bass_bit); if(bit_is_set(d, 6)) cbi(but_dat[4], minus_bit); if(bit_is_set(d, 7)) cbi(but_dat[4], plus_bit); } #endif #ifdef GHWT but_dat[2] = 0xFF; but_dat[3] = 0xFF; if(but_dat[5] != 0xFF) { unsigned long t = wm_timer; // if any pads active, then send "softness" for(unsigned long i = hit_last + t; i < 16; i++) { unsigned char j = (unsigned char)(i % 8); if(bit_is_clear(but_dat[5], j)) { // set pad but_dat[2] = pad_tbl[j]; // set softness but_dat[3] = 0b00001100 | (hit_s[i] << 5); but_dat[4] &= 0b01111110; break; } } } // plus and minus buttons if(bit_is_clear(plusminus_in_reg, plus_pin)) cbi(but_dat[4], plus_bit); if(bit_is_clear(plusminus_in_reg, minus_pin)) cbi(but_dat[4], minus_bit); // simulate thumbstick with switches but_dat[0] = 0b00011111; but_dat[1] = 0b00011111; if(bit_is_clear(stick_in_reg, up_stick_pin)) but_dat[1] += thumbstick_speed; if(bit_is_clear(stick_in_reg, down_stick_pin)) but_dat[1] -= thumbstick_speed; if(bit_is_clear(stick_in_reg, left_stick_pin)) but_dat[0] -= thumbstick_speed; if(bit_is_clear(stick_in_reg, right_stick_pin)) but_dat[0] += thumbstick_speed; #endif wm_newaction(but_dat); } return 0; }
/* * Main entry point. */ void main(void) { static TICK8 t = 0; BYTE i; char strBuf[10]; /* * Initialize any application specific hardware. */ InitializeBoard(); /* * Initialize all stack related components. * Following steps must be performed for all applications using * PICmicro TCP/IP Stack. */ TickInit(); /* * Initialize file system. */ fsysInit(); //Intialize HTTP Execution unit htpexecInit(); //Initialze serial port serInit(); /* * Initialize Stack and application related NV variables. */ appcfgInit(); appcfgUSART(); //Configure the USART #ifdef SER_USE_INTERRUPT //Interrupt enabled serial ports have to be enabled serEnable(); #endif appcfgCpuIO(); //Configure the CPU's I/O port pin directions - input or output appcfgCpuIOValues(); //Configure the CPU's I/O port pin default values appcfgADC(); //Configure ADC unit //Serial configuration menu - display it for configured time and allow user to enter configuration menu scfInit(appcfgGetc(APPCFG_STARTUP_SER_DLY)); StackInit(); #if defined(STACK_USE_HTTP_SERVER) HTTPInit(); #endif #if defined(STACK_USE_FTP_SERVER) FTPInit(); #endif #if defined(STACK_USE_DHCP) || defined(STACK_USE_IP_GLEANING) //If DHCP is NOT enabled if ((appcfgGetc(APPCFG_NETFLAGS) & APPCFG_NETFLAGS_DHCP) == 0) { //Force IP address display update. myDHCPBindCount = 1; #if defined(STACK_USE_DHCP) DHCPDisable(); #endif } #endif #if (DEBUG_MAIN >= LOG_DEBUG) debugPutMsg(1); //@mxd:1:Starting main loop #endif /* * Once all items are initialized, go into infinite loop and let * stack items execute their tasks. * If application needs to perform its own task, it should be * done at the end of while loop. * Note that this is a "co-operative mult-tasking" mechanism * where every task performs its tasks (whether all in one shot * or part of it) and returns so that other tasks can do their * job. * If a task needs very long time to do its job, it must broken * down into smaller pieces so that other tasks can have CPU time. */ while(1) { //Blink SYSTEM LED every second. if (appcfgGetc(APPCFG_SYSFLAGS) & APPCFG_SYSFLAGS_BLINKB6) { if ( TickGetDiff8bit(t) >= ((TICK8)(TICKS_PER_SECOND/2)) ) { t = TickGet8bit(); TRISB_RB6 = 0; LATB6 ^= 1; } } //This task performs normal stack task including checking for incoming packet, //type of packet and calling appropriate stack entity to process it. StackTask(); #if defined(STACK_USE_HTTP_SERVER) //This is a TCP application. It listens to TCP port 80 //with one or more sockets and responds to remote requests. HTTPServer(); #endif #if defined(STACK_USE_FTP_SERVER) FTPServer(); #endif //Add your application speicifc tasks here. ProcessIO(); //For DHCP information, display how many times we have renewed the IP //configuration since last reset. if ( DHCPBindCount != myDHCPBindCount ) { #if (DEBUG_MAIN >= LOG_INFO) debugPutMsg(2); //@mxd:2:DHCP Bind Count = %D debugPutByteHex(DHCPBindCount); #endif //Display new IP address #if (DEBUG_MAIN >= LOG_INFO) debugPutMsg(3); //@mxd:3:DHCP complete, IP = %D.%D.%D.%D debugPutByteHex(AppConfig.MyIPAddr.v[0]); debugPutByteHex(AppConfig.MyIPAddr.v[1]); debugPutByteHex(AppConfig.MyIPAddr.v[2]); debugPutByteHex(AppConfig.MyIPAddr.v[3]); #endif myDHCPBindCount = DHCPBindCount; } } }
/* * Main entry point. */ void main(void) { static TICK8 t = 0; static TICK8 tmr10ms = 0; //Initialize any application specific hardware. InitializeBoard(); //Initialize all stack related components. Following steps must //be performed for all applications using PICmicro TCP/IP Stack. TickInit(); //Initialize file system. fsysInit(); //Intialize HTTP Execution unit htpexecInit(); //Initialze serial port serInit(); //Initialize Stack and application related NV variables. appcfgInit(); appcfgUSART(); //Configure the USART #ifdef SER_USE_INTERRUPT //Interrupt enabled serial ports have to be enabled serEnable(); #endif appcfgCpuIO(); //Configure the CPU's I/O port pin directions - input or output appcfgCpuIOValues(); //Configure the CPU's I/O port pin default values appcfgADC(); //Configure ADC unit appcfgPWM(); //Configure PWM Channels //Serial configuration menu - display it for configured time and allow user to enter configuration menu scfInit(appcfgGetc(APPCFG_STARTUP_SER_DLY)); //LCD Display Initialize lcdInit(); StackInit(); #if defined(STACK_USE_HTTP_SERVER) HTTPInit(); #endif #if defined(STACK_USE_FTP_SERVER) FTPInit(); #endif //Initializes "UDP Command Port" and "UDP Command Responce Port". cmdUdpInit(); #if defined(STACK_USE_DHCP) || defined(STACK_USE_IP_GLEANING) DHCPReset(); //Initialize DHCP module //If DHCP is NOT enabled if ((appcfgGetc(APPCFG_NETFLAGS) & APPCFG_NETFLAGS_DHCP) == 0) { //Force IP address display update. myDHCPBindCount = 1; #if defined(STACK_USE_DHCP) DHCPDisable(); #endif } #endif #if (DEBUG_MAIN >= LOG_DEBUG) debugPutMsg(1); //@mxd:1:Starting main loop #endif /* * Once all items are initialized, go into infinite loop and let * stack items execute their tasks. * If application needs to perform its own task, it should be * done at the end of while loop. * Note that this is a "co-operative mult-tasking" mechanism * where every task performs its tasks (whether all in one shot * or part of it) and returns so that other tasks can do their * job. * If a task needs very long time to do its job, it must broken * down into smaller pieces so that other tasks can have CPU time. */ while(1) { //Clear timer 1 every cycle, can be used to measure events. Has a overflow of 65ms. //Get delay in this function with: // TMR1L | (TMR1H<<8) TMR1H = 0; //First write to TMR1H buffer! TMR1L = 0; //This write will also update TMR1H with value written above to buffer //Blink SYSTEM LED every second. if (appcfgGetc(APPCFG_SYSFLAGS) & APPCFG_SYSFLAGS_BLINKB6) { if ( TickGetDiff8bit(t) >= ((TICK8)TICKS_PER_SECOND / (TICK8)2) ) { t = TickGet8bit(); TRISB_RB6 = 0; LATB6 ^= 1; } } //Enter each 10ms if ( TickGetDiff8bit(tmr10ms) >= ((TICK8)TICKS_PER_SECOND / (TICK8)100) ) { tmr10ms = TickGet8bit(); } //This task performs normal stack task including checking for incoming packet, //type of packet and calling appropriate stack entity to process it. StackTask(); //Process "UDP Command Port" and "UDP Command Responce Port" cmdProcess(); #if defined(STACK_USE_HTTP_SERVER) //This is a TCP application. It listens to TCP port 80 //with one or more sockets and responds to remote requests. HTTPServer(); #endif #if defined(STACK_USE_FTP_SERVER) FTPServer(); #endif #if defined(STACK_USE_ANNOUNCE) DiscoveryTask(); #endif #if defined(STACK_USE_NBNS) NBNSTask(); #endif //Add your application speicifc tasks here. ProcessIO(); //For DHCP information, display how many times we have renewed the IP //configuration since last reset. if ( DHCPBindCount != myDHCPBindCount ) { #if (DEBUG_MAIN >= LOG_INFO) debugPutMsg(2); //@mxd:2:DHCP Bind Count = %D debugPutByteHex(DHCPBindCount); #endif //Display new IP address #if (DEBUG_MAIN >= LOG_INFO) debugPutMsg(3); //@mxd:3:DHCP complete, IP = %D.%D.%D.%D debugPutByteHex(AppConfig.MyIPAddr.v[0]); debugPutByteHex(AppConfig.MyIPAddr.v[1]); debugPutByteHex(AppConfig.MyIPAddr.v[2]); debugPutByteHex(AppConfig.MyIPAddr.v[3]); #endif myDHCPBindCount = DHCPBindCount; #if defined(STACK_USE_ANNOUNCE) AnnounceIP(); #endif } } }
int main(void) { uint8_t seq_index; // index of currently active RGB sequence rgbt_t* sequence; // pointer to current rgb sequence rgbt_t* rgbt; // pointer to the current target (R,G,B,time) tuple uint8_t temp; InitHardware(); serInit(); // pwmReset(pwm); seq_index = (uint8_t) eeprom_read_word((uint16_t*)EE_SEQ_INDEX); if (seq_index >= SEQENCE_COUNT) { seq_index = DEFAULT_SEQ; sequence = SetupSequence(seq_index); } else { sequence = SetupSequence(seq_index); ocr1a_reload = eeprom_read_word((uint16_t*)EE_SPEED); } rgbt = SetupTransition(sequence, NULL); rgbt = SetupTransition(sequence, rgbt); sei(); // enable interrupts while(1) { switch (button) { case PB_SPEEDUP: // --- double speed --- button = PB_ACK; // acknowledge button event if (ocr1a_reload >= (TIME_FASTEST << 1)) { ocr1a_reload >>= 1; } else { sequence = SetupSequence(seq_index); rgbt = SetupTransition(sequence, NULL); rgbt = SetupTransition(sequence, rgbt); } break; case PB_PREV: // --- previous sequence --- button = PB_ACK; // acknowledge button event if (seq_index > 0) { seq_index--; } else { seq_index = SEQENCE_COUNT - 1; } sequence = SetupSequence(seq_index); rgbt = SetupTransition(sequence, NULL); rgbt = SetupTransition(sequence, rgbt); break; case PB_NEXT: // --- next sequence --- button = PB_ACK; // acknowledge button event if (seq_index < (SEQENCE_COUNT-1)) { seq_index++; } else { seq_index = 0; } sequence = SetupSequence(seq_index); rgbt = SetupTransition(sequence, NULL); rgbt = SetupTransition(sequence, rgbt); break; }