/* * Main function */ void main(void) { // for temperature sensor //SysCtlClockSet(SYSCTL_SYSDIV_5|SYSCTL_USE_PLL|SYSCTL_OSC_MAIN|SYSCTL_XTAL_16MHZ); lcd_init(); // initialize LCD in 8 bit mode hardware_init(); // Configure ADC spi_config_SSI0(); //while(1) //{ sendto_Dpot(0,((R0*256)/100000)-1); sendto_Dpot(1,((R1*256)/100000)-1); sendto_Dpot(2,((R2*256)/100000)-1); sendto_Dpot(3,((R3*256)/100000)-1); sendto_Dpot(4,((R4*256)/100000)-1); sendto_Dpot(5,((R5*256)/100000)-1); sendto_Dpot(6,((R6*256)/100000)-1); sendto_Dpot(7,((R7*256)/100000)-1); while(1); //} }
int main(void) { void *rw_hash; hardware_init(); debug_printf("%s started\n", is_ro_mode() ? "RO" : "RW"); /* the RO partition protection is not enabled : do it */ if (!flash_physical_is_permanently_protected()) flash_physical_permanent_protect(); /* * calculate the hash of the RW partition * * Also pre-cache it so we can answer Discover Identity VDM * fast enough (in less than 30ms). */ rw_hash = flash_hash_rw(); /* Verify RW firmware and use it if valid */ if (is_ro_mode() && check_rw_valid(rw_hash)) jump_to_rw(); /* background loop for PD events */ pd_task(); debug_printf("EXIT!\n"); /* we should never reach that point */ system_reset(0); return 0; }
//--------------------------------------------------------------------------- // main() //--------------------------------------------------------------------------- void main(void) { char i=1,l=2; hardware_init(); // init hardware via Xware while(1) // forever loop { if((GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_4)==0)) { if(i<4) i=i<<1; else i=1; } while((GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_4)==0)); if((GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0)==0)) { if(l<8) l=l<<1; else l=2; } while((GPIOPinRead(GPIO_PORTF_BASE, GPIO_PIN_0)==0)); ledToggle(l); delay(i); } }
void AP_InertialSensor_MPU6000::init( AP_PeriodicProcess * scheduler ) { if (_initialised) return; _initialised = 1; hardware_init(); scheduler->register_process( &AP_InertialSensor_MPU6000::read ); }
/*! * @brief Main function */ int main (void) { // RX buffers //! @param receiveBuff Buffer used to hold received data uint8_t receiveBuff; // Initialize standard SDK demo application pins hardware_init(); // Call this function to initialize the console UART. This function // enables the use of STDIO functions (printf, scanf, etc.) dbg_uart_init(); // Print the initial banner PRINTF("\r\nHello World!\n\n\r"); while(1) { // Main routine that simply echoes received characters forever // First, get character receiveBuff = GETCHAR(); // Now echo the received character PUTCHAR(receiveBuff); } }
/** * @ingroup firmware * * * * @param boot_dev * @param arm_m_type * @param atags * @return */ int notmain(uint32_t boot_dev, uint32_t arm_m_type, uint32_t atags) { hardware_init(); dmx_init(); printf("Compiled on %s at %s\n", __DATE__, __TIME__); ui_start(0x00); // User Interface ui_reinit(); ui_text_line_1("DMX512 Receiver", 15); ui_text_line_2("Booting........", 15); dmx_devices_read_config(); dmx_devices_init(); watchdog_init(); events_init(); for (;;) { watchdog_feed(); int i = 0; for (i = 0; i < sizeof(poll_table) / sizeof(poll_table[0]); i++) { poll_table[i].f(); } events_check(); } return 0; }
void notmain(void) { int i; hardware_init(); dmx_init(); dmx_set_port_direction(DMX_PORT_DIRECTION_INP, true); rdm_device_info_init(); printf("[V%s] %s Compiled on %s at %s\n", DEVICE_SOFTWARE_VERSION, hardware_board_get_model(), __DATE__, __TIME__); printf("RDM Responder / DMX Slave, Devices connected : %d\n", dmx_devices_get_devices_connected()); const uint8_t *uid_device = rdm_device_info_get_uuid(); printf("Device UUID : %.2x%.2x:%.2x%.2x%.2x%.2x, Label :", uid_device[0], uid_device[1], uid_device[2], uid_device[3], uid_device[4], uid_device[5]); monitor_print_root_device_label(); hardware_watchdog_init(); events_init(); for (;;) { for (i = 0; i < (int)(sizeof(poll_table) / sizeof(poll_table[0])); i++) { poll_table[i].f(); hardware_watchdog_feed(); } events_check(); } }
void main(void) { // Stash board info from the bootloader before we let anything touch // the SFRs. // g_board_frequency = BOARD_FREQUENCY_REG; g_board_bl_version = BOARD_BL_VERSION_REG; // try to load parameters; set them to defaults if that fails. // this is done before hardware_init() to get the serial speed // XXX default parameter selection should be based on board info // if (!param_load()) param_default(); // setup boolean features feature_mavlink_framing = param_get(PARAM_MAVLINK)?true:false; feature_opportunistic_resend = param_get(PARAM_OPPRESEND)?true:false; feature_golay = param_get(PARAM_ECC)?true:false; feature_rtscts = param_get(PARAM_RTSCTS)?true:false; // Do hardware initialisation. hardware_init(); // do radio initialisation radio_init(); // turn on the receiver if (!radio_receiver_on()) { panic("failed to enable receiver"); } tdm_serial_loop(); }
void main(void) { PHY_STATUS s; hardware_init(); puts("SiK radio starting"); // Init the radio driver s = rtPhyInit(); if (s != PHY_STATUS_SUCCESS) panic("rtPhyInit failed: %u", s); // try to load parameters; set them to defaults if that fails // XXX default parameter selection should be based on strapping // options if (!param_load()) param_default_434(); // XXX this should almost certainly be replaced with the ppPhy code // plus some minor parameter tweaking. rtPhySet(TRX_FREQUENCY, param_get32(PARAM_TRX_FREQUENCY)); rtPhySet(TRX_CHANNEL_SPACING, param_get32(PARAM_TRX_CHANNEL_SPACING)); rtPhySet(TRX_DEVIATION, param_get32(PARAM_TRX_DEVIATION)); rtPhySet(TRX_DATA_RATE, param_get32(PARAM_TRX_DATA_RATE)); rtPhySet(RX_BAND_WIDTH, param_get32(PARAM_RX_BAND_WIDTH)); s = rtPhyInitRadio(); if (s != PHY_STATUS_SUCCESS) panic("rtPhyInitRadio failed: %u", s); puts("radio config done"); panic("bored, bored bored..."); }
/** * @ingroup firmware * * * * @param boot_dev * @param arm_m_type * @param atags * @return */ int notmain(uint32_t boot_dev, uint32_t arm_m_type, uint32_t atags) { int i = 0; hardware_init(); dmx_init(); dmx_devices_init(); hardware_print_board_model(); printf("Compiled on %s at %s\n", __DATE__, __TIME__); printf("DMX Slave-Analyzer, Devices connected : %d\n", dmx_devices_get_devices_connected()); ui_start(0x00); // User Interface ui_reinit(); ui_text_line_1("DMX512 Receiver", 15); ui_text_line_2("Booting........", 15); dmx_devices_init(); hardware_watchdog_init(); events_init(); for (;;) { hardware_watchdog_feed(); for (i = 0; i < sizeof(poll_table) / sizeof(poll_table[0]); i++) { poll_table[i].f(); } events_check(); } return 0; }
int main() { hardware_init(); /* // create a LED task xTaskCreate( prvLEDTask, ( signed portCHAR * ) "LED", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); */ // create a LCD task to display the queue content xTaskCreate( prvLCDTask, ( signed portCHAR * ) "LCD", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); // create a Xbee task xTaskCreate( prvXbeeTask, ( signed portCHAR * ) "prvXbeeTask", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); // create left & right button tasks xTaskCreate( prvL_buttonTask, ( signed portCHAR * ) "L_button", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); xTaskCreate( prvR_buttonTask, ( signed portCHAR * ) "R_button", configMINIMAL_STACK_SIZE, NULL, tskIDLE_PRIORITY + 1, NULL ); // start the scheduler vTaskStartScheduler(); return 0; }
static int znet_open(struct device *dev) { int ioaddr = dev->base_addr; if (znet_debug > 2) printk(KERN_DEBUG "%s: znet_open() called.\n", dev->name); /* Turn on the 82501 SIA, using zenith-specific magic. */ outb(0x10, 0xe6); /* Select LAN control register */ outb(inb(0xe7) | 0x84, 0xe7); /* Turn on LAN power (bit 2). */ /* According to the Crynwr driver we should wait 50 msec. for the LAN clock to stabilize. My experiments indicates that the '593 can be initialized immediately. The delay is probably needed for the DC-to-DC converter to come up to full voltage, and for the oscillator to be spot-on at 20Mhz before transmitting. Until this proves to be a problem we rely on the higher layers for the delay and save allocating a timer entry. */ /* This follows the packet driver's lead, and checks for success. */ if (inb(ioaddr) != 0x10 && inb(ioaddr) != 0x00) printk(KERN_WARNING "%s: Problem turning on the transceiver power.\n", dev->name); dev->tbusy = 0; dev->interrupt = 0; hardware_init(dev); dev->start = 1; return 0; }
/*! * @brief DAC example. * * This function uses terminal to enter DAC value and * convert this value to DAC output. */ int main(void) { dac_converter_config_t dacUserConfig; uint32_t ch; // Initialize hardware hardware_init(); PRINTF("\r\nDAC Example.\r\n"); // Fill the structure with configuration of software trigger. DAC_DRV_StructInitUserConfigNormal(&dacUserConfig); // Initialize the DAC Converter. DAC_DRV_Init(DAC_INSTANCE, &dacUserConfig); while(1) { ch = 0xFFFFu; PRINTF("Enter the value for DAC input from 0 to 4095 \r\n "); while (ch > 4095u) { SCANF("%d", &ch); } PRINTF("Check oscilloscope to see DAC output of %d\r\n",ch); DAC_DRV_Output(DAC_INSTANCE, (uint16_t)ch); } }
int main() { char * AT = "\r\nAT\r\n";//Setting up a char variable AT for the a long string hardware_init(); send(AT); while(1) {} }
// Bootloader entry logic // void bl_main(void) { uint8_t i; // Do early hardware init hardware_init(); // Work out why we reset // // Note that if PORSF (bit 1) is set, all other bits are invalid. reset_source = RSTSRC; if (reset_source & (1 << 1)) reset_source = 1 << 1; // Check for app validity app_valid = flash_app_valid(); // Do some simple debouncing on the bootloader-entry // strap/button. debounce_count = 0; for (i = 0; i < 255; i++) { if (BUTTON_BOOTLOAD == BUTTON_ACTIVE) debounce_count++; } // Turn on the LED to indicate the bootloader is running LED_BOOTLOADER = LED_ON; // Boot the application if: // // - The reset was not due to a flash error (the app uses this to reboot // into the bootloader) // - The signature is valid. // - The boot-to-bootloader strap/button is not in the active state. // if (!(reset_source & (1 << 6)) && app_valid) { // The button was not entirely pressed - play it safe // and boot the app. // if (debounce_count < 200) { // Stash board info in SFRs for the application to find later // BOARD_FREQUENCY_REG = board_frequency; BOARD_BL_VERSION_REG = BL_VERSION; // And jump ((void (__code *)(void))FLASH_APP_START)(); } } // Bootloader loop // for (;;) bootloader(); }
/** * \brief Application entry point. * * \return Unused (ANSI-C compatibility). */ int main( void ) { // Initialize hardware hardware_init() ; while ( 1 ) { } }
uint16_t AP_InertialSensor_MPU6000_I2C::init( AP_PeriodicProcess * scheduler ) { if (_initialised) return _product_id; _initialised = 1; delay(50); hardware_init(); scheduler->register_process( &AP_InertialSensor_MPU6000_I2C::read ); return _product_id; }
int main() { hardware_init(); platform_run(); soft_timer_set_handler(&tx_timer, alarm, NULL); soft_timer_start(&tx_timer, soft_timer_s_to_ticks(1), 1); return 0; }
int main (void) { /* Initialize MCU clock */ hardware_init(); OSA_TaskCreate(OSA_TASK(startup_task), NULL); vTaskStartScheduler(); return 0; }
int main() { hardware_init(); enable_UART0_receive_interrupt(); PRINTF("UART0 Test Code\n\r"); PRINTF("Any entered character will be echoed\r\n\n"); while(1) { } }
/*! * @brief Check send/receive non blocking with DMA * */ int main(void) { uint8_t rxChar = 0, txChar = 0; uint32_t byteCountBuff = 0; // Config the eDMA driver edma_user_config_t userConfig = { .chnArbitration = kEDMAChnArbitrationRoundrobin, .notHaltOnError = false }; // Config the UART driver lpuart_edma_user_config_t lpuartConfig = { .clockSource = BOARD_LPUART_CLOCK_SOURCE, .bitCountPerChar = kLpuart8BitsPerChar, .parityMode = kLpuartParityDisabled, .stopBitCount = kLpuartOneStopBit, .baudRate = BOARD_DEBUG_UART_BAUD }; // Store runtime state structure for the eDMA driver edma_state_t state; // Store runtime state structure for LPUART driver with EDMA lpuart_edma_state_t lpuartStateDma; // Enable clock for PORTs, setup board clock source hardware_init(); // Initialize EDMA module for LPUART EDMA_DRV_Init(&state, &userConfig); LPUART_DRV_EdmaInit(BOARD_DEBUG_UART_INSTANCE, &lpuartStateDma, &lpuartConfig); // Send data block to terminal by non blocking manner byteCountBuff = sizeof(buffStart); LPUART_DRV_EdmaSendData(BOARD_DEBUG_UART_INSTANCE, buffStart, byteCountBuff); while (kStatus_LPUART_TxBusy == LPUART_DRV_EdmaGetTransmitStatus(BOARD_DEBUG_UART_INSTANCE, NULL)){} // Inform user of what to do byteCountBuff = sizeof(bufferData1); LPUART_DRV_EdmaSendData(BOARD_DEBUG_UART_INSTANCE, bufferData1, byteCountBuff); while (kStatus_LPUART_TxBusy == LPUART_DRV_EdmaGetTransmitStatus(BOARD_DEBUG_UART_INSTANCE, NULL)){} // Send/receive non blocking function while(true) { rxChar = 0; // Wait to receive input data LPUART_DRV_EdmaReceiveData(BOARD_DEBUG_UART_INSTANCE, &rxChar, 1u); while (kStatus_LPUART_RxBusy == LPUART_DRV_EdmaGetReceiveStatus(BOARD_DEBUG_UART_INSTANCE, NULL)){} txChar = rxChar; // Send any character that received LPUART_DRV_EdmaSendData(BOARD_DEBUG_UART_INSTANCE, &txChar, 1u); } }
void APP_Start (void) { hardware_init(); /* initialize the hardware */ /* create tasks */ #if USE_SDK_RTOS SDK_CreateTask(); /* create a task with the Kinetis SDK API */ OSA_Start(); #else CreateTask(); /* create a task with the 'traditional' FreeRTOS API */ vTaskStartScheduler(); /* start FreeRTOS scheduler, does usually not return! */ #endif }
/*! * @brief Check send/receive non blocking functionality * */ int main(void) { uint8_t rxChar = 0, txChar = 0; uint32_t byteCountBuff = 0; lpsci_state_t lpsciState; // Fill in lpsci config data lpsci_user_config_t lpsciConfig = { #if defined(KL02Z4_SERIES) .clockSource = kClockLpsciSrcFll, #else .clockSource = kClockLpsciSrcPllFllSel, #endif .bitCountPerChar = kLpsci8BitsPerChar, .parityMode = kLpsciParityDisabled, .stopBitCount = kLpsciOneStopBit, .baudRate = BOARD_DEBUG_UART_BAUD }; // Enable clock for PORTs, setup board clock source hardware_init(); // Initialize the lpsci module with base address and config structure LPSCI_DRV_Init(BOARD_DEBUG_UART_INSTANCE, &lpsciState, &lpsciConfig); // Inform to start blocking example byteCountBuff = sizeof(buffStart); if (kStatus_LPSCI_Success == LPSCI_DRV_SendData(BOARD_DEBUG_UART_INSTANCE, buffStart, byteCountBuff)) { while (kStatus_LPSCI_TxBusy == LPSCI_DRV_GetTransmitStatus(BOARD_DEBUG_UART_INSTANCE, NULL)) {} } // Inform user of what to do byteCountBuff = sizeof(bufferData1); if (kStatus_LPSCI_Success == LPSCI_DRV_SendData(BOARD_DEBUG_UART_INSTANCE, bufferData1, byteCountBuff)) { while (kStatus_LPSCI_TxBusy == LPSCI_DRV_GetTransmitStatus(BOARD_DEBUG_UART_INSTANCE, NULL)) {} } while(true) { // Wait to receive input data if(kStatus_LPSCI_Success == LPSCI_DRV_ReceiveData(BOARD_DEBUG_UART_INSTANCE, &rxChar, 1u)) { // Wait until we receive a user character while (kStatus_LPSCI_RxBusy == LPSCI_DRV_GetReceiveStatus(BOARD_DEBUG_UART_INSTANCE, NULL)) {} // Echo received character txChar = rxChar; LPSCI_DRV_SendData(BOARD_DEBUG_UART_INSTANCE, &txChar, 1u); } } }
static void app_low_level_init(void) { // Open uart module for debug hardware_init(); // Open ENET clock gate CLOCK_SYS_EnableEnetClock(0); // Select PTP timer outclk CLOCK_SYS_SetEnetTimeStampSrc(0, kClockTimeSrcOsc0erClk); // Disable the mpu MPU_BWR_CESR_VLD(MPU, 0); }
int main(void) { /* Initialize board hardware */ hardware_init(); OSA_Init(); /* Initialize debug serial interface */ dbg_uart_init(); /* Call example task */ ltc_example_task(); while(1); }
void config_init() { logprintf(LOG_STACK, "%s(...)", __FUNCTION__); hardware_init(); settings_init(); devices_init(); gui_init(); #ifdef EVENTS rules_init(); #endif registry_init(); }
/** * \brief Application entry point. * * \return Unused (ANSI-C compatibility). */ int main( void ) { // Disable Watchdog WDT->WDT_MR = WDT_MR_WDDIS ; // Initialize hardware hardware_init() ; while ( 1 ) { } }
/*! * @brief Main demo function - no defined hardware */ int main(void) { // Initialise the hardware board hardware_init(); printf("\r\n...main...\r\n"); for(;;) { printf("...Tick...\r\n"); __asm__("nop"); } }
int main(void) { hardware_init(); configure_gpio_pins(PORTB_IDX); configure_gpio_pins(PORTE_IDX); GPIO_DRV_SetPinDir(kGpioLED1, kGpioDigitalOutput); GPIO_DRV_SetPinDir(kGpioLED2, kGpioDigitalOutput); GPIO_DRV_SetPinDir(kGpioLED3, kGpioDigitalOutput); PRINTF("LED Color Select:\n\r"); PRINTF("R: RED/n/rG: Green/n/rB: Blue\n\r"); while(1){ PRINTF("Please Select LED:\n\r"); ch = GETCHAR(); switch(ch){ case 'r': case 'R': PRINTF("Red led on\n\r"); LED1_ON; LED2_OFF; LED3_OFF; /*GPIO_DRV_WritePinOutput(kGpioLED1, 1); GPIO_DRV_WritePinOutput(kGpioLED2, 0); GPIO_DRV_WritePinOutput(kGpioLED3, 1);*/ break; case 'g': case 'G': PRINTF("Green led on\n\r"); LED1_OFF; LED2_ON; LED3_OFF; /*GPIO_DRV_WritePinOutput(kGpioLED1, 1); GPIO_DRV_WritePinOutput(kGpioLED2, 1); GPIO_DRV_WritePinOutput(kGpioLED3, 0);*/ break; case 'b': case 'B': LED1_OFF; LED2_OFF; LED3_ON; PRINTF("Blue led on\n\r"); /*GPIO_DRV_WritePinOutput(kGpioLED1, 0); GPIO_DRV_WritePinOutput(kGpioLED2, 1); GPIO_DRV_WritePinOutput(kGpioLED3, 1);*/ break; default: PRINTF("Wrong selection go again\n\r"); break; } } return 0; }
/*! * @brief main function */ int main(void) { #if FSL_FEATURE_ADC16_HAS_CALIBRATION adc16_calibration_param_t tempSnseCalibraitionParam; #endif hardware_init(); GPIO_DRV_Init(NULL, ledPins); // Configure the power mode protection SMC_HAL_SetProtection(SMC_BASE_PTR, kAllowPowerModeVlp); ADC16_DRV_StructInitUserConfigDefault(&tempSnseAdcConfig); #if (FSL_FEATURE_ADC16_MAX_RESOLUTION >= 16) tempSnseAdcConfig.resolution = kAdc16ResolutionBitOf16; #endif #if BOARD_ADC_USE_ALT_VREF tempSnseAdcConfig.refVoltSrc = kAdc16RefVoltSrcOfValt; #endif // Init ADC ADC16_DRV_Init(ADC_INSTANCE, &tempSnseAdcConfig); // Calibrate VDD and ADCR_TEMP25 #if FSL_FEATURE_ADC16_HAS_CALIBRATION // Auto calibraion ADC16_DRV_GetAutoCalibrationParam(ADC_INSTANCE, &tempSnseCalibraitionParam); ADC16_DRV_SetCalibrationParam(ADC_INSTANCE, &tempSnseCalibraitionParam); #endif // FSL_FEATURE_ADC16_HAS_CALIBRATION calibrateParams(); // get cpu uid low value for slave gSlaveId = SIM_UIDL_UID(SIM_BASE_PTR); PRINTF("i2c_rtos_slave_bm demo\r\n"); // task list initialize OSA_Init(); // create task(in BM: only the first registered task can be executed) OSA_TaskCreate(task_slave, (uint8_t *)"slave", 512, task_slave_stack, 0, (void *)0, false, &task_slave_task_handler); OSA_Start(); return 0; }