-# These targets are compiled to execute at the beginning of RAM.
-# Each should conclude with HALT (0xA5).
+# These targets are compiled to execute at the beginning of RAM. Each
+# should conclude with HALT (0xA5). Sometimes grabbing code from
+# foo.rst will be smaller, especially if no ljmps occur.
+
+
+# Input and output should be taken from a buffer at 0xFE00.
+# "char __xdata at 0xfe00 packet[256] ;"
+# Use lower RAM if needed.
CC=sdcc --code-loc 0xF000
-objs=crystal.ihx
+objs=crystal.ihx txpacket.ihx
all: $(objs)
--- /dev/null
+#include <cc1110.h>
+#include "cc1110-ext.h"
+
+char __xdata at 0xfe00 packet[256] ;
+
+
+//! Receives a packet out of the radio from 0xFE00.
+void main(){
+ unsigned char len=100, i=0;
+ RFST=RFST_SRX; //Begin to receive.
+ while(i!=len+1){
+ while(RFTXRXIF); //Wait for byte to be ready.
+
+ RFTXRXIF=0; //Clear the flag.
+ packet[i++]=RFD; //Grab the next byte.
+ len=packet[0]; //First byte of the packet is the length.
+ }
+ RFST = RFST_SIDLE; //End transmit.
+ HALT;
+}
--- /dev/null
+#include <cc1110.h>
+#include "cc1110-ext.h"
+
+char __xdata at 0xfe00 packet[256] ;
+
+//! Transmit a packet out of the radio from 0xFE00.
+void main(){
+ unsigned char len=packet[0], i=0;
+ RFST=RFST_STX; //Begin transmit.
+ while(i!=len+1){
+ while(RFTXRXIF); //Wait for byte to be ready.
+
+ RFTXRXIF=0; //Clear the flag.
+ RFD=packet[i++]; //Send the next byte.
+ }
+ RFST = RFST_SIDLE; //End transmit.
+ HALT;
+}