Rev 394 | Rev 397 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 394 | Rev 395 | ||
---|---|---|---|
Line 263... | Line 263... | ||
263 | // axis anable flags |
263 | // axis anable flags |
264 | #define ACC_CRTL1_XEN 0x01 |
264 | #define ACC_CRTL1_XEN 0x01 |
265 | #define ACC_CRTL1_YEN 0x02 |
265 | #define ACC_CRTL1_YEN 0x02 |
266 | #define ACC_CRTL1_ZEN 0x04 |
266 | #define ACC_CRTL1_ZEN 0x04 |
Line -... | Line 267... | ||
- | 267 | ||
- | 268 | #define ACC_CRTL2_FILTER8 0x00 |
|
- | 269 | #define ACC_CRTL2_FILTER16 0x01 |
|
- | 270 | #define ACC_CRTL2_FILTER32 0x02 |
|
- | 271 | #define ACC_CRTL2_FILTER64 0x03 |
|
267 | 272 | ||
268 | #define ACC_CTRL4_BDU 0x80 // Block data update, (0: continuos update; 1: output registers not updated between MSB and LSB reading) |
273 | #define ACC_CTRL4_BDU 0x80 // Block data update, (0: continuos update; 1: output registers not updated between MSB and LSB reading) |
269 | #define ACC_CTRL4_BLE 0x40 // Big/little endian, (0: data LSB @ lower address; 1: data MSB @ lower address) |
274 | #define ACC_CTRL4_BLE 0x40 // Big/little endian, (0: data LSB @ lower address; 1: data MSB @ lower address) |
270 | #define ACC_CTRL4_FS_2G 0x00 |
275 | #define ACC_CTRL4_FS_2G 0x00 |
271 | #define ACC_CTRL4_FS_4G 0x10 |
276 | #define ACC_CTRL4_FS_4G 0x10 |
Line 501... | Line 506... | ||
501 | memcpy((u8*)&AccRawVector, pRxBuffer,sizeof(AccRawVector)); |
506 | memcpy((u8*)&AccRawVector, pRxBuffer,sizeof(AccRawVector)); |
502 | } |
507 | } |
503 | DebugOut.Analog[16] = AccRawVector.X; |
508 | DebugOut.Analog[16] = AccRawVector.X; |
504 | DebugOut.Analog[17] = AccRawVector.Y; |
509 | DebugOut.Analog[17] = AccRawVector.Y; |
505 | DebugOut.Analog[18] = AccRawVector.Z; |
510 | DebugOut.Analog[18] = AccRawVector.Z; |
- | 511 | DebugOut.Analog[19] = (DebugOut.Analog[19] * 3 + AccRawVector.Z) / 4; |
|
506 | } |
512 | } |
507 | // rx data handler for reading magnetic sensor configuration |
513 | // rx data handler for reading magnetic sensor configuration |
508 | void NCMAG_UpdateMagConfig(u8* pRxBuffer, u8 RxBufferSize) |
514 | void NCMAG_UpdateMagConfig(u8* pRxBuffer, u8 RxBufferSize) |
509 | { // if number of byte are matching |
515 | { // if number of byte are matching |
510 | if(RxBufferSize == sizeof(MagConfig) ) |
516 | if(RxBufferSize == sizeof(MagConfig) ) |
Line 707... | Line 713... | ||
707 | MagConfig.crb = crb_gain; |
713 | MagConfig.crb = crb_gain; |
708 | MagConfig.mode = MODE_CONTINUOUS; |
714 | MagConfig.mode = MODE_CONTINUOUS; |
709 | return(NCMAG_SetMagConfig()); |
715 | return(NCMAG_SetMagConfig()); |
710 | } |
716 | } |
Line -... | Line 717... | ||
- | 717 | ||
711 | 718 | ||
712 | //---------------------------------------------------------------- |
719 | //---------------------------------------------------------------- |
713 | u8 NCMAG_Init_ACCSensor(void) |
720 | u8 NCMAG_Init_ACCSensor(void) |
714 | { |
721 | { |
715 | AccConfig.ctrl_1 = ACC_CRTL1_PM_NORMAL|ACC_CRTL1_DR_400HZ|ACC_CRTL1_XEN|ACC_CRTL1_YEN|ACC_CRTL1_ZEN; |
722 | AccConfig.ctrl_1 = ACC_CRTL1_PM_NORMAL|ACC_CRTL1_DR_50HZ|ACC_CRTL1_XEN|ACC_CRTL1_YEN|ACC_CRTL1_ZEN; |
716 | AccConfig.ctrl_2 = 0x00; |
723 | AccConfig.ctrl_2 = ACC_CRTL2_FILTER64; |
717 | AccConfig.ctrl_3 = 0x00; |
724 | AccConfig.ctrl_3 = 0x00; |
718 | AccConfig.ctrl_4 = ACC_CTRL4_BDU|ACC_CTRL4_FS_2G; |
725 | AccConfig.ctrl_4 = ACC_CTRL4_BDU|ACC_CTRL4_FS_8G; |
719 | AccConfig.ctrl_5 = ACC_CTRL5_STW_OFF; |
726 | AccConfig.ctrl_5 = ACC_CTRL5_STW_OFF; |
720 | return(NCMAG_SetAccConfig()); |
727 | return(NCMAG_SetAccConfig()); |
721 | } |
728 | } |
722 | // -------------------------------------------------------- |
729 | // -------------------------------------------------------- |