Coder Social home page Coder Social logo

bgt60ltr11-library's Introduction

BGT60LTR11 60-GHz Radar Sensor C Library

This project contains library for controlling BGT60LTR11AIP, BGT60LTR11BAIP, and BGT60LTR11SAIP 60-GHz radar motion digital sensor from Infineon. Library is written in C and is designed as multiplatform.

Library was originally developed as part of Hackster Connect things with code! with Infineon Competition.

Features

  • Written in C. Can be used in both C and C++ projects.
  • Minimal RAM usage. No dynamic memory allocations.
  • Library core depends on stdint.h (for uint8_t, uint16_t, int16_t and uint32_t types) and stddef- (for size_t type).
  • Platform specific ports depends on vendor SDK (see section Supported platfroms and porting below).
  • Support for configuring sensor in SPI mode
  • Support for configuring 54 sensor parameters. For example (but not limited to):
    • Radio Signal Frequency
    • Detection threshold (sensitivity)
    • Hold time
    • Polarity of output signals
    • Idle state of output signal
    • PLL, Timing, Baseband and Bite parameters
    • SPI Mode and mapping internal singlas to SPI wires for debugging
  • Support for reading RAW ADC Data
  • Support for switching sensor mode
  • Support for soft reseting sensor
  • Support for reading chip version
  • Support for reading state of inputs used in autonomous mode
  • Tested with Infineon BGT60LTR11 S2GO Module

Library handles SPI interface of the sensor. Library do not handle TDet and PDet signals. You are supposed to manage them using platform specific GPIO driver directly.

Supporter Platforms

Currently Library is ported to following platforms. Library can be easily ported to any other platform by implementing 4 simple functions in BGT60LTR11_PlatformSpecific.c file.

Currently is library ported to following platforms:

  • Infineon (Cypress) PSoC 6 Microcontroller running PDL driver.

Getting started

  1. Go to Release page and download ZIP file targetting your platform or ZIP targeting Generic platform if your platform is not supported.
  2. Unzip downloaded file and copy all files to folder of your project or IDE.
  3. (If used Generic variant) implement 4 functions in BGT60LTR11_PlatformSpecific.c according to descriptions in comments in these functions.
  4. Add #include "BGT60LTR11.h" at the begining of your source code file.
  5. Allocate BGT60LTR11_Device structure. It must live for whole time when sensor is used.
  6. Call BGT60LTR11_Init() function at the begining of your program. Pass pointer to previously allocated structure and platform-specification identification of Chip Select pin.
  7. Use functions starting with BGT60LTR11_ prefix as needed.

Functions

Library contains following functions (you can find this listing in BGT60LTR11.h file):

BGT60LTR11_Status BGT60LTR11_Init(BGT60LTR11_Device* dev, uint32_t slaveSelect);
BGT60LTR11_Status BGT60LTR11_Deinit(BGT60LTR11_Device* dev);

BGT60LTR11_Status BGT60LTR11_SoftReset(BGT60LTR11_Device* dev);

BGT60LTR11_Status BGT60LTR11_LoadDefaultConfiguration(BGT60LTR11_Configuration* config);
BGT60LTR11_Status BGT60LTR11_SetConfiguration(BGT60LTR11_Device* dev, BGT60LTR11_Configuration* config);

BGT60LTR11_Status BGT60LTR11_SwitchToAutonomousPulsedMode(BGT60LTR11_Device* dev);
BGT60LTR11_Status BGT60LTR11_SwitchToAutonomousCWMode(BGT60LTR11_Device* dev);

BGT60LTR11_Status BGT60LTR11_GetQuadStateInput(BGT60LTR11_Device* dev, int inputNumber, BGT60LTR11_QuadState* state);
BGT60LTR11_Status BGT60LTR11_GetChipVersion(BGT60LTR11_Device* dev, uint8_t* chipVersion);

BGT60LTR11_Status BGT60LTR11_GetAdcData(BGT60LTR11_Device* dev, BGT60LTR11_AdcChannel adcChannel, uint16_t* data);
BGT60LTR11_Status BGT60LTR11_GetAdcDataMultiple(BGT60LTR11_Device* dev, BGT60LTR11_AdcChannel adcChannelStart, int adcChannelsCount, uint16_t* data);

Examples

Following example configure radar in default mode and turn it on. Example use default configuration. It is recommended to use BGT60LTR11_LoadDefaultConfiguration() as a base for configuration because configuring all 54 parameters form scratch is quite complicated. After BGT60LTR11_LoadDefaultConfiguration() call you can update only desired parameters while remaining other in default state.

If you want to reconfigure sensor, you should reset it first. Communication on SPI bus collides with communication of internal "main controller" and User Guide from Infineon explicitly recommends do not reconfiguring sensor when it is running. Recommended steps for reconfiguring sensor at runtime are exactly the same steps as initialy configuring sensor, except calling BGT60LTR11_Init which basically just prepares SPI bus driver and should be called only once.

#include "BGT60LTR11.h"

int main(void) {
	BGT60LTR11_Device radar;
	BGT60LTR11_Status bStatus;
	
	bStatus = BGT60LTR11_Init(&radar, CY_SCB_SPI_SLAVE_SELECT0);
	// Check bStatus for errors

	bStatus = BGT60LTR11_SoftReset(&radar);
	// Check bStatus for errors

	BGT60LTR11_Configuration config;
	BGT60LTR11_LoadDefaultConfiguration(&config);
	
	// Update configuration here.

	bStatus = BGT60LTR11_SetConfiguration(&radar, &config);
	// Check bStatus for errors
	
	bStatus = BGT60LTR11_SwitchToAutonomousPulsedMode(&radar);
	// Check bStatus for errors

	while (1) {
		// process TDet and PDet signals
	}
}

bgt60ltr11-library's People

Contributors

misaz avatar

Stargazers

 avatar  avatar

Watchers

 avatar

bgt60ltr11-library's Issues

Missing license for source files

Hi Misaz,

great job creating this library. You might want to added licensing information to you repo plus individual source files.

Thank you!
Paul

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.