/* * Stuff we only allow after we've gone through the normal pre-amble */ EXTFN void post_init_hook(void *data) { wakeup_init(); ui.animation_count = 6; // Make it 6 so we consider is_animation_complete() will return true layer_mark_dirty(ui.icon_bar); // Set click provider window_set_click_config_provider(ui.primary_window, (ClickConfigProvider) click_config_provider); }
void INIT_ATTR mc13783_init(void) { /* Serial interface must have been initialized first! */ wakeup_init(&mc13783_svc_wake); mutex_init(&mc13783_spi_mutex); wakeup_init(&mc13783_spi_wake); /* Enable the PMIC SPI module */ spi_enable_module(&mc13783_spi); /* Mask any PMIC interrupts for now - modules will enable them as * required */ mc13783_write(MC13783_INTERRUPT_MASK0, 0xffffff); mc13783_write(MC13783_INTERRUPT_MASK1, 0xffffff); MC13783_GPIO_ISR = (1ul << MC13783_GPIO_LINE); mc13783_thread_id = create_thread(mc13783_interrupt_thread, mc13783_thread_stack, sizeof(mc13783_thread_stack), 0, mc13783_thread_name IF_PRIO(, PRIORITY_REALTIME) IF_COP(, CPU)); }
int main (void) { uint8_t j; aes128_ctx_t ctx; /* the context where the round keys are stored */ aes128_init(key, &ctx); /* generating the round keys from the 128 bit key */ wakeup_init(); sei(); //Activate interrupts rfm70_init(); j = 0; while(1) { set_sleep_mode(SLEEP_MODE_IDLE); sleep_mode(); if (interrupt_flag == 1) { interrupt_flag = 0; rfm70_mode_transmit(); rfm70_power(3); _delay_ms(50); read_vcc(); //setup the ADC data.info.type = 1; data.info.vcc = vcc; data.info.vcc_factor = VCC_SCALE_FACTOR; data.info.tempreture = 0; for (uint8_t i=0;i<11;i++) { data.info.data[i] = 0; } aes128_enc(data.raw, &ctx); /* encrypting the data block */ rfm70_transmit_message( data.raw, 16 ); _delay_ms(100); rfm70_mode_powerdown(); } } return 0; }