mirror of
https://github.com/platformio/platformio-core.git
synced 2025-08-02 19:34:27 +02:00
Added "native" examples for embedded platforms
This commit is contained in:
10
examples/atmelavr-native-blink/platformio.ini
Normal file
10
examples/atmelavr-native-blink/platformio.ini
Normal 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
|
23
examples/atmelavr-native-blink/src/main.c
Normal file
23
examples/atmelavr-native-blink/src/main.c
Normal 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;
|
||||||
|
}
|
8
examples/timsp430-native-blink/platformio.ini
Normal file
8
examples/timsp430-native-blink/platformio.ini
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[env:launchpad_msp430g2]
|
||||||
|
platform = timsp430
|
||||||
|
board_mcu = msp430g2553
|
||||||
|
board_f_cpu = 16000000L
|
||||||
|
|
||||||
|
upload_protocol = rf2500
|
||||||
|
|
||||||
|
targets = upload
|
26
examples/timsp430-native-blink/src/main.c
Normal file
26
examples/timsp430-native-blink/src/main.c
Normal 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;
|
||||||
|
}
|
5
examples/titiva-native-blink/platformio.ini
Normal file
5
examples/titiva-native-blink/platformio.ini
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
[env:launchpad_lm4f120]
|
||||||
|
platform = titiva
|
||||||
|
framework = energia
|
||||||
|
board = lplm4f120h5qr
|
||||||
|
targets = upload
|
39
examples/titiva-native-blink/src/main.c
Normal file
39
examples/titiva-native-blink/src/main.c
Normal 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() {}
|
@@ -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
|
Reference in New Issue
Block a user