old_contents:
%{#
#include <avr/eeprom.h>
%}
fun eeprom_read_byte (address: int): uint8 = "mac#"
fun eeprom_write_byte (address: int, value: uint8): void = "mac#"

new_contents:
%{#
#include <avr/eeprom.h>
%}
fun eeprom_read_byte {n:nat} (address: int n): uint8 = "mac#"
fun eeprom_write_byte {n:nat} (address: int n, value: uint8): void = "mac#"

subject: Add dependent types into EEPROM API

message: Add dependent types into EEPROM API

license: mit


old_contents: implement main0 () = ()

new_contents:
%{^
#include "LPC17xx.h"
%}

%{
volatile int g_LoopDummy;

void c_blink(void)
{
	LPC_GPIO1->FIODIR |= 1 << 18; // P1.18 connected to LED1
	while(1)
	{
		int i;

		LPC_GPIO1->FIOPIN ^= 1 << 18; // Toggle P1.18
		for (i = 0 ; i < 5000000 && !g_LoopDummy ; i++)
		{
		}
	}
}
%}

extern fun c_blink (): void = "mac#"

implement main0 () = c_blink ()

subject: Include C raw source code

message: Include C raw source code


new_contents:
%{^
#include "mbed_interface.h"
%}

typedef char_p = cPtr0(char)

fun mbed_mac_address: (char_p) -> void = "mac#"

subject: Add type to mbed interface

message: Add type to mbed interface