hello world
Fork of lmic_MOTE_L152RC 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 void hal_opmode(u1_t mode, u1_t pa_boost); 00030 00031 /* 00032 * control radio RST pin (0=low, 1=high, 2=floating) 00033 */ 00034 void hal_pin_rst (u1_t val); 00035 00036 /* 00037 * perform 8-bit SPI transaction with radio. 00038 * - write given byte 'outval' 00039 * - read byte and return value 00040 */ 00041 u1_t hal_spi (u1_t outval); 00042 00043 /* 00044 * disable all CPU interrupts. 00045 * - might be invoked nested 00046 * - will be followed by matching call to hal_enableIRQs() 00047 */ 00048 void hal_disableIRQs (void); 00049 00050 /* 00051 * enable CPU interrupts. 00052 */ 00053 void hal_enableIRQs (void); 00054 00055 /* 00056 * put system and CPU in low-power mode, sleep until interrupt. 00057 */ 00058 void hal_sleep (void); 00059 00060 /* 00061 * return 32-bit system time in ticks. 00062 */ 00063 u4_t hal_ticks (void); 00064 00065 /* 00066 * busy-wait until specified timestamp (in ticks) is reached. 00067 */ 00068 void hal_waitUntil (u4_t time); 00069 00070 /* 00071 * check and rewind timer for target time. 00072 * - return 1 if target time is close 00073 * - otherwise rewind timer for target time or full period and return 0 00074 */ 00075 u1_t hal_checkTimer (u4_t targettime); 00076 00077 /* 00078 * perform fatal failure action. 00079 * - called by assertions 00080 * - action could be HALT or reboot 00081 */ 00082 void hal_failed (void); 00083 00084 #ifndef OSTICKS_PER_SEC 00085 #define OSTICKS_PER_SEC 16384 00086 #elif OSTICKS_PER_SEC < 10000 || OSTICKS_PER_SEC > 64516 00087 #error Illegal OSTICKS_PER_SEC - must be in range [10000:64516]. One tick must be 15.5us .. 100us long. 00088 #endif 00089 00090 #endif // _hal_hpp_
Generated on Mon Jul 18 2022 04:23:42 by 1.7.2