Merge branch 'master' of https://bitbucket.org/mreenen/endopdracht-groep-5 into master
This commit is contained in:
commit
4a3eb3b56b
@ -21,7 +21,7 @@ typedef struct {
|
|||||||
int8_t g;
|
int8_t g;
|
||||||
} pakketje;
|
} pakketje;
|
||||||
|
|
||||||
void * GSensorTask(void *args) {
|
void * GSensorThread(void *args) {
|
||||||
|
|
||||||
I2C_Handle speedyBoy;
|
I2C_Handle speedyBoy;
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ void * GSensorTask(void *args) {
|
|||||||
while(1) {
|
while(1) {
|
||||||
bool success = I2C_transfer(speedyBoy, &RW_Trans);
|
bool success = I2C_transfer(speedyBoy, &RW_Trans);
|
||||||
if (success == false) {
|
if (success == false) {
|
||||||
while(1); // als een connectie niet kan worden gemaakt, blijf hier.w
|
while(1); // als een connectie niet kan worden gemaakt, blijf hier
|
||||||
}
|
}
|
||||||
// publish read into mailbox (defined in mqtt.c)
|
// publish read into mailbox (defined in mqtt.c)
|
||||||
timer++;
|
timer += 0.1;
|
||||||
sleeper = 6000000;
|
sleeper = 6000000;
|
||||||
|
|
||||||
pakketje pakket;
|
pakketje pakket;
|
||||||
|
|||||||
@ -1,4 +1,4 @@
|
|||||||
|
|
||||||
void * GSensorTask(void *args);
|
void * GSensorThread(void *args);
|
||||||
void * MQTTTask(void *args);
|
void * MQTTTask(void *args);
|
||||||
void * SocketTask(void *args);
|
void * SocketTask(void *args);
|
||||||
|
|||||||
59
src/main.c
59
src/main.c
@ -3,28 +3,63 @@
|
|||||||
#include <ti/sysbios/BIOS.h>
|
#include <ti/sysbios/BIOS.h>
|
||||||
#include <ti/drivers/GPIO.h>
|
#include <ti/drivers/GPIO.h>
|
||||||
#include "ti_drivers_config.h"
|
#include "ti_drivers_config.h"
|
||||||
|
#include <ti/drivers/I2C.h>
|
||||||
|
#include <ti/drivers/i2c/I2CCC32XX.h>
|
||||||
|
|
||||||
#include "debug/debug.h"
|
#include "./header.h"
|
||||||
#include "header.h"
|
|
||||||
|
#define BIGOLTHREADSTACK 4096
|
||||||
|
|
||||||
void Hardware_init(){
|
void Hardware_init(){
|
||||||
Board_init();
|
Board_init();
|
||||||
GPIO_init();
|
GPIO_init();
|
||||||
uartHandle = InitTerm();
|
I2C_init();
|
||||||
LOG_TRACE("Hardware initialisation done\r\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(void){
|
int main(void){
|
||||||
Hardware_init(); // initilize hardware
|
|
||||||
|
|
||||||
// ==============================================
|
pthread_t thread;
|
||||||
// === tread for G sensor =======================
|
pthread_attr_t attrs;
|
||||||
// ==============================================
|
struct sched_param priParam;
|
||||||
|
int retc;
|
||||||
|
|
||||||
|
Hardware_init(); // initialize hardware
|
||||||
|
|
||||||
|
/* Initialize the attributes structure with default values */
|
||||||
|
pthread_attr_init(&attrs);
|
||||||
|
|
||||||
|
/* Set priority, detach state, and stack size attributes */
|
||||||
|
priParam.sched_priority = 1;
|
||||||
|
retc = pthread_attr_setschedparam(&attrs, &priParam);
|
||||||
|
retc |= pthread_attr_setdetachstate(&attrs, PTHREAD_CREATE_DETACHED);
|
||||||
|
retc |= pthread_attr_setstacksize(&attrs, BIGOLTHREADSTACK);
|
||||||
|
if (retc != 0) {
|
||||||
|
/* failed to set attributes */
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* ==============================================
|
||||||
|
=== tread for G sensor =======================
|
||||||
|
==============================================
|
||||||
|
*/
|
||||||
|
retc = pthread_create(&thread, &attrs, GSensorThread, NULL);
|
||||||
|
if (retc != 0) {
|
||||||
|
/* pthread_create() failed */
|
||||||
|
while(1);
|
||||||
|
}
|
||||||
|
|
||||||
BIOS_start();
|
BIOS_start();
|
||||||
|
|
||||||
return 0;
|
return (0);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* ======== dummyOutput ========
|
||||||
|
* Dummy SysMin output function needed for benchmarks and size comparison
|
||||||
|
* of FreeRTOS and TI-RTOS solutions.
|
||||||
|
*/
|
||||||
|
void dummyOutput(void)
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user