From c0bafb4509ca62fdb81d43e7e67a031aa3ad7ea5 Mon Sep 17 00:00:00 2001 From: LibDriver <704839379@qq.com> Date: Mon, 8 Jul 2024 20:55:08 +0800 Subject: [PATCH] fix: fix deinit bugs --- CHANGELOG.md | 6 + doc/html/driver__bmp280_8c_source.html | 1602 +++++++++-------- doc/html/driver__bmp280_8h_source.html | 40 +- doc/html/driver__bmp280__basic_8c_source.html | 14 +- .../driver__bmp280__read__test_8c_source.html | 14 +- ...ver__bmp280__register__test_8c_source.html | 30 +- doc/html/driver__bmp280__shot_8c_source.html | 14 +- doc/html/group__bmp280__base__driver.html | 36 +- doc/html/group__bmp280__extern__driver.html | 4 +- src/driver_bmp280.c | 18 +- 10 files changed, 904 insertions(+), 874 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 0566a8b..f380faf 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,9 @@ +## 1.0.1 (2024-07-08) + +## Bug Fixes + +- fix deinit bugs + ## 1.0.0 (2024-01-15) ## Features diff --git a/doc/html/driver__bmp280_8c_source.html b/doc/html/driver__bmp280_8c_source.html index c049de6..495f53d 100644 --- a/doc/html/driver__bmp280_8c_source.html +++ b/doc/html/driver__bmp280_8c_source.html @@ -545,790 +545,802 @@
608 
609  return 4; /* return error */
610  }
-
611  if (handle->iic_deinit() != 0) /* iic deinit */
+
611  if (handle->iic_spi == BMP280_INTERFACE_IIC) /* iic interface */
612  {
-
613  handle->debug_print("bmp280: iic deinit failed.\n"); /* iic deinit failed */
-
614 
-
615  return 1; /* return error */
-
616  }
-
617  handle->inited = 0; /* flag close */
-
618 
-
619  return 0; /* success return 0 */
-
620 }
-
621 
-
632 uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
-
633 {
-
634  uint8_t reg;
-
635 
-
636  if (handle == NULL) /* check handle */
-
637  {
-
638  return 2; /* return error */
-
639  }
-
640  if (handle->inited != 1) /* check handle initialization */
-
641  {
-
642  return 3; /* return error */
-
643  }
-
644 
-
645  reg = 0xB6; /* set the reset value */
-
646  if (a_bmp280_iic_spi_write(handle, BMP280_REG_RESET, &reg, 1) != 0) /* reset the chip */
-
647  {
-
648  handle->debug_print("bmp280: reset failed.\n"); /* reset failed */
-
649 
-
650  return 1; /* return error */
+
613  if (handle->iic_deinit() != 0) /* iic deinit */
+
614  {
+
615  handle->debug_print("bmp280: iic deinit failed.\n"); /* iic deinit failed */
+
616 
+
617  return 1; /* return error */
+
618  }
+
619  }
+
620  else /* spi interface */
+
621  {
+
622  if (handle->spi_deinit() != 0) /* spi deinit */
+
623  {
+
624  handle->debug_print("bmp280: spi deinit failed.\n"); /* spi deinit failed */
+
625 
+
626  return 1; /* return error */
+
627  }
+
628  }
+
629  handle->inited = 0; /* flag close */
+
630 
+
631  return 0; /* success return 0 */
+
632 }
+
633 
+
644 uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
+
645 {
+
646  uint8_t reg;
+
647 
+
648  if (handle == NULL) /* check handle */
+
649  {
+
650  return 2; /* return error */
651  }
-
652  handle->delay_ms(5); /* delay 5ms */
-
653 
-
654  return 0; /* success return 0 */
-
655 }
+
652  if (handle->inited != 1) /* check handle initialization */
+
653  {
+
654  return 3; /* return error */
+
655  }
656 
-
668 uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
-
669 {
-
670  if (handle == NULL) /* check handle */
-
671  {
-
672  return 2; /* return error */
-
673  }
-
674  if (handle->inited != 1) /* check handle initialization */
-
675  {
-
676  return 3; /* return error */
-
677  }
-
678 
-
679  if (a_bmp280_iic_spi_read(handle, BMP280_REG_STATUS, status, 1) != 0) /* read status */
-
680  {
-
681  handle->debug_print("bmp280: read status failed.\n"); /* read status failed */
-
682 
-
683  return 1; /* return error */
-
684  }
-
685 
-
686  return 0; /* success return 0 */
-
687 }
-
688 
-
700 uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
-
701 {
-
702  uint8_t prev;
-
703 
-
704  if (handle == NULL) /* check handle */
-
705  {
-
706  return 2; /* return error */
-
707  }
-
708  if (handle->inited != 1) /* check handle initialization */
-
709  {
-
710  return 3; /* return error */
-
711  }
-
712 
-
713  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
714  {
-
715  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
716 
-
717  return 1; /* return error */
-
718  }
-
719  prev &= ~(7 << 5); /* clear settings */
-
720  prev |= oversampling << 5; /* set oversampling */
-
721  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
-
722  {
-
723  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
657  reg = 0xB6; /* set the reset value */
+
658  if (a_bmp280_iic_spi_write(handle, BMP280_REG_RESET, &reg, 1) != 0) /* reset the chip */
+
659  {
+
660  handle->debug_print("bmp280: reset failed.\n"); /* reset failed */
+
661 
+
662  return 1; /* return error */
+
663  }
+
664  handle->delay_ms(5); /* delay 5ms */
+
665 
+
666  return 0; /* success return 0 */
+
667 }
+
668 
+
680 uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
+
681 {
+
682  if (handle == NULL) /* check handle */
+
683  {
+
684  return 2; /* return error */
+
685  }
+
686  if (handle->inited != 1) /* check handle initialization */
+
687  {
+
688  return 3; /* return error */
+
689  }
+
690 
+
691  if (a_bmp280_iic_spi_read(handle, BMP280_REG_STATUS, status, 1) != 0) /* read status */
+
692  {
+
693  handle->debug_print("bmp280: read status failed.\n"); /* read status failed */
+
694 
+
695  return 1; /* return error */
+
696  }
+
697 
+
698  return 0; /* success return 0 */
+
699 }
+
700 
+
712 uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
+
713 {
+
714  uint8_t prev;
+
715 
+
716  if (handle == NULL) /* check handle */
+
717  {
+
718  return 2; /* return error */
+
719  }
+
720  if (handle->inited != 1) /* check handle initialization */
+
721  {
+
722  return 3; /* return error */
+
723  }
724 
-
725  return 1; /* return error */
-
726  }
-
727 
-
728  return 0; /* success return 0 */
-
729 }
-
730 
-
742 uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
-
743 {
-
744  uint8_t prev;
-
745 
-
746  if (handle == NULL) /* check handle */
-
747  {
-
748  return 2; /* return error */
-
749  }
-
750  if (handle->inited != 1) /* check handle initialization */
-
751  {
-
752  return 3; /* return error */
-
753  }
-
754 
-
755  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
756  {
-
757  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
758 
-
759  return 1; /* return error */
-
760  }
-
761  *oversampling = (bmp280_oversampling_t)((prev >> 5) & 0x7); /* set oversampling */
-
762 
-
763  return 0; /* success return 0 */
-
764 }
-
765 
-
777 uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
-
778 {
-
779  uint8_t prev;
-
780 
-
781  if (handle == NULL) /* check handle */
-
782  {
-
783  return 2; /* return error */
-
784  }
-
785  if (handle->inited != 1) /* check handle initialization */
-
786  {
-
787  return 3; /* return error */
-
788  }
-
789 
-
790  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
791  {
-
792  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
793 
-
794  return 1; /* return error */
-
795  }
-
796  prev &= ~(7 << 2); /* clear settings */
-
797  prev |= oversampling << 2; /* set oversampling */
-
798  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
-
799  {
-
800  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
725  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
726  {
+
727  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
728 
+
729  return 1; /* return error */
+
730  }
+
731  prev &= ~(7 << 5); /* clear settings */
+
732  prev |= oversampling << 5; /* set oversampling */
+
733  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
+
734  {
+
735  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
736 
+
737  return 1; /* return error */
+
738  }
+
739 
+
740  return 0; /* success return 0 */
+
741 }
+
742 
+
754 uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
+
755 {
+
756  uint8_t prev;
+
757 
+
758  if (handle == NULL) /* check handle */
+
759  {
+
760  return 2; /* return error */
+
761  }
+
762  if (handle->inited != 1) /* check handle initialization */
+
763  {
+
764  return 3; /* return error */
+
765  }
+
766 
+
767  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
768  {
+
769  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
770 
+
771  return 1; /* return error */
+
772  }
+
773  *oversampling = (bmp280_oversampling_t)((prev >> 5) & 0x7); /* set oversampling */
+
774 
+
775  return 0; /* success return 0 */
+
776 }
+
777 
+
789 uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
+
790 {
+
791  uint8_t prev;
+
792 
+
793  if (handle == NULL) /* check handle */
+
794  {
+
795  return 2; /* return error */
+
796  }
+
797  if (handle->inited != 1) /* check handle initialization */
+
798  {
+
799  return 3; /* return error */
+
800  }
801 
-
802  return 1; /* return error */
-
803  }
-
804 
-
805  return 0; /* success return 0 */
-
806 }
-
807 
-
819 uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
-
820 {
-
821  uint8_t prev;
-
822 
-
823  if (handle == NULL) /* check handle */
-
824  {
-
825  return 2; /* return error */
-
826  }
-
827  if (handle->inited != 1) /* check handle initialization */
-
828  {
-
829  return 3; /* return error */
-
830  }
-
831 
-
832  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
833  {
-
834  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
835 
-
836  return 1; /* return error */
-
837  }
-
838  *oversampling = (bmp280_oversampling_t)((prev >> 2) & 0x7); /* set oversampling */
-
839 
-
840  return 0; /* success return 0 */
-
841 }
-
842 
-
854 uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
-
855 {
-
856  uint8_t prev;
-
857 
-
858  if (handle == NULL) /* check handle */
-
859  {
-
860  return 2; /* return error */
-
861  }
-
862  if (handle->inited != 1) /* check handle initialization */
-
863  {
-
864  return 3; /* return error */
-
865  }
-
866 
-
867  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
868  {
-
869  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
870 
-
871  return 1; /* return error */
-
872  }
-
873  prev &= ~(3 << 0); /* clear settings */
-
874  prev |= mode << 0; /* set mode */
-
875  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
-
876  {
-
877  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
802  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
803  {
+
804  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
805 
+
806  return 1; /* return error */
+
807  }
+
808  prev &= ~(7 << 2); /* clear settings */
+
809  prev |= oversampling << 2; /* set oversampling */
+
810  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
+
811  {
+
812  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
813 
+
814  return 1; /* return error */
+
815  }
+
816 
+
817  return 0; /* success return 0 */
+
818 }
+
819 
+
831 uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
+
832 {
+
833  uint8_t prev;
+
834 
+
835  if (handle == NULL) /* check handle */
+
836  {
+
837  return 2; /* return error */
+
838  }
+
839  if (handle->inited != 1) /* check handle initialization */
+
840  {
+
841  return 3; /* return error */
+
842  }
+
843 
+
844  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
845  {
+
846  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
847 
+
848  return 1; /* return error */
+
849  }
+
850  *oversampling = (bmp280_oversampling_t)((prev >> 2) & 0x7); /* set oversampling */
+
851 
+
852  return 0; /* success return 0 */
+
853 }
+
854 
+
866 uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
+
867 {
+
868  uint8_t prev;
+
869 
+
870  if (handle == NULL) /* check handle */
+
871  {
+
872  return 2; /* return error */
+
873  }
+
874  if (handle->inited != 1) /* check handle initialization */
+
875  {
+
876  return 3; /* return error */
+
877  }
878 
-
879  return 1; /* return error */
-
880  }
-
881 
-
882  return 0; /* success return 0 */
-
883 }
-
884 
-
896 uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
-
897 {
-
898  uint8_t prev;
-
899 
-
900  if (handle == NULL) /* check handle */
-
901  {
-
902  return 2; /* return error */
-
903  }
-
904  if (handle->inited != 1) /* check handle initialization */
-
905  {
-
906  return 3; /* return error */
-
907  }
-
908 
-
909  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
910  {
-
911  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
912 
-
913  return 1; /* return error */
-
914  }
-
915  *mode = (bmp280_mode_t)((prev >> 0) & 0x3); /* set mode */
-
916 
-
917  return 0; /* success return 0 */
-
918 }
-
919 
-
931 uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
-
932 {
-
933  uint8_t prev;
-
934 
-
935  if (handle == NULL) /* check handle */
-
936  {
-
937  return 2; /* return error */
-
938  }
-
939  if (handle->inited != 1) /* check handle initialization */
-
940  {
-
941  return 3; /* return error */
-
942  }
-
943 
-
944  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
-
945  {
-
946  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
-
947 
-
948  return 1; /* return error */
-
949  }
-
950  prev &= ~(7 << 5); /* clear settings */
-
951  prev |= standby_time << 5; /* set standby time */
-
952  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* write config */
-
953  {
-
954  handle->debug_print("bmp280: write config failed.\n"); /* write config failed */
+
879  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
880  {
+
881  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
882 
+
883  return 1; /* return error */
+
884  }
+
885  prev &= ~(3 << 0); /* clear settings */
+
886  prev |= mode << 0; /* set mode */
+
887  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
+
888  {
+
889  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
890 
+
891  return 1; /* return error */
+
892  }
+
893 
+
894  return 0; /* success return 0 */
+
895 }
+
896 
+
908 uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
+
909 {
+
910  uint8_t prev;
+
911 
+
912  if (handle == NULL) /* check handle */
+
913  {
+
914  return 2; /* return error */
+
915  }
+
916  if (handle->inited != 1) /* check handle initialization */
+
917  {
+
918  return 3; /* return error */
+
919  }
+
920 
+
921  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
922  {
+
923  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
924 
+
925  return 1; /* return error */
+
926  }
+
927  *mode = (bmp280_mode_t)((prev >> 0) & 0x3); /* set mode */
+
928 
+
929  return 0; /* success return 0 */
+
930 }
+
931 
+
943 uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
+
944 {
+
945  uint8_t prev;
+
946 
+
947  if (handle == NULL) /* check handle */
+
948  {
+
949  return 2; /* return error */
+
950  }
+
951  if (handle->inited != 1) /* check handle initialization */
+
952  {
+
953  return 3; /* return error */
+
954  }
955 
-
956  return 1; /* return error */
-
957  }
-
958 
-
959  return 0; /* success return 0 */
-
960 }
-
961 
-
973 uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
-
974 {
-
975  uint8_t prev;
-
976 
-
977  if (handle == NULL) /* check handle */
-
978  {
-
979  return 2; /* return error */
-
980  }
-
981  if (handle->inited != 1) /* check handle initialization */
-
982  {
-
983  return 3; /* return error */
-
984  }
-
985 
-
986  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
-
987  {
-
988  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
-
989 
-
990  return 1; /* return error */
-
991  }
-
992  *standby_time = (bmp280_standby_time_t)((prev >> 5) & 0x7); /* get standby time */
-
993 
-
994  return 0; /* success return 0 */
-
995 }
-
996 
-
1008 uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
-
1009 {
-
1010  uint8_t prev;
-
1011 
-
1012  if (handle == NULL) /* check handle */
-
1013  {
-
1014  return 2; /* return error */
-
1015  }
-
1016  if (handle->inited != 1) /* check handle initialization */
-
1017  {
-
1018  return 3; /* return error */
-
1019  }
-
1020 
-
1021  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
-
1022  {
-
1023  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
-
1024 
-
1025  return 1; /* return error */
-
1026  }
-
1027  prev &= ~(7 << 2); /* clear settings */
-
1028  prev |= (filter & 0x07) << 2; /* set filter */
-
1029  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* write config */
-
1030  {
-
1031  handle->debug_print("bmp280: write config failed.\n"); /* write config failed */
+
956  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
+
957  {
+
958  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
+
959 
+
960  return 1; /* return error */
+
961  }
+
962  prev &= ~(7 << 5); /* clear settings */
+
963  prev |= standby_time << 5; /* set standby time */
+
964  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* write config */
+
965  {
+
966  handle->debug_print("bmp280: write config failed.\n"); /* write config failed */
+
967 
+
968  return 1; /* return error */
+
969  }
+
970 
+
971  return 0; /* success return 0 */
+
972 }
+
973 
+
985 uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
+
986 {
+
987  uint8_t prev;
+
988 
+
989  if (handle == NULL) /* check handle */
+
990  {
+
991  return 2; /* return error */
+
992  }
+
993  if (handle->inited != 1) /* check handle initialization */
+
994  {
+
995  return 3; /* return error */
+
996  }
+
997 
+
998  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
+
999  {
+
1000  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
+
1001 
+
1002  return 1; /* return error */
+
1003  }
+
1004  *standby_time = (bmp280_standby_time_t)((prev >> 5) & 0x7); /* get standby time */
+
1005 
+
1006  return 0; /* success return 0 */
+
1007 }
+
1008 
+
1020 uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
+
1021 {
+
1022  uint8_t prev;
+
1023 
+
1024  if (handle == NULL) /* check handle */
+
1025  {
+
1026  return 2; /* return error */
+
1027  }
+
1028  if (handle->inited != 1) /* check handle initialization */
+
1029  {
+
1030  return 3; /* return error */
+
1031  }
1032 
-
1033  return 1; /* return error */
-
1034  }
-
1035 
-
1036  return 0; /* success return 0 */
-
1037 }
-
1038 
-
1050 uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
-
1051 {
-
1052  uint8_t prev;
-
1053 
-
1054  if (handle == NULL) /* check handle */
-
1055  {
-
1056  return 2; /* return error */
-
1057  }
-
1058  if (handle->inited != 1) /* check handle initialization */
-
1059  {
-
1060  return 3; /* return error */
-
1061  }
-
1062 
-
1063  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
-
1064  {
-
1065  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
-
1066 
-
1067  return 1; /* return error */
-
1068  }
-
1069  *filter = (bmp280_filter_t)((prev >> 2) & 0x07); /* set filter */
-
1070 
-
1071  return 0; /* success return 0 */
-
1072 }
-
1073 
-
1085 uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
-
1086 {
-
1087  uint8_t prev;
-
1088 
-
1089  if (handle == NULL) /* check handle */
-
1090  {
-
1091  return 2; /* return error */
-
1092  }
-
1093  if (handle->inited != 1) /* check handle initialization */
-
1094  {
-
1095  return 3; /* return error */
-
1096  }
-
1097 
-
1098  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
-
1099  {
-
1100  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
-
1101 
-
1102  return 1; /* return error */
-
1103  }
-
1104  prev &= ~(1 << 0); /* clear settings */
-
1105  prev |= spi << 0; /* set spi wire */
-
1106  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* write config */
-
1107  {
-
1108  handle->debug_print("bmp280: write config failed.\n"); /* write config failed */
+
1033  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
+
1034  {
+
1035  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
+
1036 
+
1037  return 1; /* return error */
+
1038  }
+
1039  prev &= ~(7 << 2); /* clear settings */
+
1040  prev |= (filter & 0x07) << 2; /* set filter */
+
1041  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* write config */
+
1042  {
+
1043  handle->debug_print("bmp280: write config failed.\n"); /* write config failed */
+
1044 
+
1045  return 1; /* return error */
+
1046  }
+
1047 
+
1048  return 0; /* success return 0 */
+
1049 }
+
1050 
+
1062 uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
+
1063 {
+
1064  uint8_t prev;
+
1065 
+
1066  if (handle == NULL) /* check handle */
+
1067  {
+
1068  return 2; /* return error */
+
1069  }
+
1070  if (handle->inited != 1) /* check handle initialization */
+
1071  {
+
1072  return 3; /* return error */
+
1073  }
+
1074 
+
1075  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
+
1076  {
+
1077  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
+
1078 
+
1079  return 1; /* return error */
+
1080  }
+
1081  *filter = (bmp280_filter_t)((prev >> 2) & 0x07); /* set filter */
+
1082 
+
1083  return 0; /* success return 0 */
+
1084 }
+
1085 
+
1097 uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
+
1098 {
+
1099  uint8_t prev;
+
1100 
+
1101  if (handle == NULL) /* check handle */
+
1102  {
+
1103  return 2; /* return error */
+
1104  }
+
1105  if (handle->inited != 1) /* check handle initialization */
+
1106  {
+
1107  return 3; /* return error */
+
1108  }
1109 
-
1110  return 1; /* return error */
-
1111  }
-
1112 
-
1113  return 0; /* success return 0 */
-
1114 }
-
1115 
-
1127 uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
-
1128 {
-
1129  uint8_t prev;
-
1130 
-
1131  if (handle == NULL) /* check handle */
-
1132  {
-
1133  return 2; /* return error */
-
1134  }
-
1135  if (handle->inited != 1) /* check handle initialization */
-
1136  {
-
1137  return 3; /* return error */
-
1138  }
-
1139 
-
1140  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
-
1141  {
-
1142  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
-
1143 
-
1144  return 1; /* return error */
-
1145  }
-
1146  *spi = (bmp280_spi_wire_t)((prev >> 0) & 0x01); /* get spi */
-
1147 
-
1148  return 0; /* success return 0 */
-
1149 }
-
1150 
-
1165 uint8_t bmp280_read_pressure(bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
-
1166 {
-
1167  uint8_t res;
-
1168  uint8_t prev;
-
1169  uint32_t timeout;
-
1170  uint32_t temperature_raw;
-
1171  float temperature_c;
-
1172  uint8_t buf[6];
-
1173 
-
1174  if (handle == NULL) /* check handle */
-
1175  {
-
1176  return 2; /* return error */
-
1177  }
-
1178  if (handle->inited != 1) /* check handle initialization */
-
1179  {
-
1180  return 3; /* return error */
-
1181  }
-
1182 
-
1183  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1184  {
-
1185  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1186 
-
1187  return 1; /* return error */
-
1188  }
-
1189  if ((prev & 0x3) == 3) /* normal mode */
-
1190  {
-
1191  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
-
1192  if (res != 0)
-
1193  {
-
1194  handle->debug_print("bmp280: read failed.\n"); /* read failed */
-
1195 
-
1196  return 1; /* return error */
-
1197  }
-
1198  temperature_raw = ((((uint32_t)(buf[3])) << 12) |
-
1199  (((uint32_t)(buf[4])) << 4) |
-
1200  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
-
1201  res = a_bmp280_compensate_temperature(handle, temperature_raw, &temperature_c); /* compensate temperature */
-
1202  if (res != 0)
-
1203  {
-
1204  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
-
1205 
-
1206  return 4; /* return error */
-
1207  }
-
1208  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
-
1209  (((int32_t)(buf[1])) << 4) |
-
1210  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
-
1211  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
-
1212  if (res != 0)
-
1213  {
-
1214  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
-
1215 
-
1216  return 4; /* return error */
-
1217  }
-
1218  }
-
1219  else /* forced mode */
-
1220  {
-
1221  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1222  {
-
1223  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1224 
-
1225  return 1; /* return error */
-
1226  }
-
1227  prev &= ~(3 << 0); /* clear settings */
-
1228  prev |= 0x01 << 0; /* set forced mode */
-
1229  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
-
1230  {
-
1231  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
-
1232 
-
1233  return 1; /* return error */
-
1234  }
-
1235  timeout = 10 * 1000; /* set timeout */
-
1236  while (timeout != 0) /* check timeout */
-
1237  {
-
1238  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1239  {
-
1240  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1241 
-
1242  return 1; /* return error */
-
1243  }
-
1244  if ((prev & 0x03) == 0) /* if finished */
-
1245  {
-
1246  break; /* break */
-
1247  }
-
1248  handle->delay_ms(1); /* delay 1ms */
-
1249  timeout--; /* timeout-- */
-
1250  }
-
1251  if (timeout == 0) /* check timeout */
-
1252  {
-
1253  handle->debug_print("bmp280: read timeout.\n"); /* read timeout */
-
1254 
-
1255  return 5; /* return error */
-
1256  }
-
1257  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
-
1258  if (res != 0)
-
1259  {
-
1260  handle->debug_print("bmp280: read failed.\n"); /* read failed */
-
1261 
-
1262  return 1; /* return error */
-
1263  }
-
1264  temperature_raw = ((((uint32_t)(buf[3])) << 12) |
-
1265  (((uint32_t)(buf[4])) << 4) |
-
1266  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
-
1267  res = a_bmp280_compensate_temperature(handle, temperature_raw, &temperature_c); /* compensate temperature */
-
1268  if (res != 0)
-
1269  {
-
1270  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
-
1271 
-
1272  return 4; /* return error */
-
1273  }
-
1274  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
-
1275  (((int32_t)(buf[1])) << 4) |
-
1276  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
-
1277  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
-
1278  if (res != 0)
-
1279  {
-
1280  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
-
1281 
-
1282  return 4; /* return error */
-
1283  }
-
1284  }
-
1285 
-
1286  return 0; /* success return 0 */
-
1287 }
-
1288 
-
1303 uint8_t bmp280_read_temperature(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
-
1304 {
-
1305  uint8_t res;
-
1306  uint8_t prev;
-
1307  uint32_t timeout;
-
1308  uint8_t buf[6];
-
1309 
-
1310  if (handle == NULL) /* check handle */
-
1311  {
-
1312  return 2; /* return error */
-
1313  }
-
1314  if (handle->inited != 1) /* check handle initialization */
-
1315  {
-
1316  return 3; /* return error */
-
1317  }
-
1318 
-
1319  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1320  {
-
1321  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1322 
-
1323  return 1; /* return error */
-
1324  }
-
1325  if ((prev & 0x3) == 3) /* normal mode */
-
1326  {
-
1327  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
-
1328  if (res != 0)
-
1329  {
-
1330  handle->debug_print("bmp280: read failed.\n"); /* read failed */
-
1331 
-
1332  return 1; /* return error */
-
1333  }
-
1334  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
-
1335  (((uint32_t)(buf[4])) << 4) |
-
1336  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
-
1337  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
-
1338  if (res != 0)
-
1339  {
-
1340  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
-
1341 
-
1342  return 4; /* return error */
-
1343  }
-
1344  }
-
1345  else /* forced mode */
-
1346  {
-
1347  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1348  {
-
1349  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1350 
-
1351  return 1; /* return error */
-
1352  }
-
1353  prev &= ~(3 << 0); /* clear settings */
-
1354  prev |= 0x01 << 0; /* set forced mode */
-
1355  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
-
1356  {
-
1357  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
-
1358 
-
1359  return 1; /* return error */
-
1360  }
-
1361  timeout = 10 * 1000; /* set timeout */
-
1362  while (timeout != 0) /* check timeout */
-
1363  {
-
1364  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1365  {
-
1366  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1367 
-
1368  return 1; /* return error */
-
1369  }
-
1370  if ((prev & 0x03) == 0) /* if finished */
-
1371  {
-
1372  break; /* break */
-
1373  }
-
1374  handle->delay_ms(1); /* delay 1ms */
-
1375  timeout--; /* timeout-- */
-
1376  }
-
1377  if (timeout == 0) /* check timeout */
-
1378  {
-
1379  handle->debug_print("bmp280: read timeout.\n"); /* read timeout */
-
1380 
-
1381  return 5; /* return error */
-
1382  }
-
1383  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
-
1384  if (res != 0)
-
1385  {
-
1386  handle->debug_print("bmp280: read failed.\n"); /* read failed */
-
1387 
-
1388  return 1; /* return error */
-
1389  }
-
1390  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
-
1391  (((uint32_t)(buf[4])) << 4) |
-
1392  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
-
1393  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
-
1394  if (res != 0)
-
1395  {
-
1396  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
-
1397 
-
1398  return 4; /* return error */
-
1399  }
-
1400  }
-
1401 
-
1402  return 0; /* success return 0 */
-
1403 }
-
1404 
-
1421 uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c,
-
1422  uint32_t *pressure_raw, float *pressure_pa)
-
1423 {
-
1424  uint8_t res;
-
1425  uint8_t prev;
-
1426  uint32_t timeout;
-
1427  uint8_t buf[6];
-
1428 
-
1429  if (handle == NULL) /* check handle */
-
1430  {
-
1431  return 2; /* return error */
-
1432  }
-
1433  if (handle->inited != 1) /* check handle initialization */
-
1434  {
-
1435  return 3; /* return error */
-
1436  }
-
1437 
-
1438  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1439  {
-
1440  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1441 
-
1442  return 1; /* return error */
-
1443  }
-
1444  if ((prev & 0x3) == 3) /* normal mode */
-
1445  {
-
1446  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
-
1447  if (res != 0)
-
1448  {
-
1449  handle->debug_print("bmp280: read failed.\n"); /* read failed */
-
1450 
-
1451  return 1; /* return error */
-
1452  }
-
1453  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
-
1454  (((uint32_t)(buf[4])) << 4) |
-
1455  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
-
1456  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
-
1457  if (res != 0)
-
1458  {
-
1459  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
-
1460 
-
1461  return 4; /* return error */
-
1462  }
-
1463  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
-
1464  (((int32_t)(buf[1])) << 4) |
-
1465  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
-
1466  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
-
1467  if (res != 0)
-
1468  {
-
1469  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
-
1470 
-
1471  return 4; /* return error */
-
1472  }
-
1473  }
-
1474  else /* forced mode */
-
1475  {
-
1476  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1477  {
-
1478  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1479 
-
1480  return 1; /* return error */
-
1481  }
-
1482  prev &= ~(3 << 0); /* clear settings */
-
1483  prev |= 0x01 << 0; /* set forced mode */
-
1484  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
-
1485  {
-
1486  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
-
1487 
-
1488  return 1; /* return error */
-
1489  }
-
1490  timeout = 10 * 1000; /* set timeout */
-
1491  while (timeout != 0) /* check timeout */
-
1492  {
-
1493  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
-
1494  {
-
1495  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
-
1496 
-
1497  return 1; /* return error */
-
1498  }
-
1499  if ((prev & 0x03) == 0) /* if finished */
-
1500  {
-
1501  break; /* break */
-
1502  }
-
1503  handle->delay_ms(1); /* delay 1ms */
-
1504  timeout--; /* timeout-- */
-
1505  }
-
1506  if (timeout == 0) /* check timeout */
-
1507  {
-
1508  handle->debug_print("bmp280: read timeout.\n"); /* read timeout */
-
1509 
-
1510  return 5; /* return error */
-
1511  }
-
1512  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
-
1513  if (res != 0)
-
1514  {
-
1515  handle->debug_print("bmp280: read failed.\n"); /* read failed */
-
1516 
-
1517  return 1; /* return error */
-
1518  }
-
1519  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
-
1520  (((uint32_t)(buf[4])) << 4) |
-
1521  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
-
1522  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
-
1523  if (res != 0)
-
1524  {
-
1525  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
-
1526 
-
1527  return 4; /* return error */
-
1528  }
-
1529  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
-
1530  (((int32_t)(buf[1])) << 4) |
-
1531  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
-
1532  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
-
1533  if (res != 0)
-
1534  {
-
1535  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
-
1536 
-
1537  return 4; /* return error */
-
1538  }
-
1539  }
-
1540 
-
1541  return 0; /* success return 0 */
-
1542 }
-
1543 
-
1556 uint8_t bmp280_set_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t value)
-
1557 {
-
1558  if (handle == NULL) /* check handle */
-
1559  {
-
1560  return 2; /* return error */
-
1561  }
-
1562  if (handle->inited != 1) /* check handle initialization */
-
1563  {
-
1564  return 3; /* return error */
-
1565  }
-
1566 
-
1567  return a_bmp280_iic_spi_write(handle, reg, &value, 1); /* write register */
-
1568 }
-
1569 
-
1582 uint8_t bmp280_get_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
-
1583 {
-
1584  if (handle == NULL) /* check handle */
-
1585  {
-
1586  return 2; /* return error */
-
1587  }
-
1588  if (handle->inited != 1) /* check handle initialization */
-
1589  {
-
1590  return 3; /* return error */
-
1591  }
-
1592 
-
1593  return a_bmp280_iic_spi_read(handle, reg, value, 1); /* read register */
-
1594 }
-
1595 
-
1604 uint8_t bmp280_info(bmp280_info_t *info)
-
1605 {
-
1606  if (info == NULL) /* check handle */
-
1607  {
-
1608  return 2; /* return error */
-
1609  }
-
1610 
-
1611  memset(info, 0, sizeof(bmp280_info_t)); /* initialize bmp280 info structure */
-
1612  strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
-
1613  strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
-
1614  strncpy(info->interface, "IIC SPI", 8); /* copy interface name */
-
1615  info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
-
1616  info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
-
1617  info->max_current_ma = MAX_CURRENT; /* set maximum current */
-
1618  info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
-
1619  info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
-
1620  info->driver_version = DRIVER_VERSION; /* set driver version */
-
1621 
-
1622  return 0; /* success return 0 */
-
1623 }
+
1110  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
+
1111  {
+
1112  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
+
1113 
+
1114  return 1; /* return error */
+
1115  }
+
1116  prev &= ~(1 << 0); /* clear settings */
+
1117  prev |= spi << 0; /* set spi wire */
+
1118  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* write config */
+
1119  {
+
1120  handle->debug_print("bmp280: write config failed.\n"); /* write config failed */
+
1121 
+
1122  return 1; /* return error */
+
1123  }
+
1124 
+
1125  return 0; /* success return 0 */
+
1126 }
+
1127 
+
1139 uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
+
1140 {
+
1141  uint8_t prev;
+
1142 
+
1143  if (handle == NULL) /* check handle */
+
1144  {
+
1145  return 2; /* return error */
+
1146  }
+
1147  if (handle->inited != 1) /* check handle initialization */
+
1148  {
+
1149  return 3; /* return error */
+
1150  }
+
1151 
+
1152  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CONFIG, &prev, 1) != 0) /* read config */
+
1153  {
+
1154  handle->debug_print("bmp280: read config failed.\n"); /* read config failed */
+
1155 
+
1156  return 1; /* return error */
+
1157  }
+
1158  *spi = (bmp280_spi_wire_t)((prev >> 0) & 0x01); /* get spi */
+
1159 
+
1160  return 0; /* success return 0 */
+
1161 }
+
1162 
+
1177 uint8_t bmp280_read_pressure(bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
+
1178 {
+
1179  uint8_t res;
+
1180  uint8_t prev;
+
1181  uint32_t timeout;
+
1182  uint32_t temperature_raw;
+
1183  float temperature_c;
+
1184  uint8_t buf[6];
+
1185 
+
1186  if (handle == NULL) /* check handle */
+
1187  {
+
1188  return 2; /* return error */
+
1189  }
+
1190  if (handle->inited != 1) /* check handle initialization */
+
1191  {
+
1192  return 3; /* return error */
+
1193  }
+
1194 
+
1195  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1196  {
+
1197  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1198 
+
1199  return 1; /* return error */
+
1200  }
+
1201  if ((prev & 0x3) == 3) /* normal mode */
+
1202  {
+
1203  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
+
1204  if (res != 0)
+
1205  {
+
1206  handle->debug_print("bmp280: read failed.\n"); /* read failed */
+
1207 
+
1208  return 1; /* return error */
+
1209  }
+
1210  temperature_raw = ((((uint32_t)(buf[3])) << 12) |
+
1211  (((uint32_t)(buf[4])) << 4) |
+
1212  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
+
1213  res = a_bmp280_compensate_temperature(handle, temperature_raw, &temperature_c); /* compensate temperature */
+
1214  if (res != 0)
+
1215  {
+
1216  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
+
1217 
+
1218  return 4; /* return error */
+
1219  }
+
1220  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
+
1221  (((int32_t)(buf[1])) << 4) |
+
1222  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
+
1223  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
+
1224  if (res != 0)
+
1225  {
+
1226  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
+
1227 
+
1228  return 4; /* return error */
+
1229  }
+
1230  }
+
1231  else /* forced mode */
+
1232  {
+
1233  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1234  {
+
1235  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1236 
+
1237  return 1; /* return error */
+
1238  }
+
1239  prev &= ~(3 << 0); /* clear settings */
+
1240  prev |= 0x01 << 0; /* set forced mode */
+
1241  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
+
1242  {
+
1243  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
1244 
+
1245  return 1; /* return error */
+
1246  }
+
1247  timeout = 10 * 1000; /* set timeout */
+
1248  while (timeout != 0) /* check timeout */
+
1249  {
+
1250  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1251  {
+
1252  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1253 
+
1254  return 1; /* return error */
+
1255  }
+
1256  if ((prev & 0x03) == 0) /* if finished */
+
1257  {
+
1258  break; /* break */
+
1259  }
+
1260  handle->delay_ms(1); /* delay 1ms */
+
1261  timeout--; /* timeout-- */
+
1262  }
+
1263  if (timeout == 0) /* check timeout */
+
1264  {
+
1265  handle->debug_print("bmp280: read timeout.\n"); /* read timeout */
+
1266 
+
1267  return 5; /* return error */
+
1268  }
+
1269  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
+
1270  if (res != 0)
+
1271  {
+
1272  handle->debug_print("bmp280: read failed.\n"); /* read failed */
+
1273 
+
1274  return 1; /* return error */
+
1275  }
+
1276  temperature_raw = ((((uint32_t)(buf[3])) << 12) |
+
1277  (((uint32_t)(buf[4])) << 4) |
+
1278  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
+
1279  res = a_bmp280_compensate_temperature(handle, temperature_raw, &temperature_c); /* compensate temperature */
+
1280  if (res != 0)
+
1281  {
+
1282  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
+
1283 
+
1284  return 4; /* return error */
+
1285  }
+
1286  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
+
1287  (((int32_t)(buf[1])) << 4) |
+
1288  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
+
1289  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
+
1290  if (res != 0)
+
1291  {
+
1292  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
+
1293 
+
1294  return 4; /* return error */
+
1295  }
+
1296  }
+
1297 
+
1298  return 0; /* success return 0 */
+
1299 }
+
1300 
+
1315 uint8_t bmp280_read_temperature(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
+
1316 {
+
1317  uint8_t res;
+
1318  uint8_t prev;
+
1319  uint32_t timeout;
+
1320  uint8_t buf[6];
+
1321 
+
1322  if (handle == NULL) /* check handle */
+
1323  {
+
1324  return 2; /* return error */
+
1325  }
+
1326  if (handle->inited != 1) /* check handle initialization */
+
1327  {
+
1328  return 3; /* return error */
+
1329  }
+
1330 
+
1331  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1332  {
+
1333  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1334 
+
1335  return 1; /* return error */
+
1336  }
+
1337  if ((prev & 0x3) == 3) /* normal mode */
+
1338  {
+
1339  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
+
1340  if (res != 0)
+
1341  {
+
1342  handle->debug_print("bmp280: read failed.\n"); /* read failed */
+
1343 
+
1344  return 1; /* return error */
+
1345  }
+
1346  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
+
1347  (((uint32_t)(buf[4])) << 4) |
+
1348  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
+
1349  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
+
1350  if (res != 0)
+
1351  {
+
1352  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
+
1353 
+
1354  return 4; /* return error */
+
1355  }
+
1356  }
+
1357  else /* forced mode */
+
1358  {
+
1359  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1360  {
+
1361  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1362 
+
1363  return 1; /* return error */
+
1364  }
+
1365  prev &= ~(3 << 0); /* clear settings */
+
1366  prev |= 0x01 << 0; /* set forced mode */
+
1367  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
+
1368  {
+
1369  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
1370 
+
1371  return 1; /* return error */
+
1372  }
+
1373  timeout = 10 * 1000; /* set timeout */
+
1374  while (timeout != 0) /* check timeout */
+
1375  {
+
1376  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1377  {
+
1378  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1379 
+
1380  return 1; /* return error */
+
1381  }
+
1382  if ((prev & 0x03) == 0) /* if finished */
+
1383  {
+
1384  break; /* break */
+
1385  }
+
1386  handle->delay_ms(1); /* delay 1ms */
+
1387  timeout--; /* timeout-- */
+
1388  }
+
1389  if (timeout == 0) /* check timeout */
+
1390  {
+
1391  handle->debug_print("bmp280: read timeout.\n"); /* read timeout */
+
1392 
+
1393  return 5; /* return error */
+
1394  }
+
1395  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
+
1396  if (res != 0)
+
1397  {
+
1398  handle->debug_print("bmp280: read failed.\n"); /* read failed */
+
1399 
+
1400  return 1; /* return error */
+
1401  }
+
1402  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
+
1403  (((uint32_t)(buf[4])) << 4) |
+
1404  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
+
1405  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
+
1406  if (res != 0)
+
1407  {
+
1408  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
+
1409 
+
1410  return 4; /* return error */
+
1411  }
+
1412  }
+
1413 
+
1414  return 0; /* success return 0 */
+
1415 }
+
1416 
+
1433 uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c,
+
1434  uint32_t *pressure_raw, float *pressure_pa)
+
1435 {
+
1436  uint8_t res;
+
1437  uint8_t prev;
+
1438  uint32_t timeout;
+
1439  uint8_t buf[6];
+
1440 
+
1441  if (handle == NULL) /* check handle */
+
1442  {
+
1443  return 2; /* return error */
+
1444  }
+
1445  if (handle->inited != 1) /* check handle initialization */
+
1446  {
+
1447  return 3; /* return error */
+
1448  }
+
1449 
+
1450  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1451  {
+
1452  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1453 
+
1454  return 1; /* return error */
+
1455  }
+
1456  if ((prev & 0x3) == 3) /* normal mode */
+
1457  {
+
1458  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
+
1459  if (res != 0)
+
1460  {
+
1461  handle->debug_print("bmp280: read failed.\n"); /* read failed */
+
1462 
+
1463  return 1; /* return error */
+
1464  }
+
1465  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
+
1466  (((uint32_t)(buf[4])) << 4) |
+
1467  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
+
1468  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
+
1469  if (res != 0)
+
1470  {
+
1471  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
+
1472 
+
1473  return 4; /* return error */
+
1474  }
+
1475  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
+
1476  (((int32_t)(buf[1])) << 4) |
+
1477  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
+
1478  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
+
1479  if (res != 0)
+
1480  {
+
1481  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
+
1482 
+
1483  return 4; /* return error */
+
1484  }
+
1485  }
+
1486  else /* forced mode */
+
1487  {
+
1488  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1489  {
+
1490  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1491 
+
1492  return 1; /* return error */
+
1493  }
+
1494  prev &= ~(3 << 0); /* clear settings */
+
1495  prev |= 0x01 << 0; /* set forced mode */
+
1496  if (a_bmp280_iic_spi_write(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* write ctrl meas */
+
1497  {
+
1498  handle->debug_print("bmp280: write ctrl meas failed.\n"); /* write ctrl meas failed */
+
1499 
+
1500  return 1; /* return error */
+
1501  }
+
1502  timeout = 10 * 1000; /* set timeout */
+
1503  while (timeout != 0) /* check timeout */
+
1504  {
+
1505  if (a_bmp280_iic_spi_read(handle, BMP280_REG_CTRL_MEAS, &prev, 1) != 0) /* read ctrl meas */
+
1506  {
+
1507  handle->debug_print("bmp280: read ctrl meas failed.\n"); /* read ctrl meas failed */
+
1508 
+
1509  return 1; /* return error */
+
1510  }
+
1511  if ((prev & 0x03) == 0) /* if finished */
+
1512  {
+
1513  break; /* break */
+
1514  }
+
1515  handle->delay_ms(1); /* delay 1ms */
+
1516  timeout--; /* timeout-- */
+
1517  }
+
1518  if (timeout == 0) /* check timeout */
+
1519  {
+
1520  handle->debug_print("bmp280: read timeout.\n"); /* read timeout */
+
1521 
+
1522  return 5; /* return error */
+
1523  }
+
1524  res = a_bmp280_iic_spi_read(handle, BMP280_REG_PRESS_MSB, buf, 6); /* read temperature and pressure */
+
1525  if (res != 0)
+
1526  {
+
1527  handle->debug_print("bmp280: read failed.\n"); /* read failed */
+
1528 
+
1529  return 1; /* return error */
+
1530  }
+
1531  *temperature_raw = ((((uint32_t)(buf[3])) << 12) |
+
1532  (((uint32_t)(buf[4])) << 4) |
+
1533  ((uint32_t)buf[5] >> 4)); /* set temperature raw */
+
1534  res = a_bmp280_compensate_temperature(handle, *temperature_raw, temperature_c); /* compensate temperature */
+
1535  if (res != 0)
+
1536  {
+
1537  handle->debug_print("bmp280: compensate temperature failed.\n"); /* compensate temperature failed */
+
1538 
+
1539  return 4; /* return error */
+
1540  }
+
1541  *pressure_raw = ((((int32_t)(buf[0])) << 12) |
+
1542  (((int32_t)(buf[1])) << 4) |
+
1543  (((int32_t)(buf[2])) >> 4)); /* set pressure raw */
+
1544  res = a_bmp280_compensate_pressure(handle, *pressure_raw, pressure_pa); /* compensate pressure */
+
1545  if (res != 0)
+
1546  {
+
1547  handle->debug_print("bmp280: compensate pressure failed.\n"); /* compensate pressure failed */
+
1548 
+
1549  return 4; /* return error */
+
1550  }
+
1551  }
+
1552 
+
1553  return 0; /* success return 0 */
+
1554 }
+
1555 
+
1568 uint8_t bmp280_set_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t value)
+
1569 {
+
1570  if (handle == NULL) /* check handle */
+
1571  {
+
1572  return 2; /* return error */
+
1573  }
+
1574  if (handle->inited != 1) /* check handle initialization */
+
1575  {
+
1576  return 3; /* return error */
+
1577  }
+
1578 
+
1579  return a_bmp280_iic_spi_write(handle, reg, &value, 1); /* write register */
+
1580 }
+
1581 
+
1594 uint8_t bmp280_get_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
+
1595 {
+
1596  if (handle == NULL) /* check handle */
+
1597  {
+
1598  return 2; /* return error */
+
1599  }
+
1600  if (handle->inited != 1) /* check handle initialization */
+
1601  {
+
1602  return 3; /* return error */
+
1603  }
+
1604 
+
1605  return a_bmp280_iic_spi_read(handle, reg, value, 1); /* read register */
+
1606 }
+
1607 
+
1616 uint8_t bmp280_info(bmp280_info_t *info)
+
1617 {
+
1618  if (info == NULL) /* check handle */
+
1619  {
+
1620  return 2; /* return error */
+
1621  }
+
1622 
+
1623  memset(info, 0, sizeof(bmp280_info_t)); /* initialize bmp280 info structure */
+
1624  strncpy(info->chip_name, CHIP_NAME, 32); /* copy chip name */
+
1625  strncpy(info->manufacturer_name, MANUFACTURER_NAME, 32); /* copy manufacturer name */
+
1626  strncpy(info->interface, "IIC SPI", 8); /* copy interface name */
+
1627  info->supply_voltage_min_v = SUPPLY_VOLTAGE_MIN; /* set minimal supply voltage */
+
1628  info->supply_voltage_max_v = SUPPLY_VOLTAGE_MAX; /* set maximum supply voltage */
+
1629  info->max_current_ma = MAX_CURRENT; /* set maximum current */
+
1630  info->temperature_max = TEMPERATURE_MAX; /* set minimal temperature */
+
1631  info->temperature_min = TEMPERATURE_MIN; /* set maximum temperature */
+
1632  info->driver_version = DRIVER_VERSION; /* set driver version */
+
1633 
+
1634  return 0; /* success return 0 */
+
1635 }
BMP280_REG_NVM_PAR_P2_L
#define BMP280_REG_NVM_PAR_P2_L
Definition: driver_bmp280.c:62
BMP280_REG_NVM_PAR_P6_L
#define BMP280_REG_NVM_PAR_P6_L
Definition: driver_bmp280.c:70
BMP280_REG_NVM_PAR_P3_L
#define BMP280_REG_NVM_PAR_P3_L
Definition: driver_bmp280.c:64
@@ -1356,40 +1368,40 @@
BMP280_REG_NVM_PAR_T1_L
#define BMP280_REG_NVM_PAR_T1_L
chip register definition
Definition: driver_bmp280.c:54
BMP280_REG_PRESS_MSB
#define BMP280_REG_PRESS_MSB
Definition: driver_bmp280.c:83
driver_bmp280.h
driver bmp280 header file
-
bmp280_soft_reset
uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
soft reset
Definition: driver_bmp280.c:632
-
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1008
-
bmp280_get_pressure_oversampling
uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get pressure oversampling
Definition: driver_bmp280.c:819
+
bmp280_soft_reset
uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
soft reset
Definition: driver_bmp280.c:644
+
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1020
+
bmp280_get_pressure_oversampling
uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get pressure oversampling
Definition: driver_bmp280.c:831
bmp280_spi_wire_t
bmp280_spi_wire_t
bmp280 spi wire enumeration definition
Definition: driver_bmp280.h:140
-
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1604
-
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:854
-
bmp280_get_mode
uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
get mode
Definition: driver_bmp280.c:896
-
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1421
+
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1616
+
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:866
+
bmp280_get_mode
uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
get mode
Definition: driver_bmp280.c:908
+
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1433
bmp280_filter_t
bmp280_filter_t
bmp280 filter enumeration definition
Definition: driver_bmp280.h:128
-
bmp280_get_temperatue_oversampling
uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get temperatue oversampling
Definition: driver_bmp280.c:742
+
bmp280_get_temperatue_oversampling
uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get temperatue oversampling
Definition: driver_bmp280.c:754
bmp280_deinit
uint8_t bmp280_deinit(bmp280_handle_t *handle)
close the chip
Definition: driver_bmp280.c:584
bmp280_mode_t
bmp280_mode_t
bmp280 mode enumeration definition
Definition: driver_bmp280.h:103
-
bmp280_get_filter
uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
get filter
Definition: driver_bmp280.c:1050
+
bmp280_get_filter
uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
get filter
Definition: driver_bmp280.c:1062
bmp280_get_addr_pin
uint8_t bmp280_get_addr_pin(bmp280_handle_t *handle, bmp280_address_t *addr_pin)
get the iic address pin
Definition: driver_bmp280.c:385
bmp280_interface_t
bmp280_interface_t
bmp280 interface enumeration definition
Definition: driver_bmp280.h:63
bmp280_set_interface
uint8_t bmp280_set_interface(bmp280_handle_t *handle, bmp280_interface_t interface)
set the interface
Definition: driver_bmp280.c:406
-
bmp280_get_standby_time
uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
get standby time
Definition: driver_bmp280.c:973
-
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1085
-
bmp280_read_pressure
uint8_t bmp280_read_pressure(bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
read the pressure data
Definition: driver_bmp280.c:1165
-
bmp280_get_spi_wire
uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
get spi wire
Definition: driver_bmp280.c:1127
-
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:777
+
bmp280_get_standby_time
uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
get standby time
Definition: driver_bmp280.c:985
+
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1097
+
bmp280_read_pressure
uint8_t bmp280_read_pressure(bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
read the pressure data
Definition: driver_bmp280.c:1177
+
bmp280_get_spi_wire
uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
get spi wire
Definition: driver_bmp280.c:1139
+
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:789
bmp280_set_addr_pin
uint8_t bmp280_set_addr_pin(bmp280_handle_t *handle, bmp280_address_t addr_pin)
set the iic address pin
Definition: driver_bmp280.c:364
bmp280_address_t
bmp280_address_t
bmp280 address enumeration definition
Definition: driver_bmp280.h:72
bmp280_get_interface
uint8_t bmp280_get_interface(bmp280_handle_t *handle, bmp280_interface_t *interface)
get the interface
Definition: driver_bmp280.c:427
-
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:931
+
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:943
bmp280_oversampling_t
bmp280_oversampling_t
bmp280 oversampling enumeration definition
Definition: driver_bmp280.h:90
-
bmp280_get_status
uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
get status
Definition: driver_bmp280.c:668
+
bmp280_get_status
uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
get status
Definition: driver_bmp280.c:680
bmp280_init
uint8_t bmp280_init(bmp280_handle_t *handle)
initialize the chip
Definition: driver_bmp280.c:452
-
bmp280_read_temperature
uint8_t bmp280_read_temperature(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
read the temperature data
Definition: driver_bmp280.c:1303
+
bmp280_read_temperature
uint8_t bmp280_read_temperature(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
read the temperature data
Definition: driver_bmp280.c:1315
bmp280_standby_time_t
bmp280_standby_time_t
bmp280 standby time enumeration definition
Definition: driver_bmp280.h:113
-
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:700
+
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:712
BMP280_INTERFACE_IIC
@ BMP280_INTERFACE_IIC
Definition: driver_bmp280.h:64
-
bmp280_set_reg
uint8_t bmp280_set_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t value)
set the chip register
Definition: driver_bmp280.c:1556
-
bmp280_get_reg
uint8_t bmp280_get_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
get the chip register
Definition: driver_bmp280.c:1582
+
bmp280_set_reg
uint8_t bmp280_set_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t value)
set the chip register
Definition: driver_bmp280.c:1568
+
bmp280_get_reg
uint8_t bmp280_get_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
get the chip register
Definition: driver_bmp280.c:1594
bmp280_handle_s
bmp280 handle structure definition
Definition: driver_bmp280.h:149
bmp280_handle_s::iic_spi
uint8_t iic_spi
Definition: driver_bmp280.h:162
bmp280_handle_s::inited
uint8_t inited
Definition: driver_bmp280.h:161
diff --git a/doc/html/driver__bmp280_8h_source.html b/doc/html/driver__bmp280_8h_source.html index b39f1a2..64d7135 100644 --- a/doc/html/driver__bmp280_8h_source.html +++ b/doc/html/driver__bmp280_8h_source.html @@ -285,40 +285,40 @@
667 #endif
668 
669 #endif
-
bmp280_soft_reset
uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
soft reset
Definition: driver_bmp280.c:632
-
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1008
-
bmp280_get_pressure_oversampling
uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get pressure oversampling
Definition: driver_bmp280.c:819
+
bmp280_soft_reset
uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
soft reset
Definition: driver_bmp280.c:644
+
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1020
+
bmp280_get_pressure_oversampling
uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get pressure oversampling
Definition: driver_bmp280.c:831
bmp280_spi_wire_t
bmp280_spi_wire_t
bmp280 spi wire enumeration definition
Definition: driver_bmp280.h:140
-
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1604
-
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:854
-
bmp280_get_mode
uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
get mode
Definition: driver_bmp280.c:896
-
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1421
+
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1616
+
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:866
+
bmp280_get_mode
uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
get mode
Definition: driver_bmp280.c:908
+
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1433
bmp280_filter_t
bmp280_filter_t
bmp280 filter enumeration definition
Definition: driver_bmp280.h:128
-
bmp280_get_temperatue_oversampling
uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get temperatue oversampling
Definition: driver_bmp280.c:742
+
bmp280_get_temperatue_oversampling
uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get temperatue oversampling
Definition: driver_bmp280.c:754
bmp280_deinit
uint8_t bmp280_deinit(bmp280_handle_t *handle)
close the chip
Definition: driver_bmp280.c:584
bmp280_mode_t
bmp280_mode_t
bmp280 mode enumeration definition
Definition: driver_bmp280.h:103
-
bmp280_get_filter
uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
get filter
Definition: driver_bmp280.c:1050
+
bmp280_get_filter
uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
get filter
Definition: driver_bmp280.c:1062
bmp280_get_addr_pin
uint8_t bmp280_get_addr_pin(bmp280_handle_t *handle, bmp280_address_t *addr_pin)
get the iic address pin
Definition: driver_bmp280.c:385
bmp280_interface_t
bmp280_interface_t
bmp280 interface enumeration definition
Definition: driver_bmp280.h:63
bmp280_status_t
bmp280_status_t
bmp280 status enumeration definition
Definition: driver_bmp280.h:81
bmp280_set_interface
uint8_t bmp280_set_interface(bmp280_handle_t *handle, bmp280_interface_t interface)
set the interface
Definition: driver_bmp280.c:406
-
bmp280_get_standby_time
uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
get standby time
Definition: driver_bmp280.c:973
-
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1085
-
bmp280_read_pressure
uint8_t bmp280_read_pressure(bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
read the pressure data
Definition: driver_bmp280.c:1165
-
bmp280_get_spi_wire
uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
get spi wire
Definition: driver_bmp280.c:1127
-
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:777
+
bmp280_get_standby_time
uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
get standby time
Definition: driver_bmp280.c:985
+
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1097
+
bmp280_read_pressure
uint8_t bmp280_read_pressure(bmp280_handle_t *handle, uint32_t *pressure_raw, float *pressure_pa)
read the pressure data
Definition: driver_bmp280.c:1177
+
bmp280_get_spi_wire
uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
get spi wire
Definition: driver_bmp280.c:1139
+
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:789
bmp280_set_addr_pin
uint8_t bmp280_set_addr_pin(bmp280_handle_t *handle, bmp280_address_t addr_pin)
set the iic address pin
Definition: driver_bmp280.c:364
bmp280_address_t
bmp280_address_t
bmp280 address enumeration definition
Definition: driver_bmp280.h:72
bmp280_info_t
struct bmp280_info_s bmp280_info_t
bmp280 information structure definition
bmp280_get_interface
uint8_t bmp280_get_interface(bmp280_handle_t *handle, bmp280_interface_t *interface)
get the interface
Definition: driver_bmp280.c:427
-
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:931
+
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:943
bmp280_oversampling_t
bmp280_oversampling_t
bmp280 oversampling enumeration definition
Definition: driver_bmp280.h:90
-
bmp280_get_status
uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
get status
Definition: driver_bmp280.c:668
+
bmp280_get_status
uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
get status
Definition: driver_bmp280.c:680
bmp280_init
uint8_t bmp280_init(bmp280_handle_t *handle)
initialize the chip
Definition: driver_bmp280.c:452
bmp280_handle_t
struct bmp280_handle_s bmp280_handle_t
bmp280 handle structure definition
-
bmp280_read_temperature
uint8_t bmp280_read_temperature(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
read the temperature data
Definition: driver_bmp280.c:1303
+
bmp280_read_temperature
uint8_t bmp280_read_temperature(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c)
read the temperature data
Definition: driver_bmp280.c:1315
bmp280_standby_time_t
bmp280_standby_time_t
bmp280 standby time enumeration definition
Definition: driver_bmp280.h:113
-
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:700
+
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:712
BMP280_SPI_WIRE_4
@ BMP280_SPI_WIRE_4
Definition: driver_bmp280.h:141
BMP280_SPI_WIRE_3
@ BMP280_SPI_WIRE_3
Definition: driver_bmp280.h:142
BMP280_FILTER_OFF
@ BMP280_FILTER_OFF
Definition: driver_bmp280.h:129
@@ -349,8 +349,8 @@
BMP280_STANDBY_TIME_500_MS
@ BMP280_STANDBY_TIME_500_MS
Definition: driver_bmp280.h:118
BMP280_STANDBY_TIME_125_MS
@ BMP280_STANDBY_TIME_125_MS
Definition: driver_bmp280.h:116
BMP280_STANDBY_TIME_250_MS
@ BMP280_STANDBY_TIME_250_MS
Definition: driver_bmp280.h:117
-
bmp280_set_reg
uint8_t bmp280_set_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t value)
set the chip register
Definition: driver_bmp280.c:1556
-
bmp280_get_reg
uint8_t bmp280_get_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
get the chip register
Definition: driver_bmp280.c:1582
+
bmp280_set_reg
uint8_t bmp280_set_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t value)
set the chip register
Definition: driver_bmp280.c:1568
+
bmp280_get_reg
uint8_t bmp280_get_reg(bmp280_handle_t *handle, uint8_t reg, uint8_t *value)
get the chip register
Definition: driver_bmp280.c:1594
bmp280_handle_s
bmp280 handle structure definition
Definition: driver_bmp280.h:149
bmp280_handle_s::iic_spi
uint8_t iic_spi
Definition: driver_bmp280.h:162
bmp280_handle_s::inited
uint8_t inited
Definition: driver_bmp280.h:161
diff --git a/doc/html/driver__bmp280__basic_8c_source.html b/doc/html/driver__bmp280__basic_8c_source.html index 397f160..7348c61 100644 --- a/doc/html/driver__bmp280__basic_8c_source.html +++ b/doc/html/driver__bmp280__basic_8c_source.html @@ -225,19 +225,19 @@
196  return 0;
197 }
driver_bmp280_basic.h
driver bmp280 basic header file
-
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1008
-
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:854
-
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1421
+
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1020
+
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:866
+
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1433
bmp280_deinit
uint8_t bmp280_deinit(bmp280_handle_t *handle)
close the chip
Definition: driver_bmp280.c:584
bmp280_interface_t
bmp280_interface_t
bmp280 interface enumeration definition
Definition: driver_bmp280.h:63
bmp280_set_interface
uint8_t bmp280_set_interface(bmp280_handle_t *handle, bmp280_interface_t interface)
set the interface
Definition: driver_bmp280.c:406
-
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1085
-
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:777
+
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1097
+
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:789
bmp280_set_addr_pin
uint8_t bmp280_set_addr_pin(bmp280_handle_t *handle, bmp280_address_t addr_pin)
set the iic address pin
Definition: driver_bmp280.c:364
bmp280_address_t
bmp280_address_t
bmp280 address enumeration definition
Definition: driver_bmp280.h:72
-
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:931
+
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:943
bmp280_init
uint8_t bmp280_init(bmp280_handle_t *handle)
initialize the chip
Definition: driver_bmp280.c:452
-
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:700
+
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:712
BMP280_MODE_NORMAL
@ BMP280_MODE_NORMAL
Definition: driver_bmp280.h:106
BMP280_BASIC_DEFAULT_STANDBY_TIME
#define BMP280_BASIC_DEFAULT_STANDBY_TIME
Definition: driver_bmp280_basic.h:58
BMP280_BASIC_DEFAULT_FILTER
#define BMP280_BASIC_DEFAULT_FILTER
Definition: driver_bmp280_basic.h:59
diff --git a/doc/html/driver__bmp280__read__test_8c_source.html b/doc/html/driver__bmp280__read__test_8c_source.html index 44a59d0..0fed37c 100644 --- a/doc/html/driver__bmp280__read__test_8c_source.html +++ b/doc/html/driver__bmp280__read__test_8c_source.html @@ -290,19 +290,19 @@
246  return 0;
247 }
driver_bmp280_read_test.h
driver bmp280 read test header file
-
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1008
-
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1604
-
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:854
-
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1421
+
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1020
+
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1616
+
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:866
+
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1433
bmp280_deinit
uint8_t bmp280_deinit(bmp280_handle_t *handle)
close the chip
Definition: driver_bmp280.c:584
bmp280_interface_t
bmp280_interface_t
bmp280 interface enumeration definition
Definition: driver_bmp280.h:63
bmp280_set_interface
uint8_t bmp280_set_interface(bmp280_handle_t *handle, bmp280_interface_t interface)
set the interface
Definition: driver_bmp280.c:406
-
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:777
+
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:789
bmp280_set_addr_pin
uint8_t bmp280_set_addr_pin(bmp280_handle_t *handle, bmp280_address_t addr_pin)
set the iic address pin
Definition: driver_bmp280.c:364
bmp280_address_t
bmp280_address_t
bmp280 address enumeration definition
Definition: driver_bmp280.h:72
-
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:931
+
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:943
bmp280_init
uint8_t bmp280_init(bmp280_handle_t *handle)
initialize the chip
Definition: driver_bmp280.c:452
-
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:700
+
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:712
BMP280_FILTER_COEFF_16
@ BMP280_FILTER_COEFF_16
Definition: driver_bmp280.h:133
BMP280_MODE_SLEEP
@ BMP280_MODE_SLEEP
Definition: driver_bmp280.h:104
BMP280_MODE_NORMAL
@ BMP280_MODE_NORMAL
Definition: driver_bmp280.h:106
diff --git a/doc/html/driver__bmp280__register__test_8c_source.html b/doc/html/driver__bmp280__register__test_8c_source.html index 818efeb..075c3ab 100644 --- a/doc/html/driver__bmp280__register__test_8c_source.html +++ b/doc/html/driver__bmp280__register__test_8c_source.html @@ -1015,34 +1015,34 @@
970  return 0;
971 }
driver_bmp280_register_test.h
driver bmp280 register test header file
-
bmp280_soft_reset
uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
soft reset
Definition: driver_bmp280.c:632
-
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1008
-
bmp280_get_pressure_oversampling
uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get pressure oversampling
Definition: driver_bmp280.c:819
+
bmp280_soft_reset
uint8_t bmp280_soft_reset(bmp280_handle_t *handle)
soft reset
Definition: driver_bmp280.c:644
+
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1020
+
bmp280_get_pressure_oversampling
uint8_t bmp280_get_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get pressure oversampling
Definition: driver_bmp280.c:831
bmp280_spi_wire_t
bmp280_spi_wire_t
bmp280 spi wire enumeration definition
Definition: driver_bmp280.h:140
-
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1604
-
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:854
-
bmp280_get_mode
uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
get mode
Definition: driver_bmp280.c:896
+
bmp280_info
uint8_t bmp280_info(bmp280_info_t *info)
get chip's information
Definition: driver_bmp280.c:1616
+
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:866
+
bmp280_get_mode
uint8_t bmp280_get_mode(bmp280_handle_t *handle, bmp280_mode_t *mode)
get mode
Definition: driver_bmp280.c:908
bmp280_filter_t
bmp280_filter_t
bmp280 filter enumeration definition
Definition: driver_bmp280.h:128
-
bmp280_get_temperatue_oversampling
uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get temperatue oversampling
Definition: driver_bmp280.c:742
+
bmp280_get_temperatue_oversampling
uint8_t bmp280_get_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t *oversampling)
get temperatue oversampling
Definition: driver_bmp280.c:754
bmp280_deinit
uint8_t bmp280_deinit(bmp280_handle_t *handle)
close the chip
Definition: driver_bmp280.c:584
bmp280_mode_t
bmp280_mode_t
bmp280 mode enumeration definition
Definition: driver_bmp280.h:103
-
bmp280_get_filter
uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
get filter
Definition: driver_bmp280.c:1050
+
bmp280_get_filter
uint8_t bmp280_get_filter(bmp280_handle_t *handle, bmp280_filter_t *filter)
get filter
Definition: driver_bmp280.c:1062
bmp280_get_addr_pin
uint8_t bmp280_get_addr_pin(bmp280_handle_t *handle, bmp280_address_t *addr_pin)
get the iic address pin
Definition: driver_bmp280.c:385
bmp280_interface_t
bmp280_interface_t
bmp280 interface enumeration definition
Definition: driver_bmp280.h:63
bmp280_set_interface
uint8_t bmp280_set_interface(bmp280_handle_t *handle, bmp280_interface_t interface)
set the interface
Definition: driver_bmp280.c:406
-
bmp280_get_standby_time
uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
get standby time
Definition: driver_bmp280.c:973
-
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1085
-
bmp280_get_spi_wire
uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
get spi wire
Definition: driver_bmp280.c:1127
-
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:777
+
bmp280_get_standby_time
uint8_t bmp280_get_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t *standby_time)
get standby time
Definition: driver_bmp280.c:985
+
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1097
+
bmp280_get_spi_wire
uint8_t bmp280_get_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t *spi)
get spi wire
Definition: driver_bmp280.c:1139
+
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:789
bmp280_set_addr_pin
uint8_t bmp280_set_addr_pin(bmp280_handle_t *handle, bmp280_address_t addr_pin)
set the iic address pin
Definition: driver_bmp280.c:364
bmp280_address_t
bmp280_address_t
bmp280 address enumeration definition
Definition: driver_bmp280.h:72
bmp280_get_interface
uint8_t bmp280_get_interface(bmp280_handle_t *handle, bmp280_interface_t *interface)
get the interface
Definition: driver_bmp280.c:427
-
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:931
+
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:943
bmp280_oversampling_t
bmp280_oversampling_t
bmp280 oversampling enumeration definition
Definition: driver_bmp280.h:90
-
bmp280_get_status
uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
get status
Definition: driver_bmp280.c:668
+
bmp280_get_status
uint8_t bmp280_get_status(bmp280_handle_t *handle, uint8_t *status)
get status
Definition: driver_bmp280.c:680
bmp280_init
uint8_t bmp280_init(bmp280_handle_t *handle)
initialize the chip
Definition: driver_bmp280.c:452
bmp280_standby_time_t
bmp280_standby_time_t
bmp280 standby time enumeration definition
Definition: driver_bmp280.h:113
-
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:700
+
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:712
BMP280_SPI_WIRE_4
@ BMP280_SPI_WIRE_4
Definition: driver_bmp280.h:141
BMP280_SPI_WIRE_3
@ BMP280_SPI_WIRE_3
Definition: driver_bmp280.h:142
BMP280_FILTER_OFF
@ BMP280_FILTER_OFF
Definition: driver_bmp280.h:129
diff --git a/doc/html/driver__bmp280__shot_8c_source.html b/doc/html/driver__bmp280__shot_8c_source.html index 61e222e..8f9ba30 100644 --- a/doc/html/driver__bmp280__shot_8c_source.html +++ b/doc/html/driver__bmp280__shot_8c_source.html @@ -225,19 +225,19 @@
196  return 0;
197 }
driver_bmp280_shot.h
driver bmp280 shot header file
-
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1008
-
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:854
-
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1421
+
bmp280_set_filter
uint8_t bmp280_set_filter(bmp280_handle_t *handle, bmp280_filter_t filter)
set filter
Definition: driver_bmp280.c:1020
+
bmp280_set_mode
uint8_t bmp280_set_mode(bmp280_handle_t *handle, bmp280_mode_t mode)
set mode
Definition: driver_bmp280.c:866
+
bmp280_read_temperature_pressure
uint8_t bmp280_read_temperature_pressure(bmp280_handle_t *handle, uint32_t *temperature_raw, float *temperature_c, uint32_t *pressure_raw, float *pressure_pa)
read the temperature and pressure data
Definition: driver_bmp280.c:1433
bmp280_deinit
uint8_t bmp280_deinit(bmp280_handle_t *handle)
close the chip
Definition: driver_bmp280.c:584
bmp280_interface_t
bmp280_interface_t
bmp280 interface enumeration definition
Definition: driver_bmp280.h:63
bmp280_set_interface
uint8_t bmp280_set_interface(bmp280_handle_t *handle, bmp280_interface_t interface)
set the interface
Definition: driver_bmp280.c:406
-
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1085
-
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:777
+
bmp280_set_spi_wire
uint8_t bmp280_set_spi_wire(bmp280_handle_t *handle, bmp280_spi_wire_t spi)
set spi wire
Definition: driver_bmp280.c:1097
+
bmp280_set_pressure_oversampling
uint8_t bmp280_set_pressure_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set pressure oversampling
Definition: driver_bmp280.c:789
bmp280_set_addr_pin
uint8_t bmp280_set_addr_pin(bmp280_handle_t *handle, bmp280_address_t addr_pin)
set the iic address pin
Definition: driver_bmp280.c:364
bmp280_address_t
bmp280_address_t
bmp280 address enumeration definition
Definition: driver_bmp280.h:72
-
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:931
+
bmp280_set_standby_time
uint8_t bmp280_set_standby_time(bmp280_handle_t *handle, bmp280_standby_time_t standby_time)
set standby time
Definition: driver_bmp280.c:943
bmp280_init
uint8_t bmp280_init(bmp280_handle_t *handle)
initialize the chip
Definition: driver_bmp280.c:452
-
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:700
+
bmp280_set_temperatue_oversampling
uint8_t bmp280_set_temperatue_oversampling(bmp280_handle_t *handle, bmp280_oversampling_t oversampling)
set temperatue oversampling
Definition: driver_bmp280.c:712
BMP280_MODE_SLEEP
@ BMP280_MODE_SLEEP
Definition: driver_bmp280.h:104
BMP280_SHOT_DEFAULT_FILTER
#define BMP280_SHOT_DEFAULT_FILTER
Definition: driver_bmp280_shot.h:57
BMP280_SHOT_DEFAULT_STANDBY_TIME
#define BMP280_SHOT_DEFAULT_STANDBY_TIME
Definition: driver_bmp280_shot.h:56
diff --git a/doc/html/group__bmp280__base__driver.html b/doc/html/group__bmp280__base__driver.html index db7378f..e88a9b1 100644 --- a/doc/html/group__bmp280__base__driver.html +++ b/doc/html/group__bmp280__base__driver.html @@ -638,7 +638,7 @@

Note
none
-

Definition at line 1050 of file driver_bmp280.c.

+

Definition at line 1062 of file driver_bmp280.c.

@@ -730,7 +730,7 @@

Note
none
-

Definition at line 896 of file driver_bmp280.c.

+

Definition at line 908 of file driver_bmp280.c.

@@ -777,7 +777,7 @@

Note
none
-

Definition at line 819 of file driver_bmp280.c.

+

Definition at line 831 of file driver_bmp280.c.

@@ -824,7 +824,7 @@

Note
none
-

Definition at line 1127 of file driver_bmp280.c.

+

Definition at line 1139 of file driver_bmp280.c.

@@ -871,7 +871,7 @@

Note
none
-

Definition at line 973 of file driver_bmp280.c.

+

Definition at line 985 of file driver_bmp280.c.

@@ -918,7 +918,7 @@

Note
none
-

Definition at line 668 of file driver_bmp280.c.

+

Definition at line 680 of file driver_bmp280.c.

@@ -965,7 +965,7 @@

Note
none
-

Definition at line 742 of file driver_bmp280.c.

+

Definition at line 754 of file driver_bmp280.c.

@@ -999,7 +999,7 @@

Note
none
-

Definition at line 1604 of file driver_bmp280.c.

+

Definition at line 1616 of file driver_bmp280.c.

@@ -1094,7 +1094,7 @@

Note
none
-

Definition at line 1165 of file driver_bmp280.c.

+

Definition at line 1177 of file driver_bmp280.c.

@@ -1150,7 +1150,7 @@

Note
none
-

Definition at line 1303 of file driver_bmp280.c.

+

Definition at line 1315 of file driver_bmp280.c.

@@ -1220,7 +1220,7 @@

Note
none
-

Definition at line 1421 of file driver_bmp280.c.

+

Definition at line 1433 of file driver_bmp280.c.

@@ -1312,7 +1312,7 @@

Note
none
-

Definition at line 1008 of file driver_bmp280.c.

+

Definition at line 1020 of file driver_bmp280.c.

@@ -1404,7 +1404,7 @@

Note
none
-

Definition at line 854 of file driver_bmp280.c.

+

Definition at line 866 of file driver_bmp280.c.

@@ -1451,7 +1451,7 @@

Note
none
-

Definition at line 777 of file driver_bmp280.c.

+

Definition at line 789 of file driver_bmp280.c.

@@ -1498,7 +1498,7 @@

Note
none
-

Definition at line 1085 of file driver_bmp280.c.

+

Definition at line 1097 of file driver_bmp280.c.

@@ -1545,7 +1545,7 @@

Note
none
-

Definition at line 931 of file driver_bmp280.c.

+

Definition at line 943 of file driver_bmp280.c.

@@ -1592,7 +1592,7 @@

Note
none
-

Definition at line 700 of file driver_bmp280.c.

+

Definition at line 712 of file driver_bmp280.c.

@@ -1628,7 +1628,7 @@

Note
none
-

Definition at line 632 of file driver_bmp280.c.

+

Definition at line 644 of file driver_bmp280.c.

diff --git a/doc/html/group__bmp280__extern__driver.html b/doc/html/group__bmp280__extern__driver.html index a0dff26..547f4bd 100644 --- a/doc/html/group__bmp280__extern__driver.html +++ b/doc/html/group__bmp280__extern__driver.html @@ -156,7 +156,7 @@

Note
none
-

Definition at line 1582 of file driver_bmp280.c.

+

Definition at line 1594 of file driver_bmp280.c.

@@ -210,7 +210,7 @@

Note
none
-

Definition at line 1556 of file driver_bmp280.c.

+

Definition at line 1568 of file driver_bmp280.c.

diff --git a/src/driver_bmp280.c b/src/driver_bmp280.c index 85cded7..ee237be 100644 --- a/src/driver_bmp280.c +++ b/src/driver_bmp280.c @@ -608,11 +608,23 @@ uint8_t bmp280_deinit(bmp280_handle_t *handle) return 4; /* return error */ } - if (handle->iic_deinit() != 0) /* iic deinit */ + if (handle->iic_spi == BMP280_INTERFACE_IIC) /* iic interface */ { - handle->debug_print("bmp280: iic deinit failed.\n"); /* iic deinit failed */ + if (handle->iic_deinit() != 0) /* iic deinit */ + { + handle->debug_print("bmp280: iic deinit failed.\n"); /* iic deinit failed */ - return 1; /* return error */ + return 1; /* return error */ + } + } + else /* spi interface */ + { + if (handle->spi_deinit() != 0) /* spi deinit */ + { + handle->debug_print("bmp280: spi deinit failed.\n"); /* spi deinit failed */ + + return 1; /* return error */ + } } handle->inited = 0; /* flag close */