63 #include "contiki-conf.h"
78 #define SLPTR_GPIO PTE
81 #define hal_set_slptr_high() (BITBAND_REG(SLPTR_GPIO->PSOR, SLPTR_PIN) = 1)
82 #define hal_set_slptr_low() (BITBAND_REG(SLPTR_GPIO->PCOR, SLPTR_PIN) = 1)
83 #define hal_get_slptr() (BITBAND_REG(SLPTR_GPIO->PDOR, SLPTR_PIN))
85 #define hal_set_rst_high() PTD->PSOR = (1 << 7); delay_us(0xFFFF)
86 #define hal_set_rst_low() (PTD->PCOR = (1 << 7))
87 #define hal_get_rst() ((PTD->PDOR & (1 << 7)) >> 7)
88 #define hal_set_pwr_high() (PTD->PSOR = (1 << 7))
89 #define hal_set_pwr_low() (PTD->PCOR = (1 << 7))
90 #define hal_get_pwr() ((PTD->PDOR & (1 << 7)) >> 7)
98 #define HAL_ENABLE_RADIO_INTERRUPT() { PORTB->PCR[9] |= (1 << 24); \
99 NVIC_ClearPendingIRQ(PORTB_IRQn); \
100 NVIC_EnableIRQ(PORTB_IRQn); }
101 #define HAL_DISABLE_RADIO_INTERRUPT() (NVIC_DisableIRQ(PORTB_IRQn))
103 #define HAL_ENABLE_OVERFLOW_INTERRUPT() ()
104 #define HAL_DISABLE_OVERFLOW_INTERRUPT() ()
106 #define HAL_ENTER_CRITICAL_REGION() MK60_ENTER_CRITICAL_REGION()
107 #define HAL_LEAVE_CRITICAL_REGION() MK60_LEAVE_CRITICAL_REGION()
111 #define hal_enable_trx_interrupt() HAL_ENABLE_RADIO_INTERRUPT()
117 #define hal_disable_trx_interrupt() HAL_DISABLE_RADIO_INTERRUPT()
128 #define HAL_BAT_LOW_MASK (0x80)
129 #define HAL_TRX_UR_MASK (0x40)
130 #define HAL_TRX_END_MASK (0x08)
131 #define HAL_RX_START_MASK (0x04)
132 #define HAL_PLL_UNLOCK_MASK (0x02)
133 #define HAL_PLL_LOCK_MASK (0x01)
135 #define HAL_MIN_FRAME_LENGTH (0x03)
136 #define HAL_MAX_FRAME_LENGTH (0x7F)
159 typedef void (*rx_callback_t) (uint16_t data);
187 void hal_sram_read(uint8_t address, uint8_t length, uint8_t *data);
188 void hal_sram_write(uint8_t address, uint8_t length, uint8_t *data);
191 #ifndef RF230_CONF_RX_BUFFERS
192 #define RF230_CONF_RX_BUFFERS 1
void hal_reset_flags(void)
This function reset the interrupt flags and interrupt event handlers (Callbacks) to their default val...
uint8_t hal_get_bat_low_flag(void)
This function returns the current value of the BAT_LOW flag.
uint8_t hal_register_read(uint8_t address)
This function reads data from one of the radio transceiver's registers.
void hal_clear_pll_lock_flag(void)
This function clears the PLL_LOCK flag.
void hal_clear_bat_low_flag(void)
This function clears the BAT_LOW flag.
hal_trx_end_isr_event_handler_t hal_get_trx_end_event_handler(void)
This function is used to set new TRX_END event handler, overriding old handler reference.
void hal_clear_rx_start_event_handler(void)
Remove event handler reference.
uint8_t hal_get_pll_lock_flag(void)
This function returns the current value of the PLL_LOCK flag.
uint8_t hal_subregister_read(uint8_t address, uint8_t mask, uint8_t position)
This function reads the value of a specific subregister.
void hal_init(void)
This function initializes the Hardware Abstraction Layer.
This struct defines the rx data container.
void hal_subregister_write(uint8_t address, uint8_t mask, uint8_t position, uint8_t value)
This function writes a new value to one of the radio transceiver's subregisters.
void hal_sram_read(uint8_t address, uint8_t length, uint8_t *data)
Read SRAM.
void hal_frame_read(hal_rx_frame_t *rx_frame, rx_callback_t rx_callback)
This function will upload a frame from the radio transceiver's frame buffer.
void(* hal_trx_end_isr_event_handler_t)(uint32_t const isr_timestamp)
RRX_END event handler callback type.
K60 hardware register header wrapper.
void hal_sram_write(uint8_t address, uint8_t length, uint8_t *data)
Write SRAM.
void hal_frame_write(uint8_t *write_buffer, uint8_t length)
This function will download a frame to the radio transceiver's frame buffer.
void hal_set_rx_start_event_handler(hal_rx_start_isr_event_handler_t rx_start_callback_handle)
This function is used to set new RX_START event handler, overriding old handler reference.
hal_rx_start_isr_event_handler_t hal_get_rx_start_event_handler(void)
This function returns the active RX_START event handler.
#define HAL_MAX_FRAME_LENGTH
A frame should no more than 127 bytes.
void hal_clear_trx_end_event_handler(void)
Remove event handler reference.
void hal_register_write(uint8_t address, uint8_t value)
This function writes a new value to one of the radio transceiver's registers.
K60 interrupt save/restore macros.
void hal_set_trx_end_event_handler(hal_trx_end_isr_event_handler_t trx_end_callback_handle)
This function is used to set new TRX_END event handler, overriding old handler reference.
void(* hal_rx_start_isr_event_handler_t)(uint32_t const isr_timestamp, uint8_t const frame_length)
RX_START event handler callback type.