IEEE 802.15.4 subsystem
Sign in or create your account | Project List | Help
IEEE 802.15.4 subsystem Git Source Tree
Root/
| 1 | /* |
| 2 | * fw/board_hulusb.h - Busware HUL Board-specific functions (for boot loader and application) |
| 3 | * |
| 4 | * Written 2017 by Filzmaier Josef |
| 5 | * Based on fw/board_rzusb written and Copyright 2016 Stefan Schmidt |
| 6 | * |
| 7 | * This program is free software; you can redistribute it and/or modify |
| 8 | * it under the terms of the GNU General Public License as published by |
| 9 | * the Free Software Foundation; either version 2 of the License, or |
| 10 | * (at your option) any later version. |
| 11 | */ |
| 12 | |
| 13 | #ifndef BOARD_HULUSB_H |
| 14 | #define BOARD_HULUSB_H |
| 15 | |
| 16 | #include <stdbool.h> |
| 17 | #include <stdint.h> |
| 18 | |
| 19 | #define LED_RED_PORT A |
| 20 | #define LED_GREEN_PORT A |
| 21 | #define LED_RED_BIT 3 |
| 22 | #define LED_GREEN_BIT 4 |
| 23 | #define LED_PORT LED_RED_PORT |
| 24 | #define LED_BIT LED_RED_BIT |
| 25 | |
| 26 | #define nRST_RF_PORT B |
| 27 | #define nRST_RF_BIT 5 |
| 28 | #define SLP_TR_PORT B |
| 29 | #define SLP_TR_BIT 4 |
| 30 | |
| 31 | #define SCLK_PORT B |
| 32 | #define SCLK_BIT 1 |
| 33 | #define MOSI_PORT B |
| 34 | #define MOSI_BIT 2 |
| 35 | |
| 36 | #define MISO_PORT B |
| 37 | #define MISO_BIT 3 |
| 38 | #define nSS_PORT B |
| 39 | #define nSS_BIT 0 |
| 40 | #define IRQ_RF_PORT D |
| 41 | #define IRQ_RF_BIT 4 |
| 42 | |
| 43 | #define SR_TX_AUTO_CRC_ON 0x04, 0x20, 5 |
| 44 | #define SR_CHANNEL 0x08, 0x1f, 0 |
| 45 | |
| 46 | #define RG_CC_CTRL_1 (0x14) |
| 47 | |
| 48 | #define SPI_WAIT_DONE() while ((SPSR & (1 << SPIF)) == 0) |
| 49 | #define SPI_DATA SPDR |
| 50 | |
| 51 | void set_clkm(void); |
| 52 | void board_init(void); |
| 53 | |
| 54 | void led_red(bool on); |
| 55 | void led_green(bool on); |
| 56 | |
| 57 | void spi_begin(void); |
| 58 | void spi_off(void); |
| 59 | void spi_init(void); |
| 60 | |
| 61 | #ifdef DEBUG |
| 62 | void printStatus(void); |
| 63 | #define PRINT_STATUS() printStatus() |
| 64 | #endif |
| 65 | |
| 66 | #endif /* !BOARD_HULUSB_H */ |
| 67 |
