Barometer program : Data Logger function includes Barometer & temperature (BMP180), Humidity & temp. (RHT03), Sunshine (Cds), RTC(M41T62) data. : Logging data saves into EEPROM (AT24C1024) using ring buffer function.
Dependencies: AT24C1024 RHT03 TextLCD BMP180 M41T62
Fork of mbed_blinky by
Please see https://mbed.org/users/kenjiArai/notebook/mbed-lpc1114fn28-barometer-with-data-logging/#
Diff: dt_log.h
- Revision:
- 16:f164f8912201
- Parent:
- 15:065fbeddc305
- Child:
- 18:b3a27f681171
--- a/dt_log.h Sun Jun 29 06:58:00 2014 +0000 +++ b/dt_log.h Thu Jul 03 22:01:25 2014 +0000 @@ -6,7 +6,7 @@ * http://www.page.sannet.ne.jp/kenjia/index.html * http://mbed.org/users/kenjiArai/ * Created: June 16th, 2013 - * Revised: June 29th, 2014 + * Revised: July 3rd, 2014 * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE @@ -15,6 +15,9 @@ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ +#ifndef _DT_LOG_H_ +#define _DT_LOG_H_ + // Definition ----------------------------------------------------------------------------------- // Buffer size #define EEP_SIZE 128 * 1024 // 1Mbits = 128 KBytes @@ -27,41 +30,13 @@ #define PTR_SIZE 16 // Buffer control -#define BUF_HEAD 0x0001 -#define BUF_RD_ALL 0 +#define RING_TOP 1 +#define RING_TAIL (BLK_NO - RING_TOP -1) #define BLK_SIZE 16 -// Buffer Status -#define BUF_FULL 0xff - -// Packet pointer -#define READ_POINTER() \ - ((uint16_t)(( buf_pointer[0] << 8) + buf_pointer[1])) -#define WRITE_POINTER(x) \ - buf_pointer[0] = (uint8_t)( x >> 8); \ - buf_pointer[1] = (uint8_t)x; -#define RD_STATUS() \ - (buf_pointer[2]) -#define WR_STATUS(x) \ - buf_pointer[2] = (uint8_t)x; - -// Pointer structure -typedef struct EEPROM_BUF_INF{ - uint16_t wr_pointer; - uint16_t max; - uint16_t ptr; - uint8_t size; - uint8_t status; -} xEeprom_ptr; - -// RAM definition -extern uint8_t data_pack[PKT_SIZE]; - // Function prototypes --------------------------------------------------------------------------- void dtlog_data_pack(void); void dtlog_one_write(void); -void dtlog_rd_buf_inf(xEeprom_ptr *); -void dtlog_clear_all_buff(xEeprom_ptr *); -void dtlog_block_read(xEeprom_ptr *); -void dtlog_num_of_block(xEeprom_ptr *); uint16_t dtlog_buf_occupation(void); + +#endif // _DT_LOG_H_