void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { // write stack guard word STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); // start slave if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); SMLink *smLink = new SMLink; g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); if (prm_init(g_chirpUsb)<0) // error, let user know (don't just continue like nothing's happened) showError(1, 0x0000ff, "Flash is corrupt, parameters have been lost\n"); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
int main(void) { // Hardware Init delay_init(); //ÑÓʱº¯Êý³õʼ»¯ pwr_init(); #ifdef YANMING3 charger_init(); if (check_standby_flag() == SUCCESS && check_charging() != CHARGING) { Key_GPIO_Config(); exti_key_init(); #ifdef DEBUG_POWER_OFF_WAKE_UP Screen_Init(); OLED_Clear(); OLED_Display_On(); draw_about_mesage(); #endif check_standby_wakeup_button_press(); // If we boot up from standby by pressing 5 times, the system will reboot again without // this code block. } #endif // OLED Init Screen_Init(); OLED_Clear(); // low_switch_power_init(); TIMx_Int_DeInit(); EXTIX_DeInit(); // Key Key_GPIO_Config(); // PID related code ADC1_Configuration(); PWM_Configuration(); VoltagePID_Init(); TIMx_Int_Init(); rtc_init(); // Our Init system_init(); #ifndef YANMING3 //iwdg_init(); #endif while(1) { #ifndef YANMING3 //iwdg_feed(); #endif task_schedule(); } }
void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { platformInit(); // button, SPI_SSEL LPC_GPIO_PORT->MASK[5] = 0; LPC_GPIO_PORT->PIN[5] = 0x20; // negate SPI_SS LPC_GPIO_PORT->DIR[5] = 0x20; // SPI_SS - output // deal with P4_1, GPIO2[1] LPC_GPIO_PORT->MASK[2] = 0; LPC_GPIO_PORT->DIR[2] = 0; // set timer so we count clock cycles LPC_TIMER1->IR = 0; LPC_TIMER1->TCR = 1; LPC_TIMER1->PR = 0; // microsecond timer LPC_TIMER2->IR = 0; LPC_TIMER2->TCR = 1; LPC_TIMER2->PR = CLKFREQ_US-1; debug_frmwrk_init_clk(CLKFREQ); USB_UserInit(); lpc_printf("M4 start\n"); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); // start slave IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); // initialize chirp objects g_chirpUsb = new ChirpUsb(); g_chirpM0 = new ChirpM0(); // initialize devices/modules pwr_init(); spi_init(); cam_init(); rcs_init(); led_init(); //cc_init(); }
void pixyInit(void) #endif { // write stack guard word // STACK_GUARD = STACK_GUARD_WORD; commonInit(); #ifdef KEIL IPC_haltSlave(); #endif // clear RC servo registers to prevent and glitches upon initialization rcs_enable(0, 0); rcs_enable(1, 0); ADCInit(); SCTInit(); CameraInit(); // initialize shared memory interface before running M0 SMLink *smLink = new SMLink; // start slave #ifdef KEIL if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } #else cr_start_m0(SLAVE_M0APP,&__core_m0app_START__); #endif // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpUsb->setSendTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... g_chirpUsb->setRecvTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); prm_init(g_chirpUsb); pwr_init(); cam_init(); }
//void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) void pixyInit(void) { // write stack guard word // STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); ADCInit(); SCTInit(); CameraInit(); /* IPC_startSlave(); */ // start slave /* if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); } */ // initialize shared memory interface before running M0 SMLink *smLink = new SMLink; // run M0 cr_start_m0(SLAVE_M0APP,&__core_m0app_START__); // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); if (prm_init(g_chirpUsb)<0) // error, let user know (don't just continue like nothing's happened) showError(1, 0x0000ff, "Flash is corrupt, parameters have been lost\n"); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
void pixyInit(uint32_t slaveRomStart, const unsigned char slaveImage[], uint32_t imageSize) { // write stack guard word STACK_GUARD = STACK_GUARD_WORD; commonInit(); IPC_haltSlave(); // clear RC servo registers to prevent and glitches upon initialization rcs_enable(0, 0); rcs_enable(1, 0); ADCInit(); SCTInit(); CameraInit(); // start slave if (slaveRomStart && slaveImage && imageSize) { IPC_downloadSlaveImage(slaveRomStart, slaveImage, imageSize); IPC_startSlave(); } // initialize chirp objects USBLink *usbLink = new USBLink; g_chirpUsb = new Chirp(false, false, usbLink); g_chirpUsb->setSendTimeout(3000); // set a high timeout because the host can sometimes go AWOL for a second or two.... SMLink *smLink = new SMLink; g_chirpM0 = new Chirp(false, true, smLink); // initialize devices/modules led_init(); prm_init(g_chirpUsb); pwr_init(); cam_init(); rcs_init(); //cc_init(); }
int main() { packet act_packet; // setup ports/uart nrk_setup_ports(); nrk_setup_uart(UART_BAUDRATE_115K2); SPI_Init(); pwr_init(); nrk_init (); nrk_time_set (0, 0); // clear all LEDs nrk_led_clr(0); nrk_led_clr(1); nrk_led_clr(2); nrk_led_clr(3); // flags g_verbose = FALSE; g_network_joined = FALSE; g_global_outlet_state = OFF; g_button_pressed = FALSE; // mutexs g_net_tx_buf_mux = nrk_sem_create(1, 8); g_act_queue_mux = nrk_sem_create(1, 8); g_cmd_tx_queue_mux = nrk_sem_create(1, 8); g_data_tx_queue_mux = nrk_sem_create(1, 8); g_seq_num_mux = nrk_sem_create(1, 8); g_network_joined_mux = nrk_sem_create(1, 8); g_global_outlet_state_mux = nrk_sem_create(1, 8); g_button_pressed_mux = nrk_sem_create(1, 8); g_net_watchdog_mux = nrk_sem_create(1, 8); // sensor periods (in seconds / 2) g_pwr_period = 2; g_temp_period = 3; g_light_period = 4; // packet queues packet_queue_init(&g_act_queue); packet_queue_init(&g_cmd_tx_queue); packet_queue_init(&g_data_tx_queue); // ensure node is initially set to "OFF" act_packet.source_id = MAC_ADDR; act_packet.type = MSG_CMD; act_packet.seq_num = 0; act_packet.num_hops = 0; act_packet.payload[CMD_CMDID_INDEX] = (uint16_t)0; act_packet.payload[CMD_NODE_ID_INDEX] = MAC_ADDR; act_packet.payload[CMD_ACT_INDEX] = OFF; atomic_push(&g_act_queue, &act_packet, g_act_queue_mux); // initialize bmac bmac_task_config (); bmac_init(13); nrk_register_drivers(); nrk_set_gpio(); nrk_create_taskset(); nrk_start (); return 0; }