Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependents: mbed-TFT-example-NCS36510 mbed-Accelerometer-example-NCS36510 mbed-Accelerometer-example-NCS36510
targets/TARGET_NXP/TARGET_LPC82X/rom_i2c_8xx.h@1:f30bdcd2b33b, 2017-02-27 (annotated)
- Committer:
- jacobjohnson
- Date:
- Mon Feb 27 17:45:05 2017 +0000
- Revision:
- 1:f30bdcd2b33b
- Parent:
- 0:098463de4c5d
changed the inputscale from 1 to 7 in analogin_api.c. This will need to be changed later, and accessed from the main level, but for now this allows the adc to read a value from 0 to 3.7V, instead of just up to 1V.;
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
group-onsemi | 0:098463de4c5d | 1 | /* |
group-onsemi | 0:098463de4c5d | 2 | * @brief LPC8xx I2C ROM API declarations and functions |
group-onsemi | 0:098463de4c5d | 3 | * |
group-onsemi | 0:098463de4c5d | 4 | * @note |
group-onsemi | 0:098463de4c5d | 5 | * Copyright(C) NXP Semiconductors, 2012 |
group-onsemi | 0:098463de4c5d | 6 | * All rights reserved. |
group-onsemi | 0:098463de4c5d | 7 | * |
group-onsemi | 0:098463de4c5d | 8 | * @par |
group-onsemi | 0:098463de4c5d | 9 | * Software that is described herein is for illustrative purposes only |
group-onsemi | 0:098463de4c5d | 10 | * which provides customers with programming information regarding the |
group-onsemi | 0:098463de4c5d | 11 | * LPC products. This software is supplied "AS IS" without any warranties of |
group-onsemi | 0:098463de4c5d | 12 | * any kind, and NXP Semiconductors and its licensor disclaim any and |
group-onsemi | 0:098463de4c5d | 13 | * all warranties, express or implied, including all implied warranties of |
group-onsemi | 0:098463de4c5d | 14 | * merchantability, fitness for a particular purpose and non-infringement of |
group-onsemi | 0:098463de4c5d | 15 | * intellectual property rights. NXP Semiconductors assumes no responsibility |
group-onsemi | 0:098463de4c5d | 16 | * or liability for the use of the software, conveys no license or rights under any |
group-onsemi | 0:098463de4c5d | 17 | * patent, copyright, mask work right, or any other intellectual property rights in |
group-onsemi | 0:098463de4c5d | 18 | * or to any products. NXP Semiconductors reserves the right to make changes |
group-onsemi | 0:098463de4c5d | 19 | * in the software without notification. NXP Semiconductors also makes no |
group-onsemi | 0:098463de4c5d | 20 | * representation or warranty that such application will be suitable for the |
group-onsemi | 0:098463de4c5d | 21 | * specified use without further testing or modification. |
group-onsemi | 0:098463de4c5d | 22 | * |
group-onsemi | 0:098463de4c5d | 23 | * @par |
group-onsemi | 0:098463de4c5d | 24 | * Permission to use, copy, modify, and distribute this software and its |
group-onsemi | 0:098463de4c5d | 25 | * documentation is hereby granted, under NXP Semiconductors' and its |
group-onsemi | 0:098463de4c5d | 26 | * licensor's relevant copyrights in the software, without fee, provided that it |
group-onsemi | 0:098463de4c5d | 27 | * is used in conjunction with NXP Semiconductors microcontrollers. This |
group-onsemi | 0:098463de4c5d | 28 | * copyright, permission, and disclaimer notice must appear in all copies of |
group-onsemi | 0:098463de4c5d | 29 | * this code. |
group-onsemi | 0:098463de4c5d | 30 | */ |
group-onsemi | 0:098463de4c5d | 31 | |
group-onsemi | 0:098463de4c5d | 32 | #ifndef __ROM_I2C_8XX_H_ |
group-onsemi | 0:098463de4c5d | 33 | #define __ROM_I2C_8XX_H_ |
group-onsemi | 0:098463de4c5d | 34 | |
group-onsemi | 0:098463de4c5d | 35 | #ifdef __cplusplus |
group-onsemi | 0:098463de4c5d | 36 | extern "C" { |
group-onsemi | 0:098463de4c5d | 37 | #endif |
group-onsemi | 0:098463de4c5d | 38 | |
group-onsemi | 0:098463de4c5d | 39 | /** @defgroup CHIP_I2CROM_8XX CHIP: LPC8xx I2C ROM API declarations and functions |
group-onsemi | 0:098463de4c5d | 40 | * @ingroup CHIP_8XX_Drivers |
group-onsemi | 0:098463de4c5d | 41 | * @{ |
group-onsemi | 0:098463de4c5d | 42 | */ |
group-onsemi | 0:098463de4c5d | 43 | |
group-onsemi | 0:098463de4c5d | 44 | /** |
group-onsemi | 0:098463de4c5d | 45 | * @brief LPC8xx I2C ROM driver handle structure |
group-onsemi | 0:098463de4c5d | 46 | */ |
group-onsemi | 0:098463de4c5d | 47 | typedef void *I2C_HANDLE_T; |
group-onsemi | 0:098463de4c5d | 48 | |
group-onsemi | 0:098463de4c5d | 49 | typedef uint32_t ErrorCode_t; |
group-onsemi | 0:098463de4c5d | 50 | |
group-onsemi | 0:098463de4c5d | 51 | /** |
group-onsemi | 0:098463de4c5d | 52 | * @brief LPC8xx I2C ROM driver callback function |
group-onsemi | 0:098463de4c5d | 53 | */ |
group-onsemi | 0:098463de4c5d | 54 | typedef void (*I2C_CALLBK_T)(uint32_t err_code, uint32_t n); |
group-onsemi | 0:098463de4c5d | 55 | |
group-onsemi | 0:098463de4c5d | 56 | /** |
group-onsemi | 0:098463de4c5d | 57 | * LPC8xx I2C ROM driver parameter structure |
group-onsemi | 0:098463de4c5d | 58 | */ |
group-onsemi | 0:098463de4c5d | 59 | typedef struct I2C_PARAM { |
group-onsemi | 0:098463de4c5d | 60 | uint32_t num_bytes_send; /*!< No. of bytes to send */ |
group-onsemi | 0:098463de4c5d | 61 | uint32_t num_bytes_rec; /*!< No. of bytes to receive */ |
group-onsemi | 0:098463de4c5d | 62 | uint8_t *buffer_ptr_send; /*!< Pointer to send buffer */ |
group-onsemi | 0:098463de4c5d | 63 | uint8_t *buffer_ptr_rec; /*!< Pointer to receive buffer */ |
group-onsemi | 0:098463de4c5d | 64 | I2C_CALLBK_T func_pt; /*!< Callback function */ |
group-onsemi | 0:098463de4c5d | 65 | uint8_t stop_flag; /*!< Stop flag */ |
group-onsemi | 0:098463de4c5d | 66 | uint8_t dummy[3]; |
group-onsemi | 0:098463de4c5d | 67 | } I2C_PARAM_T; |
group-onsemi | 0:098463de4c5d | 68 | |
group-onsemi | 0:098463de4c5d | 69 | /** |
group-onsemi | 0:098463de4c5d | 70 | * LPC8xx I2C ROM driver result structure |
group-onsemi | 0:098463de4c5d | 71 | */ |
group-onsemi | 0:098463de4c5d | 72 | typedef struct I2C_RESULT { |
group-onsemi | 0:098463de4c5d | 73 | uint32_t n_bytes_sent; /*!< No. of bytes sent */ |
group-onsemi | 0:098463de4c5d | 74 | uint32_t n_bytes_recd; /*!< No. of bytes received */ |
group-onsemi | 0:098463de4c5d | 75 | } I2C_RESULT_T; |
group-onsemi | 0:098463de4c5d | 76 | |
group-onsemi | 0:098463de4c5d | 77 | /** |
group-onsemi | 0:098463de4c5d | 78 | * LPC8xx I2C ROM driver modes enum |
group-onsemi | 0:098463de4c5d | 79 | */ |
group-onsemi | 0:098463de4c5d | 80 | typedef enum CHIP_I2C_MODE { |
group-onsemi | 0:098463de4c5d | 81 | IDLE, /*!< IDLE state */ |
group-onsemi | 0:098463de4c5d | 82 | MASTER_SEND, /*!< Master send state */ |
group-onsemi | 0:098463de4c5d | 83 | MASTER_RECEIVE, /*!< Master Receive state */ |
group-onsemi | 0:098463de4c5d | 84 | SLAVE_SEND, /*!< Slave send state */ |
group-onsemi | 0:098463de4c5d | 85 | SLAVE_RECEIVE /*!< Slave receive state */ |
group-onsemi | 0:098463de4c5d | 86 | } CHIP_I2C_MODE_T; |
group-onsemi | 0:098463de4c5d | 87 | |
group-onsemi | 0:098463de4c5d | 88 | /** |
group-onsemi | 0:098463de4c5d | 89 | * LPC8xx I2C ROM driver APIs structure |
group-onsemi | 0:098463de4c5d | 90 | */ |
group-onsemi | 0:098463de4c5d | 91 | typedef struct I2CD_API { |
group-onsemi | 0:098463de4c5d | 92 | /*!< Interrupt Support Routine */ |
group-onsemi | 0:098463de4c5d | 93 | void (*i2c_isr_handler)(I2C_HANDLE_T *handle); |
group-onsemi | 0:098463de4c5d | 94 | |
group-onsemi | 0:098463de4c5d | 95 | /*!< MASTER functions */ |
group-onsemi | 0:098463de4c5d | 96 | ErrorCode_t (*i2c_master_transmit_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 97 | ErrorCode_t (*i2c_master_receive_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 98 | ErrorCode_t (*i2c_master_tx_rx_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 99 | ErrorCode_t (*i2c_master_transmit_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 100 | ErrorCode_t (*i2c_master_receive_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 101 | ErrorCode_t (*i2c_master_tx_rx_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 102 | |
group-onsemi | 0:098463de4c5d | 103 | /*!< SLAVE functions */ |
group-onsemi | 0:098463de4c5d | 104 | ErrorCode_t (*i2c_slave_receive_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 105 | ErrorCode_t (*i2c_slave_transmit_poll)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 106 | ErrorCode_t (*i2c_slave_receive_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 107 | ErrorCode_t (*i2c_slave_transmit_intr)(I2C_HANDLE_T *handle, I2C_PARAM_T *param, I2C_RESULT_T *result); |
group-onsemi | 0:098463de4c5d | 108 | ErrorCode_t (*i2c_set_slave_addr)(I2C_HANDLE_T *handle, uint32_t slave_addr_0_3, uint32_t slave_mask_0_3); |
group-onsemi | 0:098463de4c5d | 109 | |
group-onsemi | 0:098463de4c5d | 110 | /*!< OTHER support functions */ |
group-onsemi | 0:098463de4c5d | 111 | uint32_t (*i2c_get_mem_size)(void); |
group-onsemi | 0:098463de4c5d | 112 | I2C_HANDLE_T * (*i2c_setup)( uint32_t i2c_base_addr, uint32_t * start_of_ram); |
group-onsemi | 0:098463de4c5d | 113 | ErrorCode_t (*i2c_set_bitrate)(I2C_HANDLE_T *handle, uint32_t p_clk_in_hz, uint32_t bitrate_in_bps); |
group-onsemi | 0:098463de4c5d | 114 | uint32_t (*i2c_get_firmware_version)(void); |
group-onsemi | 0:098463de4c5d | 115 | CHIP_I2C_MODE_T (*i2c_get_status)(I2C_HANDLE_T *handle); |
group-onsemi | 0:098463de4c5d | 116 | ErrorCode_t (*i2c_set_timeout)(I2C_HANDLE_T *handle, uint32_t timeout); |
group-onsemi | 0:098463de4c5d | 117 | } I2CD_API_T; |
group-onsemi | 0:098463de4c5d | 118 | |
group-onsemi | 0:098463de4c5d | 119 | /** |
group-onsemi | 0:098463de4c5d | 120 | * @} |
group-onsemi | 0:098463de4c5d | 121 | */ |
group-onsemi | 0:098463de4c5d | 122 | |
group-onsemi | 0:098463de4c5d | 123 | #ifdef __cplusplus |
group-onsemi | 0:098463de4c5d | 124 | } |
group-onsemi | 0:098463de4c5d | 125 | #endif |
group-onsemi | 0:098463de4c5d | 126 | |
group-onsemi | 0:098463de4c5d | 127 | #endif /* __ROM_I2C_8XX_H_ */ |