#include <Chipcon/hal.h>
Go to the source code of this file.
Data Structures | |
struct | NODE_ADDR_STUCT |
data type for a node address More... | |
Defines | |
#define | RF_DESCRAMBLE_LSB_AND_ROTATE(byte, scrReg, j, i) |
helper macro used by macro RF_DESCRAMBLE. not for direct use | |
#define | RF_SLOT_100_US_LEFT (TH0 < 0xFF || TL0 < 0x84) |
returns true if at least 100 us (approximately) are left before the next timer0 event occurs TH0:TL0 < 0xFFFF - 100 / (12000/14746), that means smaller than FF84 | |
#define | RF_SLOT_200_US_LEFT (TH0 < 0xFF || TL0 < 0x09) |
returns true if at least 200 us (approximately) are left before the next timer0 event occurs TH0:TL0 < 0xFFFF - 200 / (12000/14746), that means smaller than FF09 | |
#define | RF_SLOT_500_US_LEFT (TH0 < 0xFD || (TH0 == 0xFD && TL0 < 0x98)) |
returns true if at least 500 us (approximately) are left before the next timer0 event occurs TH0:TL0 < 0xFFFF - 500 / (12000/14746), that means smaller than FD98 | |
#define | RF_SLOT_1_MS_LEFT (TH0 < 0xFC || (TH0 == 0xFC && TL0 < 0xD2)) |
returns true if at least 1 ms (approximately) is left before the next timer0 event occurs TH0:TL0 < 0xFFFF - 500 / (12000/14746), that means smaller than FCD2 | |
#define | RF_MICROSECONDS_UNTIL_NEXT_SLOT ( ((unsigned short)(TH0 << 8 || TL0)) / 10 * 8 ) |
returns the approx time in us | |
#define | RF_NEW_RANDOM_BYTE() ((unsigned char)((randomNumberReg= randomNumberReg * 221 + 1) >> 24)) |
returns the next evenly distributed random number | |
#define | RF_SET_MODE_SLEEP |
turns off the transceiver | |
#define | RF_SPI_SEND_BYTE(byte) RF_WAIT_AND_SEND_BYTE(byte) |
defines RF_SPI_SEND_BYTE as an alias for the macro RF_WAIT_AND_SEND_BYTE defined by chipcon | |
#define | RF_SPI_RECEIVE_BYTE(byte) RF_WAIT_AND_RECEIVE_BYTE(byte) |
defines RF_SPI_SEND_BYTE as an alias for the macro RF_WAIT_AND_SEND_BYTE defined by chipcon | |
#define | RF_LOW_POWER_SLEEP_UNTIL_NEXT_SLOT() ENTER_IDLE_MODE() |
this macro can be used by the "application level" to go into power safe mode until the next interrupt (slot begin) occurs. | |
#define | WAIT_FOR_TIMER0_EXACT(thi0, tlo0) |
loops until timer0 is at or later then the given rendevouz point. | |
#define | BIGGER_THAN_TIMER0_RENDEVOUZ_EXACT(thi0, tlo0) ((TH0 > thi0) || (TH0 == thi0 && TL0 >= tlo0)) |
returns false until timer0 is at or later then the given rendevouz point | |
#define | RF_SET_FIELD_STRENGTH(txPower) PA_POW=txPower; |
sets the field strengh | |
Typedefs | |
typedef NODE_ADDR_STUCT | nodeAddrType |
data type for a node address | |
Functions | |
void | RFInitRandom () |
gets a true random number for initialization of the random number generator | |
byte | RFScramble (byte b) |
this function wraps the marcro RF_SCRAMBLE. | |
byte | RFDescramble (byte b) |
this function wraps the marcro RF_SCRAMBLE. | |
byte | LLSendingBusy () |
byte | ACLSubscribe (byte LL_type_h, byte LL_type_l) |
adds a type to the subscription list | |
byte | ACLUnsubscribe (byte LL_type_h, byte LL_type_l) |
deletes a type out of the subscription list | |
void | ACLFlushSubscriptions () |
deletes all subscriptions (not the default ones) | |
byte | ACLSubscribeDefault () |
subscribes to the default types (control msgs..) | |
byte | ACLVerifySubscription (byte type_h, byte type_l) |
checks if a subscription is there | |
void | ACLInit () |
start ACL and lower layers, resets the whole stack | |
byte | ACLProcessControlMessages () |
internal: is called if control msg is there | |
void | ACLSetFieldStrength (byte power) |
sets the field strength of transmitter signals | |
byte | ACLSendingBusy () |
returns true if LL has Packet in send queue | |
byte | ACLGetSendSuccess () |
returns the result of last packet transmission. | |
byte | ACLSendPacket (byte slot_timeout) |
queues a packet for transmission | |
byte | ACLAddNewType (byte type_h, byte type_l) |
adds a new type tuple to the payload | |
byte | ACLAddData (byte data) |
adds one byte data into the ACL send buffer | |
void | ACLAbortSending () |
stops a running transmission | |
void | ACLSubscribeAll () |
subscribes to any possible type (all packets are received) | |
byte | ACLMatchesMyIP (char *buffer, byte start) |
checks, if buffer holds my IP | |
char * | ACLGetReceivedData (byte type_h, byte type_l) |
byte | ACLGetReceivedPayloadLength () |
returns the number of payload bytes of the last packet received | |
signed char | ACLGetReceivedDataLength (byte type_h, byte type_l) |
searches the last received packet for the given type and returns the data length of the entry found. | |
byte | ACLSentPacketInThisSlot () |
void | ACLAnswerOnACM () |
if a control msg comes in that requires an answer, it is answered | |
void | ACLNoAnswerOnACM () |
if a control msgs comes in that requires an answer, it will not be answered | |
byte | ACLClearSendData () |
deletes the send buffer of ACL | |
void | ACLStart () |
restart ACL after ACLstop() | |
void | ACLStop () |
stops the RF stack. Everything is hold, continues after ACLstart. msg stay in queue. | |
byte | ACLGetRemainingPayloadSpace () |
returns the number of free bytes in the transmit buffer | |
void | ACLLockReceiveBuffer () |
locks the receive buffer: no new msgs are received | |
byte | ACLReceiveBufferLocked () |
void | ACLReleaseReceiveBuffer () |
un-lock the receivebuffer; | |
void | ACLSetDataToOld () |
set received data to "old": means ACLDataIsNew will not return true unless a new packet was received | |
void | ACLSetDataToNew () |
set received data to "new": means ACLDataIsNew will return true until ACLSetDataToOld() is called | |
byte | ACLDataIsNew () |
char | ACLGetReceivedByte (byte type_h, byte type_l, byte position) |
searches the first occurrence of type tuple and returns the position-th byte after that tuple | |
byte | ACLDataReceivedInThisSlot () |
byte | ACLDataIsNewNow () |
synonym for ACLDataReceivedInThisSlot() | |
byte | ACLFoundReceivedType (byte type_h, byte type_l) |
byte | ACLAdressedDataIsNew () |
byte | ACLAdressedDataIsNewNow () |
byte | ACLSendPacketAdressed (nodeAddrType *address, byte timeout) |
sends out the current packet with a target ID | |
unsigned short | LLCalcCRC16 (byte *header_data, byte *payload_data, byte payload_size) |
calculates the crc-16 checksum over the rf packet (ll header + payload) | |
void | putchar (char c) |
classic putchar function that is used to output a character to the "screen", in our case the serial port. |
Use 4 space tabs to ensure readablility!
Definition in file partCStack.h.
|
this macro can be used by the "application level" to go into power safe mode until the next interrupt (slot begin) occurs. after returning from the ISR, operation will continue after the point when this macro was called. Definition at line 156 of file partCStack.h. Referenced by main(). |
|
sets the field strengh
|
|
Value: loops until timer0 is at or later then the given rendevouz point. it was tried to implement this macro with just one unsigned short value, but this lead to a insufficient accuracy. Definition at line 162 of file partCStack.h. Referenced by RFArbitrationBit(), RFReceivePacket(), and RFSendPacket(). |
|
adds one byte data into the ACL send buffer
References LL_payload_send, and LL_payload_send_length. Referenced by ACLSendPacketAdressed(), ACLStartUp(), and main(). |
|
adds a new type tuple to the payload
References LL_payload_send, and LL_payload_send_length. Referenced by ACLSendPacketAdressed(), ACLStartUp(), and main(). |
|
References ACLDataIsNew(), ACLFoundReceivedType(), ACLGetReceivedData(), and ACLMatchesMyIP(). |
|
References ACLDataIsNewNow(), ACLFoundReceivedType(), ACLGetReceivedData(), and ACLMatchesMyIP(). |
|
References LLDataIsNew(). |
|
References LLSentPacketInThisSlot(). |
|
References ACLGetReceivedDataLength(). Referenced by ACLAdressedDataIsNew(), and ACLAdressedDataIsNewNow(). |
|
searches the first occurrence of type tuple and returns the position-th byte after that tuple
References LL_header_received, and LL_payload_received. |
|
References LL_header_received, and LL_payload_received. Referenced by ACLAdressedDataIsNew(), and ACLAdressedDataIsNewNow(). |
|
searches the last received packet for the given type and returns the data length of the entry found.
References LL_header_received, and LL_payload_received. Referenced by ACLFoundReceivedType(). |
|
returns the number of payload bytes of the last packet received
References LL_header_received. |
|
returns the number of free bytes in the transmit buffer
References LLGetRemainingPayloadSpace(). |
|
returns the result of last packet transmission. note that this value is valid for the last packet and is not set for the current packet in queue until sending is not busy any more.
References LLGetSendSuccess(). |
|
checks, if buffer holds my IP
References LL_header_sendbuffer. Referenced by ACLAdressedDataIsNew(), ACLAdressedDataIsNewNow(), and ACLProcessControlMessages(). |
|
internal: is called if control msg is there
References ACL_CONTROL_MESSAGES_TIMEOUT, ACL_TYPE_ACM_H, ACL_TYPE_ACM_L, ACLAbortSending(), ACLMatchesMyIP(), LL_header_receivebuffer, LL_payload_receivebuffer, LL_payload_send, LL_payload_send_length, LL_STATE_CTRL_MESSAGE_INSERTED, LLSendingBusy(), LLSendPacket(), llState, and RFStop(). |
|
References LLReceiveBufferLocked(). |
|
queues a packet for transmission
References LLSendPacket(). Referenced by ACLSendPacketAdressed(), ACLStartUp(), and main(). |
|
sends out the current packet with a target ID
References NODE_ADDR_STUCT::a1, NODE_ADDR_STUCT::a2, NODE_ADDR_STUCT::a3, NODE_ADDR_STUCT::a4, NODE_ADDR_STUCT::a5, NODE_ADDR_STUCT::a6, NODE_ADDR_STUCT::a7, NODE_ADDR_STUCT::a8, ACLAddData(), ACLAddNewType(), ACLGetRemainingPayloadSpace(), ACLSendPacket(), and nodeAddrType. |
|
References LLSentPacketInThisSlot(). |
|
adds a type to the subscription list
References ACL_SUBSCRIPTIONLIST_LENGTH. Referenced by ACLSubscribeDefault(). |
|
deletes a type out of the subscription list
References ACL_SUBSCRIPTIONLIST_LENGTH. |
|
checks if a subscription is there
References ACL_SUBSCRIPTIONLIST_LENGTH. |
|
calculates the crc-16 checksum over the rf packet (ll header + payload)
Referenced by LLSendPacket(), and RFReceivePacket(). |
|
References LL_STATE_NEED_TO_SEND, and llState. |
|
classic putchar function that is used to output a character to the "screen", in our case the serial port. Definition at line 743 of file deepSleepSender/stackMasterSlaveSync.c. Referenced by DebugDumpReceivedAclPacket(), DebugDumpRfState(), isr_timer0(), LLInit(), main(), and RFArbitrationBitDebug(). |
|
this function wraps the marcro RF_SCRAMBLE. previously, this was "called" directly in RFReceivePacket for efficiency reasons, but there seems to be enough time to call it as a function, which increases run-time-overhead but reduces binary size by 13 percent.Definition at line 1136 of file deepSleepSender/stackMasterSlaveSync.c. References rfScramblerReg. Referenced by RFReceivePacket(). |
|
this function wraps the marcro RF_SCRAMBLE. previously, this was "called" directly in RFSendPacket for efficiency reasons, but there seems to be enough time to call it as a function, which increases run-time-overhead but reduces binary size by 13 percent.Definition at line 1868 of file deepSleepSender/stackMasterSlaveSync.c. References rfScramblerReg. Referenced by RFSendPacket(). |