Commits

Cameron Adamez  committed 1235b03

Pulling references to avr and replacing them with Wirish.
Wirish is aiming to be portable among microcontrollers, so we can replace some of the Arduino convenience functions with their more general C equivalents.

  • Participants
  • Parent commits 4fab503

Comments (0)

Files changed (4)

File TVout/TVout.h

 #define TVOUT_H
 
 #include <stdint.h>
-#include <avr/io.h>
-#include <avr/pgmspace.h>
-#include <avr/interrupt.h>
+#include <Wirish.h>
+//#include <avr/io.h>
+//#include <avr/interrupt.h>
 #include <stdlib.h>
 
 #include "video_gen.h"
 
 #define WHITE					1
 #define BLACK					0
-#define INVERT					2
+#define INVERT				2
 
 #define UP						0
 #define DOWN					1
 #define clear_screen()				fill(0)
 #define invert(color)				fill(2)
 
+// TODO Recalculate _CYCLES_PER_US for Maple.
+#ifdef _CYCLES_PER_US
+#undef _CYCLES_PER_US 
+#define _CYCLES_PER_US 129120 
+#endif
+
+//Macros to replace avr/pgmspace.h
+typedef const unsigned char prog_uchar;
+#define pgm_read_byte_near(x) (*(prog_uchar*)x)
+#define pgm_read_byte(x) (*(prog_uchar*)x)
+
+#ifndef uint8_t 
+#define uint8_t uint8
+#define uint16_t uint16 
+#define uint32_t uint32 
+#endif
 /*
 TVout.cpp contains a brief expenation of each function.
 */

File TVout/TVoutPrint.cpp

 */
 
 #include <math.h>
-#include <avr/pgmspace.h>
-
 #include "TVout.h"
 
 void TVout::select_font(const unsigned char * f) {
     print(toPrint);
     remainder -= toPrint; 
   } 
-}
+}

File TVout/video_gen.cpp

  OTHER DEALINGS IN THE SOFTWARE.
 */
 
-#include <avr/interrupt.h>
-#include <avr/io.h>
+//#include <avr/interrupt.h>
+//#include <avr/io.h>
 
 #include "video_gen.h"
 #include "spec/video_properties.h"
 
 static void inline wait_until(uint8_t time) {
 	__asm__ __volatile__ (
+      // Subtract immediate
 			"subi	%[time], 10\n"
+      // Subtract without carry
 			"sub	%[time], %[tcnt1l]\n\t"
 		"100:\n\t"
 			"subi	%[time], 3\n\t"

File TVout/video_gen.h

  FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  OTHER DEALINGS IN THE SOFTWARE.
 */
-
+#include <Wirish.h>
+#ifndef uint8_t 
+#define uint8_t uint8
+#define uint16_t uint16 
+#define uint32_t uint32 
+#endif
 #ifndef VIDEO_GEN_H
 #define VIDEO_GEN_H