Added "native" examples for embedded platforms

This commit is contained in:
Ivan Kravets
2014-06-02 20:55:20 +03:00
parent f89d559977
commit 8506e13ad5
8 changed files with 116 additions and 3 deletions

View File

@@ -0,0 +1,10 @@
[env:arduino_pro5v]
platform = atmelavr
board_mcu = atmega168
board_f_cpu = 16000000L
upload_port = /dev/tty.SLAB_USBtoUART
upload_protocol = arduino
upload_speed = 19200
targets = upload

View File

@@ -0,0 +1,23 @@
/**
* Copyright (C) Ivan Kravets <me@ikravets.com>
* See LICENSE for details.
*/
#include <avr/io.h>
#include <util/delay.h>
int main(void)
{
// make the LED pin an output for PORTB5
DDRB = 1 << 5;
while (1)
{
_delay_ms(500);
// toggle the LED
PORTB ^= 1 << 5;
}
return 0;
}

View File

@@ -0,0 +1,8 @@
[env:launchpad_msp430g2]
platform = timsp430
board_mcu = msp430g2553
board_f_cpu = 16000000L
upload_protocol = rf2500
targets = upload

View File

@@ -0,0 +1,26 @@
/**
* Copyright (C) Ivan Kravets <me@ikravets.com>
* See LICENSE for details.
*/
#include <msp430g2553.h>
int main(void)
{
WDTCTL = WDTPW + WDTHOLD;
// make the LED pin an output for P1.0
P1DIR |= 0x01;
volatile int i;
while (1)
{
for (i = 0; i < 10000; i++);
// toggle the LED
P1OUT ^= 0x01;
}
return 0;
}

View File

@@ -0,0 +1,5 @@
[env:launchpad_lm4f120]
platform = titiva
framework = energia
board = lplm4f120h5qr
targets = upload

View File

@@ -0,0 +1,39 @@
/**
* Copyright (C) Ivan Kravets <me@ikravets.com>
* See LICENSE for details.
*/
#include <stdint.h>
#include <stdbool.h>
#include "inc/hw_memmap.h"
#include "driverlib/gpio.h"
#include "driverlib/sysctl.h"
#define LED_RED GPIO_PIN_1
#define LED_BLUE GPIO_PIN_2
#define LED_GREEN GPIO_PIN_3
int main(void)
{
SysCtlClockSet(
SYSCTL_SYSDIV_4|SYSCTL_USE_PLL|SYSCTL_XTAL_16MHZ|SYSCTL_OSC_MAIN);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOF);
GPIOPinTypeGPIOOutput(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN);
while (1)
{
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_RED);
SysCtlDelay(3000000);
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_BLUE);
SysCtlDelay(3000000);
GPIOPinWrite(GPIO_PORTF_BASE, LED_RED|LED_BLUE|LED_GREEN, LED_GREEN);
SysCtlDelay(3000000);
}
return 0;
}
// hook for Energia main.cpp where these methods are defined
void setup() {}
void loop() {}

View File

@@ -1,13 +1,15 @@
[env:arduino_pro5v] [env:arduino_pro5v]
platform = atmelavr platform = atmelavr
board = pro5v framework = arduino
board = pro16MHzatmega168
upload_port = /dev/tty.SLAB_USBtoUART upload_port = /dev/tty.SLAB_USBtoUART
targets = upload
[env:launchpad_msp430g2] [env:launchpad_msp430g2]
platform = timsp430 platform = timsp430
framework = energia
board = lpmsp430g2553 board = lpmsp430g2553
[env:launchpad_lm4f120] [env:launchpad_lm4f120]
platform = titiva platform = titiva
framework = energia
board = lplm4f120h5qr board = lplm4f120h5qr

View File

@@ -31,4 +31,4 @@ void loop()
delay(1000); // wait for a second delay(1000); // wait for a second
digitalWrite(WLED, LOW); // set the LED off digitalWrite(WLED, LOW); // set the LED off
delay(1000); // wait for a second delay(1000); // wait for a second
} }