This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
Module : I2C_SW | |
Author : 05/04/2015, by KienLTb - https://kienltb.wordpress.com/ | |
Description : I2C software using bit-banging. | |
********************************************************************************/ | |
/*-----------------------------------------------------------------------------*/ | |
/* Header inclusions */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include "msp430g2231.h" | |
#include "stdarg.h" | |
void putc(unsigned); | |
void puts(char *); | |
static const unsigned long dv[] = { | |
// 4294967296 // 32 bit unsigned max | |
1000000000, // +0 | |
100000000, // +1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
Product: I2C - Hardware - Block | |
Module: I2C | |
Created: 12/04/2015, by KIENLTB | |
Description: I2C Driver for MSP430 | |
********************************************************************************/ | |
/*-----------------------------------------------------------------------------*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//count the 1 bits in a int | |
int count_ones(unsigned int x) | |
{ | |
int result = 0; | |
while (x != 0) | |
result++, x = x & (x-1); | |
return result; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Macro to convert the MSB/LSB of a 16-bit value to a 8-bit value | |
*/ | |
#define GET_16BIT_MSB( x ) ( (uint8_t)( ( ( (uint16_t)(x) ) >> 8 ) & 0xFF ) ) | |
#define GET_16BIT_LSB( x ) ( (uint8_t)( ( (uint16_t)(x) ) & 0xFF ) ) | |
/* macro to write the 16-bit value into an 8-bit buffer */ | |
#define BUF_SET_16BIT( buf, value ) \ | |
do { \ | |
((uint8_t *)(buf))[ 0 ] = GET_16BIT_MSB(value); \ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
Product: MPU6050 | |
Module: | |
Created: 4/6/2015, by KienLTb | |
Description: Driver MPU6050 for MSP430 | |
********************************************************************************/ | |
/*-----------------------------------------------------------------------------*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ifndef DELAY_H | |
#define DELAY_H | |
#include msp430g2553.h | |
#ifndef F_CPU | |
#warning F_CPU not defined for <delay.h>. Using default | |
#define F_CPU 1000000UL // 1 MHz | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/******************************************************************************** | |
Product: MSP430 Service Framework | |
Module: DataPackage Service | |
Created: 5/23/2015, by KIENLTB | |
Description: Service for process DataPackage | |
********************************************************************************/ | |
/*-----------------------------------------------------------------------------*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
obj-m := charDev.o | |
KERNELDIR ?= /lib/modules/$(shell uname -r)/build | |
PWD := $(shell pwd) | |
all: | |
$(MAKE) -C $(KERNELDIR) M=$(PWD) | |
clean: | |
rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions *.symvers *.order | |
OlderNewer