int send_card_info( DWORD card_id, int ok_flag ) { extern int g_record_id; extern int g_host_type; switch( g_host_type ){ case 1: return send_card_info_by_tcmd( RTC_Get(), get_sys_tick(), g_record_id, card_id, ok_flag ); break; case 2: return send_card_info_by_dlc( RTC_Get(), get_sys_tick() ); break; } return 0; }
//----------------------------------------------------------------------------- // main() Routine // ---------------------------------------------------------------------------- int main(void) { int n = 342; uint8_t SFRPAGE_save; // Call hardware initialization routine enter__38kHz_Modulation_from_RESET(); SFRPAGE_save = SFRPAGE; SFRPAGE = SFRPAGE_save; while (1) { uint32_t timeStamp; timeStamp = get_sys_tick(); //nPulse(n, &pulse); // Test IR_NEC_tx functions // IR_NEC_T3_setup(); // IR_NEC_tx_frame(0xAA, 0x55); // not working P1_B6 ^= 1; // For debug purpose if (P3_B1 == 0) { IR_NEC_tx_frame(0x01, 0x0E); // Remote code while ((int32_t) (get_sys_tick() - timeStamp < (uint32_t) 20 << 16)) ; // delay 20 ms } // Delay using time stamp // while ((int32_t) (get_sys_tick() - timeStamp < (uint32_t) 500 << 16)) // Every 500 ms // { // // Do nothing // enter_power_mode(POWER_MODE_IDLE); // } // $[Generated Run-time code] // [Generated Run-time code]$ } }
int access_loop() { //int rel; int ok_cam_flag; int ok_send_flag; u32 time, tick; char record_buf[64]; if( check_card_action() > 0 ){ g_deal_card_no = g_card_no; g_card_no = 0; ok_cam_flag = do_cam(); if( ok_cam_flag <= -2 ){ // invailed card set_illegal_card_page(); set_page_keep_second( 5 ); } else if( ok_cam_flag == -1 ){ // disable enter set_forbid_enter_page(); set_page_keep_second( 5 ); } else if( ok_cam_flag == 1 ){ set_allow_enter_page(); set_page_keep_second( 5 ); } time = RTC_Get(); tick = get_sys_tick(); // make send record buf gen_record_string( record_buf, time, tick, g_record_id, g_deal_card_no, ok_cam_flag ); ok_send_flag = system_send_buf_to_host( record_buf, strlen( record_buf ) ); // make save file record buf sprintf( &record_buf[ strlen( record_buf ) ], "%d", ok_send_flag ); save_card_info( g_record_id, record_buf, ok_send_flag ); show_main_page(); g_record_id ++; } timer_process(); access_command_deal(); return 0; }
int_fast32_t get_us() { return get_sys_tick() * US_PER_SYS_TICK; }