📄 iai_ezmac_plus.h
字号:
+
+ RETURN: Mac_OK: The operation was succesfull
+ State_Error: The operation is ignored, because the current state of EZMAC is not Idle.
+
+ NOTES: Every RF part of the EZRadio chip is switched off in this state,
+ even the oscillator circuit.
+ The Wake-up timer is also switched off, but the Low Battery detector state is not affected
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMac_Sleep (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMacIdle
+
+ DESCRIPTION: Puts the RF MAC into idle state
+
+ RETURN: Mac_OK:The operation was succesfull
+
+ State_Error:If an ongoing transmission, or reception was aborted (the current
+ state is Transmit packet or Receive packet)
+
+ Wkup_Error:the current state is Sleep, or the wake-up process hasn't been completed.
+
+ NOTES: Puts the EZmac to idle state from any ongoing transmission, or reception state.
+ Switches off every part of the EZRadio chip, except the oscillator circuit.
+ The registers are not initialized except MSR.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
#ifdef HITECH_COMPILER
#pragma interrupt_level 1
#endif
char EZMac_Idle (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_Transmit
+
+ DESCRIPTION: Transmits the buffer content through the RF interface
+
+ RETURN: Mac_OK:The transmission started succesfully
+
+ State_Error:The transmission hasn't been started because the MAC is busy
+ (the current state is not Idle or Transmit Error)
+
+ Wkup_Error:The transmission hasn't been started because the current state is
+ Sleep, or the wake-up process hasn't been completed.
+
+ NOTES: The RF parameters must be set before call this function.
+ Sends PLEN bytes, so PLEN must be set by EZMacReg_Write before call.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMac_Transmit (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_Receive
+
+ DESCRIPTION: This function is seeking for a valid transmission on the defined frequencies.
+ If a valid transmission is detected then receives the packet through the RF interface
+
+ RETURN: Mac_OK: Searching for a valid transmission has been started succesfully
+
+ State_Error:The searching hasn't been started because the MAC is busy
+ (the current state is not Idle)
+
+ Wkup_Error:The searching hasn't been started because the current state is
+ Sleep, or the wake-up process hasn't been completed.
+
+ NOTES: The RF parameters must be set before call this function.
+ The received data lenght can be read from PLEN by EZMacReg_Read.
+ This lenght shall be less or equal to PLEN_MAX.
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMac_Receive (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMacReg_Write
+
+ DESCRIPTION: Writes 'value' to register identified by 'name'
+
+ RETURN: Mac_OK:The operation was succesfull
+
+ Name_Error: The register name is invalid
+
+ Value_error: The value parameter is out of the range of register 'Name'
+
+ State_Error: The operation is ignored, because reception or transmission is ongoing.
+
+ NOTES: Examines the Name, and Value.
+ PLEN <= PLEN_MAX
+ etc.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMacReg_Write (MacRegs Name,char Value);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMacReg_Read
+
+ DESCRIPTION: Reads the content of register identified by 'name' and stores it to *Value
+
+ RETURN: Mac_OK:The operation was succesfull
+
+ Name_Error: The register name is invalid
+
+ NOTES: none.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMacReg_Read (MacRegs Name,char* Value);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMacBuf_Write
+
+ DESCRIPTION: Copies PLEN number of bytes from 'buf' to MAC data buffer
+
+ RETURN: Mac_OK:The operation was succesfull
+
+ State_Error: The operation is ignored, because reception or transmission is ongoing.
+
+ NOTES: PLEN must be set before call this function.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMacBuf_Write (char* buf);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMacBuf_Read
+
+ DESCRIPTION: Copies PLEN number of bytes from MAC data buffer to '*buf'
+
+ RETURN: Mac_OK:The operation was succesfull
+
+ State_Error: The operation is ignored, because reception is ongoing.
+
+ NOTES: If the packet lenght is not fixed, then PLEN is coming from
+ the received packet, less or equal to PLEN_MAX.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMacBuf_Read (char* buf);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_TimerISR
+
+ DESCRIPTION: Timer Interrupt Service Routine.
+
+ RETURN: none.
+
+ NOTES: EZmac uses the Timer1 resource of the microcontroller.
+ This function call must be included into the global ISR.
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void EZMac_TimerISR (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_CommISR
+
+ DESCRIPTION: External Interrupt Service Routine, handles the RF communication.
+
+ RETURN: none.
+
+ NOTES: EZmac uses the External interrupt resource of the microcontroller.
+ This function call must be included into the global ISR.
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
void EZMac_CommISR (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_SysInit
+
+ DESCRIPTION: Microcontroller initialization routine.
+
+ RETURN: none.
+
+ NOTES: Configures the microcontroller resources whose are needed by EZmac.
+ This function call must be included into the main() function of the code,
+ prior to any other uses of the MAC.
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void EZMac_SysInit (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_Init
+
+ DESCRIPTION: EZRadio initialization routine.
+
+ RETURN: Mac_OK:The operation was succesfull
+
+ State_Error: The operation is ignored, because EZMac is not in Sleep state.
+
+ NOTES: Initializes the EZRadio chip.
+ This function call should be issued system reset, and after
+ EZMac_SysInit and EZMac_Config, but prior to any other uses of the MAC.
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZMac_Init (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZMac_Config
+
+ DESCRIPTION: EZmac initialization routine.
+
+ RETURN: none.
+
+ NOTES: Initializes EZmac registers, and the RF communication chip.
+ This function call must be included into the main() function of the code,
+ prior to any other uses of the MAC, and after EZMac_SysInit
+
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
void EZMac_Config (void);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZRadio_Write
+
+ DESCRIPTION: Sends EZcommand to the EZRadio chip via the SPI interface.
+
+ RETURN: Mac_OK: The operation was succesfull
+ State_Error: The operation is ignored, because the current
+ state of EZMAC is not Idle or Sleep.
+
+ NOTES: The MAC must be in Sleep or Idle state when calling this function
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZRadio_Write (int16 EZcommand);
/*+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+ FUNCTION NAME: EZRadio_Statusread
+
+ DESCRIPTION: Reads the Status of the EZRadio chip via the SPI interface
+ and stores it to STRL and STRH global variables.
+
+ RETURN: Mac_OK: The operation was succesfull
+ State_Error: The operation is ignored, because the current
+ state of EZMAC is not Idle or Sleep.
+
+ NOTES: The MAC must be in Sleep or Idle state when calling this function
+ The MAC updates regularly the STRH global variable which is reflecting
+ the Interrupt status of the EZRadio chip.
+
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++*/
#pragma separate
char EZRadio_Statusread (void);
#endif
#pragma list
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -