AG903ライブラリリファレンス
内容インデックスホーム
Body Source
本文ソース
1: int32_t AG903_I2CMgrGetHandle(uint8_t ch, AG903_I2CMgrHandle** handle) 2: { 3: int32_t retval = AG903_ENONE; 4: uint32_t loop; 5: 6: if( (AG903_I2C_CH_NUM <= ch) || 7: (NULL == handle) ) { 8: return -AG903_EINVAL; 9: } 10: 11: for(loop=0; loop<AG903_I2C_HANDLE_NUM; loop++) { 12: if(false == I2cHandleStat[ch][loop].lock) { 13: I2cHandleStat[ch][loop].lock = true; 14: break; 15: } 16: } 17: if(AG903_I2C_HANDLE_NUM <= loop) { 18: return -AG903_EBUSY; 19: } 20: 21: I2cHandleStat[ch][loop].stat = AG903_I2C_HANDLE_IDLE; 22: I2cHandleStat[ch][loop].clbk = NULL; 23: 24: (*handle) = (AG903_I2CMgrHandle*)&I2cHandleStat[ch][loop]; 25: 26: return retval; 27: }
Copyright (c) 2017-2025 Axell Corporation. All rights reserved.