bool controller_key_back(void) { static bool start = false; static t_cpu_time tempo; if (!IS_JOYSTICK_KEY_PRESSED()) { gpio_set_gpio_pin(LED0_GPIO); start = false; return false; } if (!start) { cpu_set_timeout(cpu_ms_2_cy(1000, static_fcpu_hz), &tempo); start = true; } if (cpu_is_timeout(&tempo)) { gpio_clr_gpio_pin(LED0_GPIO); no_store = true; start = false; return true; } gpio_set_gpio_pin(LED0_GPIO); return false; }
void clock(u8 phase) { static u8 i; if(phase) { gpio_set_gpio_pin(B10); // clear last round for(i=0;i<8;i++) m.triggers[i] = 0; // main if(!m.freezes[0]) cascades_trigger(0); // ensure bounds, output triggers for(i=0;i<8;i++) { if(m.positions[i] < 0) m.positions[i] = 0; else if(m.positions[i] > m.points[i]) m.positions[i] = m.points[i]; // send out if(m.triggers[i] && !m.mutes[i]) gpio_set_gpio_pin(outs[i]); } monomeFrameDirty++; } else { for(i=0;i<8;i++) gpio_clr_gpio_pin(outs[i]); gpio_clr_gpio_pin(B10); } }
void display(volatile int32_t numero){//muestra numero en los leds int8_t numerox = (int8_t)numero; if (numerox & (1 << 0)) //checa el bit0 { gpio_clr_gpio_pin(LED3_GPIO); }else{ gpio_set_gpio_pin(LED3_GPIO); } if (numerox & (1 << 1)) //checa el bit0 { gpio_clr_gpio_pin(LED2_GPIO); }else{ gpio_set_gpio_pin(LED2_GPIO); } if (numerox & (1<<2)) //checa el bit0 { gpio_clr_gpio_pin(LED1_GPIO); }else{ gpio_set_gpio_pin(LED1_GPIO); } if (numerox & (1<<3)) //checa el bit0 { gpio_clr_gpio_pin(LED0_GPIO); }else{ gpio_set_gpio_pin(LED0_GPIO); } }
unsigned int FC_startup_purge(void) { unsigned int fc_state; //h2 valve still open gpio_set_gpio_pin(H2_VALVE); //close startup relay if((gpio_get_gpio_pin_output_value(RES_RELAY)|gpio_get_gpio_pin_output_value(CAP_RELAY))==0) { gpio_set_gpio_pin(START_RELAY); } //motor relay still open gpio_clr_gpio_pin(MOTOR_RELAY); //RES relay open gpio_clr_gpio_pin(RES_RELAY); //CAP relay still open gpio_clr_gpio_pin(CAP_RELAY); //open purge valve and start timer if(gpio_get_gpio_pin_output_value(PURGE_VALVE) == 0) { purge_timer = millis(); } gpio_set_gpio_pin(PURGE_VALVE); gpio_set_gpio_pin(LED0); //balazs has pseudo code purge for 3 seconds if(millis() - purge_timer < 3000) { fc_state = FC_STATE_STARTUP_PURGE; } else //3 seconds are over { //close purge valve gpio_clr_gpio_pin(PURGE_VALVE); gpio_clr_gpio_pin(LED0); //supply valve still open gpio_set_gpio_pin(H2_VALVE); //open start up relay gpio_clr_gpio_pin(START_RELAY); //other relays still open gpio_clr_gpio_pin(RES_RELAY); gpio_clr_gpio_pin(MOTOR_RELAY); gpio_clr_gpio_pin(CAP_RELAY); delay_timer1 = millis(); //reset delay timer to have delay at start of charge repress_delay = millis(); //go to repressurized delay fc_state = FC_STATE_REPRESSURIZE; } return(fc_state); }
void bfin_start_transfer(void) { // FIXME volatile u64 delay; gpio_set_gpio_pin(BFIN_RESET_PIN); delay = 30; while (--delay > 0) {;;} gpio_clr_gpio_pin(BFIN_RESET_PIN); delay = 30; while (--delay > 0) {;;} gpio_set_gpio_pin(BFIN_RESET_PIN); delay = 3000; while (--delay > 0) {;;} spi_selectChip(BFIN_SPI, BFIN_SPI_NPCS); }
/*! \brief Led Task to scroll led before reset */ void led_task() { switch(step_led_task) { case 0: gpio_clr_gpio_pin(LED1_GPIO); gpio_set_gpio_pin(LED2_GPIO); gpio_set_gpio_pin(LED3_GPIO); step_led_task=1; cpu_delay_ms(300,FOSC0); break; case 1: gpio_set_gpio_pin(LED1_GPIO); gpio_clr_gpio_pin(LED2_GPIO); gpio_set_gpio_pin(LED3_GPIO); step_led_task=2; cpu_delay_ms(300,FOSC0); break; case 2: gpio_set_gpio_pin(LED1_GPIO); gpio_set_gpio_pin(LED2_GPIO); gpio_clr_gpio_pin(LED3_GPIO); step_led_task=0; cpu_delay_ms(300,FOSC0); break; default : gpio_clr_gpio_pin(LED1_GPIO); gpio_set_gpio_pin(LED2_GPIO); gpio_set_gpio_pin(LED3_GPIO); step_led_task=1; cpu_delay_ms(300,FOSC0); break; } }
void IBN_LED_Tests (unsigned char nParamsGet_u8, unsigned char CMD_u8, unsigned int Param_u32, unsigned char* String_pu8) { if (0 == nParamsGet_u8) { CI_LocalPrintf ("LED test functions\r\n"); CI_LocalPrintf ("\r\n"); CI_LocalPrintf ("0 [0,1] LED RED off,on\r\n"); CI_LocalPrintf ("1 [0,1] LED GREEN off,on\r\n"); CI_LocalPrintf ("2 [0,1] LED RED+GREEN off,on\r\n"); CI_LocalPrintf ("\r\n"); return; } switch (CMD_u8) { case 0: if (0 == Param_u32) { gpio_clr_gpio_pin (TOOL_LED_RED_PIN); } else { gpio_set_gpio_pin (TOOL_LED_RED_PIN); } break; case 1: if (0 == Param_u32) { gpio_clr_gpio_pin (TOOL_LED_GREEN_PIN); } else { gpio_set_gpio_pin (TOOL_LED_GREEN_PIN); } break; case 2: if (0 == Param_u32) { gpio_clr_gpio_pin (TOOL_LED_GREEN_PIN); gpio_clr_gpio_pin (TOOL_LED_RED_PIN); } else { gpio_set_gpio_pin (TOOL_LED_GREEN_PIN); gpio_set_gpio_pin (TOOL_LED_RED_PIN); } break; } }
/*! \brief Write a command to the NAND flash device. * * This function will write a command to the NAND flash device, it is used * by the other functions internally in the NAND GPIO driver. * * \param nfd Pointer to the nand_driver_data struct which * holds all vital data about the NAND GPIO driver. * \param command Command to write to the NAND flash device. */ static void _nand_gpio_write_cmd(struct nand_driver_data *nfd, const uint8_t command) { _nand_gpio_write_io(nfd, command); gpio_set_gpio_pin(nfd->gpio_cont_port, nfd->gpio_cle); gpio_clr_gpio_pin(nfd->gpio_cont_port, nfd->gpio_we); //_delay_ns(t_wp); gpio_set_gpio_pin(nfd->gpio_cont_port, nfd->gpio_we); //_delay_ns(t_alh); gpio_clr_gpio_pin(nfd->gpio_cont_port, nfd->gpio_cle); }
unsigned int FC_startup_h2(void) { unsigned int fc_state; //open h2 valve gpio_set_gpio_pin(H2_VALVE); //purge valve closed gpio_clr_gpio_pin(PURGE_VALVE); //relays open gpio_clr_gpio_pin(START_RELAY); gpio_clr_gpio_pin(MOTOR_RELAY); gpio_clr_gpio_pin(RES_RELAY); gpio_clr_gpio_pin(CAP_RELAY); //input h2 until voltage reaches 30 if ((get_FCVOLT() < 30000)|(millis()-start_delay<1000)) //if voltage is less than 30V { //keep the hydrogen coming fc_state = FC_STATE_STARTUP_H2; } else { //voltage is 30 then go to start up purge fc_state = FC_STATE_STARTUP_PURGE; } return(fc_state); }
unsigned int FC_shutdown(void) { unsigned int fc_state; gpio_clr_gpio_pin(LED_START); gpio_clr_gpio_pin(LED_RUN); gpio_set_gpio_pin(LED_STOP); //close valves gpio_clr_gpio_pin(H2_VALVE); gpio_clr_gpio_pin(PURGE_VALVE); //close relays gpio_clr_gpio_pin(MOTOR_RELAY); gpio_clr_gpio_pin(START_RELAY); gpio_clr_gpio_pin(RES_RELAY); gpio_clr_gpio_pin(CAP_RELAY); //fans to max FANUpdate(1024); if(0) { //option of leaving shutdown state and restarting fc_state = FC_STATE_STANDBY; } else { fc_state = FC_STATE_SHUTDOWN; } return(fc_state); }
void vMACBWaitForInput( unsigned long ulTimeOut ) { #ifdef FREERTOS_USED // Just wait until we are signled from an ISR that data is available, or // we simply time out. xSemaphoreTake( xSemaphore, ulTimeOut ); #else unsigned long i; gpio_clr_gpio_pin(LED0_GPIO); i = ulTimeOut * 1000; // wait for an interrupt to occurs do { if ( DataToRead == TRUE ) { // IT occurs, reset interrupt flag portENTER_CRITICAL(); DataToRead = FALSE; portEXIT_CRITICAL(); break; } i--; } while(i != 0); gpio_set_gpio_pin(LED0_GPIO); #endif }
void bfin_start_transfer(void) { #if 1 #else // volatile u64 delay; gpio_set_gpio_pin(BFIN_RESET_PIN); // delay = 30; while (--delay > 0) {;;} delay_ms(1); gpio_clr_gpio_pin(BFIN_RESET_PIN); // delay = 30; while (--delay > 0) {;;} delay_ms(1); gpio_set_gpio_pin(BFIN_RESET_PIN); // delay = 3000; while (--delay > 0) {;;} delay_ms(1); spi_selectChip(BFIN_SPI, BFIN_SPI_NPCS); #endif }
unsigned int FC_standby(void) { unsigned int fc_state; if (gpio_get_pin_value(START)) { fc_state = FC_STATE_STARTUP_FANS; gpio_clr_gpio_pin(LED_STOP); gpio_set_gpio_pin(LED_START); } else { //make sure fuel cell stays off //Supply valve closed gpio_clr_gpio_pin(H2_VALVE); //purge valve closed gpio_clr_gpio_pin(PURGE_VALVE); //relays open gpio_clr_gpio_pin(MOTOR_RELAY); gpio_clr_gpio_pin(RES_RELAY); gpio_clr_gpio_pin(CAP_RELAY); //led's off gpio_clr_gpio_pin(LED_RUN); gpio_clr_gpio_pin(LED_START); gpio_clr_gpio_pin(LED_STOP); //fan low FANUpdate(0); fc_state = FC_STATE_STANDBY; } return(fc_state); }
/*! \brief Watchdog scheduler */ void wdt_scheduler(void) { volatile avr32_pm_t* pm = &AVR32_PM; // If Reset Cause is due to a Watchdog reset just relaunch Watchdog and turn // LED0 to 4 on to let user know that a new wdt reset has occurred. if (pm->RCAUSE.wdt) { wdt_reenable(); gpio_clr_gpio_pin(LED0_GPIO); gpio_set_gpio_pin(LED1_GPIO); gpio_set_gpio_pin(LED2_GPIO); gpio_set_gpio_pin(LED3_GPIO); cpu_delay_ms(300,FOSC0); } // If Reset Cause is due to a Power On reset, enable Watchdog with default value else if (pm->RCAUSE.por) { opt.us_timeout_period = WDT_MIN_VALUE_US ; // Save current value in GPLP register pm_write_gplp(pm, 0, opt.us_timeout_period); wdt_enable(&opt); } // If Reset Cause is due to an External reset, increment opt.us_timeout_period else if (pm->RCAUSE.ext) { // Reload current value stored in GPLP register opt.us_timeout_period = pm_read_gplp(pm, 0); opt.us_timeout_period += WDT_CTRL_STEP_US; if (opt.us_timeout_period >= WDT_MAX_VALUE_US) opt.us_timeout_period = WDT_MIN_VALUE_US; wdt_enable(&opt); // Save new value in GPLP register pm_write_gplp(pm,0,opt.us_timeout_period); } // Else relaunch Watchdog and toggle GPIO to let user know that a new reset has occurred else { opt.us_timeout_period = WDT_MIN_VALUE_US; // Save start value of watchdog in GPLP register pm_write_gplp(pm, 0, opt.us_timeout_period); wdt_enable(&opt); } }
void gui_init(uint32_t fcpu_hz, uint32_t fhsb_hz, uint32_t fpbb_hz, uint32_t fpba_hz) { et024006_Init(fcpu_hz, fhsb_hz); et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK); gpio_set_gpio_pin(ET024006DHU_BL_PIN); load_sdram_data(fhsb_hz); draw_startup(0, 0); }
//! @brief Get data report from Host //! void hid_report_out(void) { int led_number; int led_state; if(Is_usb_out_received(EP_HID_GENERIC_OUT)) { Usb_reset_endpoint_fifo_access(EP_HID_GENERIC_OUT); memset(rxbuf, 0, RXBUF_SIZE); usb_read_ep_rxpacket(EP_HID_GENERIC_OUT, &rxbuf, RXBUF_SIZE, NULL); Usb_ack_out_received_free(EP_HID_GENERIC_OUT); // The Data has been read and stored in rxbuf led_state = rxbuf[0]&0x0F; // RepportOUT[0] is LEDS value led_number = rxbuf[1]&0x0F; switch (led_number) { case 1: if(led_state) { gpio_clr_gpio_pin(LED0_GPIO); } else { gpio_set_gpio_pin(LED0_GPIO);} break; case 2: if(led_state) { gpio_clr_gpio_pin(LED1_GPIO); } else { gpio_set_gpio_pin(LED1_GPIO);} break; case 3: if(led_state) { gpio_clr_gpio_pin(LED2_GPIO); } else { gpio_set_gpio_pin(LED2_GPIO);} break; case 4: if(led_state) { gpio_clr_gpio_pin(LED3_GPIO); } else { gpio_set_gpio_pin(LED3_GPIO);} break; } } //** Check if we received DFU mode command from host if(jump_bootloader) { uint32_t volatile tempo; gpio_set_gpio_pin(LED0_GPIO); gpio_set_gpio_pin(LED1_GPIO); gpio_set_gpio_pin(LED2_GPIO); gpio_set_gpio_pin(LED3_GPIO); Usb_detach(); // Detach actual generic HID application for(tempo=0;tempo<70000;tempo++); // Wait some time before //start_boot(); // Jumping to bootloader while(1); } }
/*! * \brief function to configure LCD */ void gui_init(U32 fcpu_hz, U32 fhsb_hz, U32 fpbb_hz, U32 fpba_hz) { delay_init(fcpu_hz); et024006_Init( fcpu_hz, fhsb_hz ); gpio_set_gpio_pin(ET024006DHU_BL_PIN); et024006_DrawFilledRect(0 , 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK ); gui_print_default_message(); }
static void handle_Switch4(s32 data) { // mode switch if(data > 0) { if(pages_toggle_play()) { gpio_set_gpio_pin(LED_MODE_PIN); } else { gpio_clr_gpio_pin(LED_MODE_PIN); } } }
/*! \brief Write an I/O value to the I/O port on the NAND flash. * * This internal function writes a value to the I/O port on the NAND flash. * It is mandatory to send appropriate NAND flash commands before trying to * write any values. * * \param nfd Pointer to the nand_driver_data struct which * holds all vital data about the NAND GPIO driver. * * \param data Data to write to the I/O port on the NAND flash. */ static inline void nand_gpio_write_io(struct nand_driver_data *nfd, const uint8_t data) { _nand_gpio_write_io(nfd, data); gpio_clr_gpio_pin(nfd->gpio_cont_port, nfd->gpio_we); _delay_ns(t_wp); gpio_set_gpio_pin(nfd->gpio_cont_port, nfd->gpio_we); _delay_ns(t_wh); }
/** \brief Drive voltage gradient on Y surface (YL=GND, YH=VDD). */ static void inline rtouch_gradient_y_surface(void) { gpio_enable_gpio_pin(rtouch_gpio_ymap[1].pin); gpio_enable_gpio_pin(rtouch_gpio_ymap[0].pin); gpio_disable_pin_pull_up(rtouch_gpio_ymap[0].pin); gpio_disable_pin_pull_up(rtouch_gpio_ymap[1].pin); gpio_clr_gpio_pin(rtouch_gpio_ymap[0].pin); gpio_set_gpio_pin(rtouch_gpio_ymap[1].pin); }
unsigned int FC_alarm(void) { unsigned int fc_state; gpio_clr_gpio_pin(LED_RUN); gpio_clr_gpio_pin(LED_START); gpio_set_gpio_pin(LED_ERROR); gpio_set_gpio_pin(LED_STOP); //close valves gpio_clr_gpio_pin(H2_VALVE); gpio_clr_gpio_pin(PURGE_VALVE); //close relays gpio_clr_gpio_pin(MOTOR_RELAY); gpio_clr_gpio_pin(START_RELAY); gpio_clr_gpio_pin(RES_RELAY); gpio_clr_gpio_pin(CAP_RELAY); FANUpdate(1024); fc_state = FC_STATE_ALARM; //manual reset required to exit alarm state return(fc_state); }
// this gets called whenever there is a clock trigger void clock(u8 phase) { if(phase) { gpio_set_gpio_pin(B10); // set the clock output // here you would do whatever should happen on each clock trigger // like advancing a step in a sequencer // don't to anything too long here - consider using timers for that } else { gpio_clr_gpio_pin(B10); // clear the clock output } }
/*! \brief Read an I/O value from the I/O port on the NAND flash. * * This internal function reads a value from the I/O port on the NAND flash. * It is mandatory to send appropriate NAND flash commands before trying to * read out any values. * * \param nfd Pointer to the nand_driver_data struct which * holds all vital data about the NAND GPIO driver. * * \return I/O value read from the device. */ static inline uint8_t nand_gpio_read_io(const struct nand_driver_data *nfd) { static uint8_t byte; gpio_clr_gpio_pin(nfd->gpio_cont_port, nfd->gpio_re); _delay_ns(t_rc); byte = *(nfd->gpio_io_pin); gpio_set_gpio_pin(nfd->gpio_cont_port, nfd->gpio_re); return byte; }
/* \brief Initialize board. * */ void init_board(void) { #ifdef MAX_SPEED init_sys_clocks(); #else pcl_switch_to_osc(PCL_OSC0, FOSC0, OSC0_STARTUP); #endif INTC_init_interrupts(); init_dbg_rs232(FPBA_HZ); // Activate LED0 & LED1 & LED2 & LED3 pins in GPIO output // mode and switch them off. gpio_set_gpio_pin(LED0_GPIO); gpio_set_gpio_pin(LED1_GPIO); gpio_set_gpio_pin(LED2_GPIO); gpio_set_gpio_pin(LED3_GPIO); et024006_Init(FCPU_HZ, FCPU_HZ); gpio_set_gpio_pin(ET024006DHU_BL_PIN); et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, WHITE); }
//! //! @brief This function initializes the hardware/software resources //! required for the MMI task. //! void mmi_task_init(uint32_t cpu_f, uint32_t pba_f) { // Initialize the LCD. et024006_Init( cpu_f, cpu_f /*HSB*/); // Clear the display i.e. make it black et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK ); // Set the backlight. gpio_set_gpio_pin(ET024006DHU_BL_PIN); mmi_state = MMI_TOP_MENU_START; }
//! //! @brief This function initializes the hardware/software resources //! required for device CDC task. //! void uac2_AK5394A_task_init(void) { current_freq.frequency = 96000; AK5394A_task_init(FALSE); gpio_clr_gpio_pin(SAMPLEFREQ_VAL1); gpio_set_gpio_pin(SAMPLEFREQ_VAL0); xTaskCreate(uac2_AK5394A_task, configTSK_AK5394A_NAME, configTSK_AK5394A_STACK_SIZE, NULL, UAC2_configTSK_AK5394A_PRIORITY, NULL); }
__interrupt #endif void touch_button_isr(void) { manage_button_isr(QT1081_TOUCH_SENSOR_UP, JOYSTICK_STATUS_UP, JOYSTICK_STATUS_RELEASED_UP); manage_button_isr(QT1081_TOUCH_SENSOR_DOWN, JOYSTICK_STATUS_DOWN, JOYSTICK_STATUS_RELEASED_DOWN); manage_button_isr(QT1081_TOUCH_SENSOR_RIGHT, JOYSTICK_STATUS_RIGHT, JOYSTICK_STATUS_RELEASED_RIGHT); manage_button_isr(QT1081_TOUCH_SENSOR_LEFT, JOYSTICK_STATUS_LEFT, JOYSTICK_STATUS_RELEASED_LEFT); manage_button_isr(QT1081_TOUCH_SENSOR_ENTER, JOYSTICK_STATUS_PRESSED, JOYSTICK_STATUS_RELEASED_PRESSED); if (IS_JOYSTICK_KEY_UP()) gpio_clr_gpio_pin(LED1_GPIO); else gpio_set_gpio_pin(LED1_GPIO); if (IS_JOYSTICK_KEY_PRESSED()) gpio_clr_gpio_pin(LED2_GPIO); else gpio_set_gpio_pin(LED2_GPIO); if (IS_JOYSTICK_KEY_DOWN()) gpio_clr_gpio_pin(LED3_GPIO); else gpio_set_gpio_pin(LED3_GPIO); }
__interrupt #endif void rtc_irq(void) { static volatile int delay_count=0; static unsigned short all_key= 0; static int update_delay = 0; delay_count++; update_delay++; if(update_delay>10) { if(special_qt60168_report_all_key(&all_key)==true) { update_delay=0; //gpio_tgl_gpio_pin(LED2_GPIO); Old_status = New_status; New_status = all_key; // The one that has just been read if(Old_status != New_status) { update_joystick_status( New_status); } if(New_status!=0) { // LED2 on if key is currently pressed gpio_clr_gpio_pin(LED2_GPIO); } else { gpio_set_gpio_pin(LED2_GPIO); } } } if(Read_data==1) { Read_data=2; delay_count=0; } if((delay_count>1)&&(Read_data==2)) { // We can read the DATA // Select QT60168 spi_selectChip(QT60168_SPI,QT60168_SPI_NCPS); // Read Reply spi_read(QT60168_SPI, &Data); // Unselect QT60168 spi_unselectChip(QT60168_SPI,QT60168_SPI_NCPS); Read_data=0; } // clear the interrupt flag rtc_clear_interrupt(&AVR32_RTC); }
/** * \brief Autonomous QTouch status change interrupt callback function. * This callback function is called by the Touch library in the * CAT Autonomous QTouch status change Interrupt context, each time * there is a status change in the Autonomous Touch sensor. * * \param p_at_status: Autonomous QTouch status. * p_at_status->status_change: Autonomous QTouch status change. * p_at_status->base_count: Autonomous QTouch base count value. * p_at_status->current_count: Autonomous QTouch current count value. * \note 1. CAUTION - This callback function is called in the CAT Autonomous * QTouch Status change INTERRUPT SERVICE ROUTINE by the Touch Library. * 2. The Autonomous QTouch Status change callback is called both for * an IN_TOUCH status change and an OUT_OF_TOUCH status change. */ void touch_at_status_change_interrupt_callback(touch_at_status *p_at_status) { /* Enable GPIO clock after waking from sleep mode */ sysclk_enable_pba_module(SYSCLK_GPIO); if (p_at_status->status_change == IN_TOUCH) { autonomous_qtouch_in_touch = 1u; #if DEF_TOUCH_QDEBUG_ENABLE == 0 /* Turn ON LED0 once Autonomous QTouch sense is detected. */ gpio_clr_gpio_pin(STATUS_LED); #endif } else { autonomous_qtouch_in_touch = 0u; #if DEF_TOUCH_QDEBUG_ENABLE == 0 /* Turn ON LED0 once Autonomous QTouch sense is detected. */ gpio_set_gpio_pin(STATUS_LED); #endif } } /* End of touch_at_status_change_interrupt_callback() */
void ms3_dac_start(U32 sample_rate_hz, U8 num_channels, U8 bits_per_sample, bool swap_channels, void (*callback)(U32 arg), U32 callback_opt, U32 pba_hz) { ms3_dac_stop(); // Enable 4.2V for MS3. gpio_set_gpio_pin(AVR32_PIN_PA24); // Enable SSC interface gpio_enable_module(MS3_GPIO_MAP, sizeof(MS3_GPIO_MAP) / sizeof(MS3_GPIO_MAP[0])); // Interrupt is registered before we enable the PDCA. This to make sure no unhandled // interrupt case will be met. (after a CPU reset for example). INTC_register_interrupt(&ms3_ssc_tx_pdca_int_handler, AVR32_PDCA_IRQ_0, AVR32_INTC_INT2); ms3_dac_setup(sample_rate_hz, num_channels, bits_per_sample, swap_channels, callback, callback_opt, pba_hz); }