Version of personalized IMPACT LoRa
Fork of LMiC-10secs by
Embed:
(wiki syntax)
Show/hide line numbers
hal.h
00001 /******************************************************************************* 00002 * Copyright (c) 2014-2015 IBM Corporation. 00003 * All rights reserved. This program and the accompanying materials 00004 * are made available under the terms of the Eclipse Public License v1.0 00005 * which accompanies this distribution, and is available at 00006 * http://www.eclipse.org/legal/epl-v10.html 00007 * 00008 * Contributors: 00009 * IBM Zurich Research Lab - initial API, implementation and documentation 00010 *******************************************************************************/ 00011 00012 #ifndef _hal_hpp_ 00013 #define _hal_hpp_ 00014 00015 /* 00016 * initialize hardware (IO, SPI, TIMER, IRQ). 00017 */ 00018 void hal_init (void); 00019 00020 /* 00021 * drive radio NSS pin (0=low, 1=high). 00022 */ 00023 void hal_pin_nss (u1_t val); 00024 00025 /* 00026 * drive radio RX/TX pins (0=rx, 1=tx). 00027 */ 00028 void hal_pin_rxtx (u1_t val); 00029 00030 /* 00031 * control radio RST pin (0=low, 1=high, 2=floating) 00032 */ 00033 void hal_pin_rst (u1_t val); 00034 00035 /* 00036 * perform 8-bit SPI transaction with radio. 00037 * - write given byte 'outval' 00038 * - read byte and return value 00039 */ 00040 u1_t hal_spi (u1_t outval); 00041 00042 /* 00043 * disable all CPU interrupts. 00044 * - might be invoked nested 00045 * - will be followed by matching call to hal_enableIRQs() 00046 */ 00047 void hal_disableIRQs (void); 00048 00049 /* 00050 * enable CPU interrupts. 00051 */ 00052 void hal_enableIRQs (void); 00053 00054 /* 00055 * put system and CPU in low-power mode, sleep until interrupt. 00056 */ 00057 void hal_sleep (void); 00058 00059 /* 00060 * return 32-bit system time in ticks. 00061 */ 00062 u4_t hal_ticks (void); 00063 00064 /* 00065 * busy-wait until specified timestamp (in ticks) is reached. 00066 */ 00067 void hal_waitUntil (u4_t time); 00068 00069 /* 00070 * check and rewind timer for target time. 00071 * - return 1 if target time is close 00072 * - otherwise rewind timer for target time or full period and return 0 00073 */ 00074 u1_t hal_checkTimer (u4_t targettime); 00075 00076 /* 00077 * perform fatal failure action. 00078 * - called by assertions 00079 * - action could be HALT or reboot 00080 */ 00081 void hal_failed (void); 00082 00083 #endif // _hal_hpp_
Generated on Wed Jul 13 2022 00:34:16 by 1.7.2