nrf app now compiles
authorDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 8 Aug 2013 20:13:33 +0000 (22:13 +0200)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Thu, 8 Aug 2013 20:13:33 +0000 (22:13 +0200)
firmware/config.mk
firmware/include/spi.h
firmware/platforms/arduino.h

index 43eba48..39528eb 100644 (file)
@@ -176,7 +176,7 @@ platform ?= arduino
 #BSL := avrdude -V -F -c stk500v1 -p m328p -b 57600 -P /dev/ttyACM0 -U flash:w:goodfet.hex
 CFLAGS=$(DEBUG) -Iinclude -mmcu=$(mcu) -W -Os -mcall-prologues -Wall -Wextra -Wuninitialized -fpack-struct -fshort-enums -funsigned-bitfields
 LDFLAGS := 
-config := monitor
+config := monitor nrf
 AVR_PLATFORM := m328p
 endif
 
index b4de686..9b8b75f 100644 (file)
 # define SS   (1 << PA3)
 # define TST  (1 << PA4)
 # define XRST (1 << PA5)
+#elif (platform == arduino)
+// pin Arduini - nrf pin
+// - nrf 1 GND
+// - nrf 2 +3.3V
+# define CE   (1 << PB0) // pin 8 - nrf 3 CE
+# define CS   (1 << PB1) // pin 9 - nrf 4 CSN
+//# define CS  (1 << PB2) // pin 10 CS
+# define MOSI (1 << PB3) // pin 11 MOSI - nrf 6 MOSI
+# define MISO (1 << PB4) // pin 12 MISO - nrf 7 MISO
+# define SCK  (1 << PB5) // pin 13 SCL  - nrf 5 CLK
+// - nrf 8 IRQ
+//# define TST  (1 << PA4)
+//# define XRST (1 << PA5)
 #else
 # define MOSI BIT1
 # define MISO BIT2
 # define CLRTST PORTA&=~(1 << PA4);
 # define SETRST PORTA|=(1 << PA5);
 # define CLRRST PORTA&=~(1 << PA5);
+#elif (platform == arduino)
+//# define SETTST PORTA|=(1 << PA4);
+//# define CLRTST PORTA&=~(1 << PA4);
+//# define SETRST PORTA|=(1 << PA5);
+//# define CLRRST PORTA&=~(1 << PA5);
 #else
 # define SETTST P4OUT|=TST
 # define CLRTST P4OUT&=~TST
index a25ac62..fceeef6 100644 (file)
@@ -17,21 +17,18 @@ void arduino_init();
 #define PLEDDIR DDRB
 #define PLEDPIN PB5
 
-//Use P3 instead of P5 for target I/O on chips without P5.
-#define SPIOUT P5OUT
-#define SPIDIR P5DIR
-#define SPIIN  P5IN
-#define SPIREN P5REN
-
-//No longer works for Hope badge.
-#define SETSS P5OUT|=BIT0
-#define CLRSS P5OUT&=~BIT0
-#define DIRSS P5DIR|=BIT0;
-
-//Used for the Nordic port, !RST pin on regular GoodFET.
-#define SETCE P2OUT|=BIT6
-#define CLRCE P2OUT&=~BIT6
-#define DIRCE P2DIR|=BIT6
+#define SPIOUT PORTB
+#define SPIDIR DDRB
+#define SPIIN  PINB
+
+// see also include/spi.h
+#define SETSS PORTB|=SS;
+#define CLRSS PORTB&=~SS;
+#define DIRSS DDRB|=SS;
+
+#define SETCE PORTB|=CE
+#define CLRCE PORTB&=~CE
+#define DIRCE PORTB|=CE
 
 // network byte order converters
 #define htons(x) ((((uint16_t)(x) & 0xFF00) >> 8) | \