Add multi-application support
This commit is contained in:
26
src/application/blinky/main.c
Normal file
26
src/application/blinky/main.c
Normal file
@@ -0,0 +1,26 @@
|
||||
#include <stdbool.h>
|
||||
#include <limits.h>
|
||||
#include "nrf_delay.h"
|
||||
#include "boards.h"
|
||||
#include "platform/narf52/narf52_dk.h"
|
||||
|
||||
#include "driver.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
drv_open(&led_1);
|
||||
drv_open(&led_2);
|
||||
drv_open(&led_3);
|
||||
drv_open(&led_4);
|
||||
|
||||
while(true) {
|
||||
for(unsigned int i = 0; i < UINT_MAX; i++) {
|
||||
char x = 0x30 | (char)(1 & i);
|
||||
drv_write(&led_1, &x, 1);
|
||||
drv_write(&led_2, &x, 1);
|
||||
drv_write(&led_3, &x, 1);
|
||||
drv_write(&led_4, &x, 1);
|
||||
nrf_delay_ms(500);
|
||||
}
|
||||
}
|
||||
}
|
34
src/application/button/main.c
Normal file
34
src/application/button/main.c
Normal file
@@ -0,0 +1,34 @@
|
||||
#include <stdbool.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include "board.h"
|
||||
#include "driver.h"
|
||||
|
||||
int main(void)
|
||||
{
|
||||
// bsp_board_init(BSP_INIT_LEDS);
|
||||
drv_open(&led_1);
|
||||
drv_open(&led_2);
|
||||
drv_open(&led_3);
|
||||
drv_open(&led_4);
|
||||
|
||||
drv_open(&button_1);
|
||||
drv_open(&button_2);
|
||||
drv_open(&button_3);
|
||||
drv_open(&button_4);
|
||||
|
||||
while(true) {
|
||||
char x;
|
||||
drv_read(&button_1, &x, 1);
|
||||
drv_write(&led_1, &x, 1);
|
||||
|
||||
drv_read(&button_2, &x, 1);
|
||||
drv_write(&led_2, &x, 1);
|
||||
|
||||
drv_read(&button_3, &x, 1);
|
||||
drv_write(&led_3, &x, 1);
|
||||
|
||||
drv_read(&button_4, &x, 1);
|
||||
drv_write(&led_4, &x, 1);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user