2016-08-08 09:19:08 +00:00
|
|
|
/*
|
|
|
|
* main.c
|
|
|
|
*
|
|
|
|
* Created on: Aug 2, 2016
|
|
|
|
* Author: tkl
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <stdbool.h>
|
|
|
|
|
|
|
|
#include "driver.h"
|
|
|
|
#include "board.h"
|
|
|
|
#include "stack.h"
|
|
|
|
#include "queue.h"
|
|
|
|
#include "kernel.h"
|
|
|
|
#include "driver.h"
|
|
|
|
#include "list.h"
|
|
|
|
#include "shell.h"
|
|
|
|
|
2016-08-09 08:43:47 +00:00
|
|
|
|
2016-08-08 09:19:08 +00:00
|
|
|
#define TH_STACK_SIZE 256
|
|
|
|
stack_t th_stack[TH_STACK_SIZE];
|
|
|
|
struct thread_context th_ctx;
|
|
|
|
static void th_func(void *arg)
|
|
|
|
{
|
2016-08-09 09:57:54 +00:00
|
|
|
unsigned int duty = 0;
|
2016-08-09 10:28:01 +00:00
|
|
|
pwm_open(&pwm_ch4);
|
2016-08-08 09:19:08 +00:00
|
|
|
while(1) {
|
2016-08-09 10:32:19 +00:00
|
|
|
while(duty < 100) {
|
|
|
|
pwm_set_duty_cycle(&pwm_ch4, duty);
|
|
|
|
sleep_ms(10);
|
|
|
|
duty++;
|
|
|
|
}
|
|
|
|
while(duty > 0) {
|
|
|
|
pwm_set_duty_cycle(&pwm_ch4, duty);
|
|
|
|
sleep_ms(10);
|
|
|
|
duty--;
|
|
|
|
}
|
2016-08-08 09:19:08 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(void)
|
|
|
|
{
|
|
|
|
thread_create(&th_ctx, th_stack, TH_STACK_SIZE, th_func, NULL, THREAD_PRIO_LOW);
|
|
|
|
schedule_start();
|
|
|
|
|
|
|
|
return 0;
|
|
|
|
}
|